Secrets Module¶
This section documents the secrets components of the Nextmv Cloud API.
secrets
¶
This module contains the declarations for secrets management.
CLASS | DESCRIPTION |
---|---|
SecretsCollectionSummary |
Summary of a secrets collection in Nextmv Cloud. |
SecretType |
Enumeration of available secret types. |
Secret |
Representation of a sensitive piece of information. |
SecretsCollection |
Collection of secrets hosted in the Nextmv Cloud. |
Secret
¶
Bases: BaseModel
A secret is a piece of sensitive information that is stored securely in the Nextmv Cloud.
You can import the Secret
class directly from cloud
:
This class represents an individual secret, detailing its type, location (if applicable), and value.
PARAMETER | DESCRIPTION |
---|---|
|
The type of the secret, indicating how it should be handled (e.g.,
as an environment variable or a file). This is aliased from
TYPE:
|
|
The location where the secret will be made available. For
TYPE:
|
|
The actual content of the secret.
TYPE:
|
Examples:
>>> env_secret = Secret(
... secret_type=SecretType.ENV,
... location="API_KEY",
... value="supersecretapikey123"
... )
>>> print(env_secret.location)
API_KEY
>>> file_secret = Secret(
... secret_type=SecretType.FILE,
... location="/mnt/secrets/config.json",
... value='''{"user": "admin", "pass": "secure"}'''
... )
>>> print(file_secret.secret_type)
SecretType.FILE
secret_type
class-attribute
instance-attribute
¶
secret_type: SecretType = Field(
serialization_alias="type",
validation_alias=AliasChoices("type", "secret_type"),
)
Type of the secret.
SecretType
¶
Bases: str
, Enum
Type of the secret that is stored in the Nextmv Cloud.
You can import the SecretType
class directly from cloud
:
This enumeration defines the types of secrets that can be managed.
ATTRIBUTE | DESCRIPTION |
---|---|
ENV |
Represents an environment variable secret. The value of the secret will be available as an environment variable in the execution environment.
TYPE:
|
FILE |
Represents a file-based secret. The value of the secret will be
written to a file, and the path to this file will be available
via the
TYPE:
|
Examples:
SecretsCollection
¶
Bases: SecretsCollectionSummary
, BaseModel
A secrets collection is a mechanism for hosting secrets securely in the Nextmv Cloud.
You can import the SecretsCollection
class directly from cloud
:
This class extends SecretsCollectionSummary
by including the actual list
of secrets contained within the collection.
PARAMETER | DESCRIPTION |
---|---|
|
A list of
TYPE:
|
|
Variable length argument list for
|
|
Arbitrary keyword arguments for
|
Examples:
>>> from datetime import datetime
>>> secret1 = Secret(
... secret_type=SecretType.ENV,
... location="DATABASE_USER",
... value="nextmv_user"
... )
>>> secret2 = Secret(
... secret_type=SecretType.FILE,
... location="/etc/app/license.key",
... value="longlicensekeystring"
... )
>>> full_collection = SecretsCollection(
... collection_id="col_789",
... application_id="app_000",
... name="Full App Secrets",
... description="All secrets required by the main application",
... created_at=datetime.now(),
... updated_at=datetime.now(),
... secrets=[secret1, secret2]
... )
>>> print(full_collection.name)
Full App Secrets
>>> print(len(full_collection.secrets))
2
SecretsCollectionSummary
¶
Bases: BaseModel
The summary of a secrets collection in the Nextmv Cloud.
You can import the SecretsCollectionSummary
class directly from cloud
:
A secrets collection is a mechanism for hosting secrets securely in the Nextmv Cloud. This class provides summary information about such a collection.
PARAMETER | DESCRIPTION |
---|---|
|
ID of the secrets collection. This is aliased from
TYPE:
|
|
ID of the application to which the secrets collection belongs.
TYPE:
|
|
Name of the secrets collection.
TYPE:
|
|
Description of the secrets collection.
TYPE:
|
|
Creation date of the secrets collection.
TYPE:
|
|
Last update date of the secrets collection.
TYPE:
|
Examples:
>>> from datetime import datetime
>>> collection_summary = SecretsCollectionSummary(
... collection_id="col_123",
... application_id="app_456",
... name="My API Credentials",
... description="Collection of API keys for external services",
... created_at=datetime.now(),
... updated_at=datetime.now()
... )
>>> print(collection_summary.name)
My API Credentials