SecretService
Section titled “SecretService”Service for managing organization-scoped Daytona Secrets. Can be used to list, get, create, update and delete Secrets.
Constructors
Section titled “Constructors”new SecretService()
Section titled “new SecretService()”def initialize(secret_api, otel_state:)Service for managing organization-scoped Daytona Secrets. Can be used to list, get, create, update and delete Secrets.
A Secret stores a plaintext +value+ that is never returned by the API. When a Secret is referenced while creating a Sandbox, the corresponding env var holds an opaque +placeholder+ that is resolved to the real value only for the Secret’s allowed +hosts+.
Parameters:
secret_apiDaytonaApiClient:SecretApi -otel_stateDaytona:OtelState, nil -
Returns:
SecretService- a new instance of SecretService
Methods
Section titled “Methods”create()
Section titled “create()”def create(name, value, description:, hosts:)Create a new Secret.
Parameters:
nameString - Name of the Secret. Must match +^[a-zA-Z_][a-zA-Z0-9_-]*$+ and be unique within the organization (a duplicate name raises a 409 error).valueString - Plaintext value of the Secret. Write-only; never returned by the API.descriptionString, nil - Optional description of the Secret.hostsArray<String>, nil - Allowed hosts this Secret may be sent to. Accepts exact hostnames and +*.+ wildcards (no ports).
Returns:
Daytona:Secret
delete()
Section titled “delete()”def delete(secret_id)Delete a Secret.
Parameters:
secret_idString -
Returns:
void
Raises:
DaytonaApiClient:ApiError- If no Secret with the given ID exists (404).
def get(secret_id)Get a Secret by ID.
Parameters:
secret_idString -
Returns:
Daytona:Secret
Raises:
DaytonaApiClient:ApiError- If no Secret with the given ID exists (404).
list()
Section titled “list()”def list()List all Secrets.
Returns:
Array\<Daytona:Secret\>
update()
Section titled “update()”def update(secret_id, value:, description:, hosts:)Update a Secret.
Parameters:
secret_idString -valueString, nil - New plaintext value. Write-only; never returned by the API.descriptionString, nil - New description of the Secret.hostsArray<String>, nil - Allowed hosts this Secret may be sent to. Accepts exact hostnames and +*.+ wildcards (no ports).
Returns:
Daytona:Secret
Raises:
DaytonaApiClient:ApiError- If no Secret with the given ID exists (404).