Secrets

class Secrets(dockerClient: DockerClient)

Docker Swarm secret operations. Requires a Swarm manager; this API never initializes Swarm. HTTP errors return the original SDK Result. Transport/decoding failures and cancellation throw. The caller owns the client. Operations are never retried automatically.

Constructors

Link copied to clipboard
constructor(dockerClient: DockerClient)

Functions

Link copied to clipboard
suspend fun create(spec: SecretSpec): Result<SwarmCreateResponse, ErrorResponse>

Creates a secret. Data in spec must already be Base64 encoded; no encoding is performed here. Docker validates payload size, names and driver options. Treat specs and responses as sensitive.

Link copied to clipboard
suspend fun getInfo(id: String): Result<Secret, ErrorResponse>

Inspects a secret by ID or name. Docker never returns secret data.

Link copied to clipboard
suspend fun getList(filters: Map<String, List<String>>? = null): Result<List<Secret>, ErrorResponse>

Lists secret metadata. Filters accept id, name, names and label, encoded as JSON.

Link copied to clipboard
suspend fun remove(id: String): Result<Unit, ErrorResponse>

Deletes a secret by ID or name. Docker rejects removal while a service references it.

Link copied to clipboard
suspend fun update(id: String, version: ULong, spec: SecretSpec): Result<Unit, ErrorResponse>

Updates labels using the version index from the latest inspect response. Copy the inspected spec and change only labels; other fields must remain unchanged. Stale versions are reported as Docker errors. No re-inspection, merging or retry is performed.