API Reference
Reference for the modules most useful when working against Raaz directly - e.g. writing a third-party provider plugin (see Providers) or scripting around the local context.
Request flow
Every command that touches secrets follows the same path, regardless of which backend it ends up talking to:
flowchart LR
CLI["CLI"] --> CTX["Context"] --> CLIENT["RaazClient"] --> PROVIDER(["Provider"]) --> BACKEND["Backend"]
RaazClient (the client facade below) is the only thing CLI commands talk to directly - it never imports a
concrete provider itself, only the Provider protocol, looked up by name via get_provider(). That's the
extension point: a third-party provider (see Providers) just needs to implement Provider and
register itself under the raaz.providers entry point group - RaazClient, and every command built on it,
works with it identically to the five built-in ones. local is the one built-in provider whose "backend" is
actually EnvManager's on-disk store under ~/.raaz rather than a real cloud SDK - see
Local env store below.
Provider protocol
Provider
Bases: Protocol
Source code in raaz\providers\protocol.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
fetch_secrets(app, env)
{filename: raw content} for app/env, without writing to disk.
Source code in raaz\providers\protocol.py
32 33 | |
ProviderConfig
Bases: Protocol
Source code in raaz\providers\protocol.py
40 41 42 43 44 | |
get_config()
Current config values as a plain dict for the provider's SDK client - distinct from config_fields' static schema (no values), and not required to include every config_fields entry.
Source code in raaz\providers\protocol.py
41 42 43 44 | |
Context
Source code in raaz\provider_context.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
resolve_context(app=None, env=None, provider=None, dir=None)
classmethod
CLI options override the saved context; raises if neither yields a full set.
Source code in raaz\provider_context.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
Local env store
Source code in raaz\env_manager.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
get_env_dir(ctx)
Return the local env dir for a context, shaped like every provider's
~/.raaz/providers/
Source code in raaz\env_manager.py
21 22 23 24 25 | |
Client facade
Source code in raaz\raaz_client.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
diff()
Full local-vs-remote comparison (local-only/remote-only/changed/unchanged), without pulling or pushing. Both sides filtered by env_file_pattern, since cloud providers' fetch_secrets() otherwise returns everything under app/env regardless of pattern.
Source code in raaz\raaz_client.py
192 193 194 195 196 197 198 199 200 201 202 203 204 | |
diff_envs(against_env)
Remote-vs-remote: the current context's env vs. against_env, same
app/provider - never touches local files at all. Reuses DiffResult's shape
(see its docstring) purely to avoid a near-duplicate type for one caller.
Source code in raaz\raaz_client.py
206 207 208 209 210 211 212 213 214 215 216 217 218 | |
fetch_secrets()
{filename: raw content} for the current context - nothing written to disk.
Source code in raaz\raaz_client.py
163 164 165 166 167 168 | |
pull(filtered=False, filter_desc=None)
filtered=True (a --pattern/filename was given) fetches everything and
writes only matching entries, instead of delegating to provider.pull(),
which always writes everything under app/env regardless of pattern.
Source code in raaz\raaz_client.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
run(command, verbose=False)
Run command with every secret injected as env vars - nothing written to
disk. verbose=True prints a table of what's being injected first.
Source code in raaz\raaz_client.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
unpushed_changes()
Local .env-style files that differ from, or were never pushed to, this
context - used to warn before raaz ctx use switches away.
Source code in raaz\raaz_client.py
170 171 172 173 174 | |
unpushed_changes_detail()
Same as unpushed_changes(), split into (never_pushed, edited_since_push) - the two read as ambiguous when merged into one warning message.
Source code in raaz\raaz_client.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |