Infra Utilities
synutils is the unified entry point in every notebook — a Python attribute and a Scala REPL alias. Each section below lists user-callable methods with examples in both languages.
infrastructure — platform infra metadata
The full method surface, side by side. Use the canonical method in new code. Legacy aliases exist only for backward compatibility with pre-integration notebooks.
Properties (read-only attributes)
| Returns | Python | Scala | Legacy (Python) |
|---|---|---|---|
Cloud provider —"AWS"/"GOOGLE"/"AZURE" | providerType | providerType | get_provider_type_from_metadata() |
| Cloud region | region | region | — |
| GCP project ID (empty for AWS/Azure) | projectId | projectId | — |
| Default storage bucket | bucket | bucket | — |
Filesystem prefix (s3://,gs://,abfs://) | fileSystemPrefix | fileSystemPrefix | — |
Full storage path (prefix + bucket) | storagePath | storagePath | — |
| SSH connection type | sshType | sshType | — |
Metastore type (AWS_GLUE/HIVE/BIGQUERY) | metastoreType | metastoreType | — |
| Metastore hostname | metastoreHostname | metastoreHostname | — |
Section getters
| Returns | Python | Scala | Legacy (Python) |
|---|---|---|---|
configsection — region, projectId, etc. | getConfig() | getConfig() | get_config_from_metadata() |
storagesection — bucket, paths | getStorage() | getStorage() | get_storage_from_metadata() |
networksection | getNetwork() | getNetwork() | get_network_from_metadata() |
metastoresection | getMetastore() | getMetastore() | get_metastore_from_metadata() |
securitysection — cloud creds, SSH | getSecurity() | getSecurity() | get_security_from_metadata() |
| Full payload (all sections) | getAll() | getAll() | get_all_from_metadata(), asDict(), get_infrasturcture_json(token=None) |
Global init script (Optional[str]/Option[String]) | getGlobalInitScript() | getGlobalInitScript() | get_global_init_script_from_metadata() |
| Drop the cached payload | clearCache() | clearCache() | — |
Generic accessors (backward-compat with legacy InfrastructureClient)
| Returns | Python | Scala | Legacy (Python) |
|---|---|---|---|
Any infraProvider section by name | get(resource) | (usegetAll()("infraProvider")(resource)) | get(token, resource) |
| Same — alias | get_from_metadata(resource) | — | get_from_metadata(resource) |
| Full payload (legacy typo preserved) | get_infrasturcture_json(token=None) | — | get_infrasturcture_json(token) |
The token parameter is accepted on the legacy aliases but ignored — auth is handled by the underlying ApiClient at construction. Sensitive values under security / metastore come back as SecretString (redact on print, work as plain str with SDKs).
# Generic — fetch any section dynamically
synutils.infrastructure.get("storage") # plain dict
synutils.infrastructure.get("notebookConfig") # {"script": "..."}
synutils.infrastructure.get("security") # values redact when printed
# Legacy aliases
synutils.infrastructure.get_from_metadata("storage")
synutils.infrastructure.get_infrasturcture_json() # full nested payload
Python returns
dicteverywhere; Scala returnsMap[String, AnyRef]. Same shape, language-native types.
Secret fields (encrypted + sealed)
Encrypted fields are auto-decrypted by the platform and wrapped in SecretString so they redact in print / log output. Pull a value out of the dict and call .get() / .unseal() to reveal the decrypted plaintext.
| Section | Secret field names |
|---|---|
metastore | metastorePassword |
security | keyFile, accessKey, secretKey, sshUserPass |
bigQuery | keyFile |
bigTable | keyFile |
redshift | password |
kafka | sslCertificate, sslKey |
gitConfig | personalAccessToken, oauthToken, sshKey |
If decryption fails (no key, malformed ciphertext) the original ciphertext is preserved and a warning is logged — print(meta["metastorePassword"]) still redacts to **********, but .get() returns the raw ciphertext rather than the plaintext.
The seven subsections above are not exposed as individual section getters; access them via getAll() / asDict() / get_infrasturcture_json() or via the existing getMetastore() / getSecurity() for those two.
Python
print(synutils.infrastructure.providerType, synutils.infrastructure.bucket)
print(synutils.infrastructure.getStorage()) # full storage dict
sec = synutils.infrastructure.getSecurity()
print(sec) # {'accessKey': '**********', 'secretKey': '**********', ...}
sec["secretKey"].get() # decrypted plaintext
meta = synutils.infrastructure.getMetastore()
meta["metastorePassword"].get() # decrypted plaintext
payload = synutils.infrastructure.getAll()
payload["infraProvider"]["security"]["secretKey"].get() # decrypted
payload["infraProvider"]["metastore"]["metastorePassword"].get() # decrypted
payload["infraProvider"]["bigQuery"]["keyFile"].get() # decrypted JSON
payload["infraProvider"]["redshift"]["password"].get() # decrypted
payload["infraProvider"]["kafka"]["sslKey"].get() # decrypted
payload["infraProvider"]["gitConfig"]["personalAccessToken"].get() # decrypted
Scala
SecretStringis available as a bare name in notebook Scala sessions.
println(s"${synutils.infrastructure.providerType} ${synutils.infrastructure.bucket}")
println(synutils.infrastructure.getStorage()) // full storage Map
val sec = synutils.infrastructure.getSecurity()
println(sec) // values render as **********
// Map[String, AnyRef] preserves the seal — values aren't auto-unsealed.
// Cast to SecretString to access .get() / .unseal().
val secretKey = sec("secretKey").asInstanceOf[SecretString]
println(secretKey) // **********
println(secretKey.get()) // decrypted plaintext
val pwd = synutils.infrastructure.getMetastore()("metastorePassword")
.asInstanceOf[SecretString]
val raw: String = pwd // implicit conversion reveals (decrypted)