class Docker::API::Secret
This class represents the Docker
API endpoints regarding secrets.
Secrets are sensitive data that can be used by services. Swarm mode must be enabled for these endpoints to work. @see docs.docker.com/engine/api/v1.40/#tag/Secret
Public Instance Methods
Create a secret
Docker
API: POST /secrets/create @see docs.docker.com/engine/api/v1.40/#operation/SecretCreate
@param body [Hash]: Request body to be sent as json.
# File lib/docker/api/secret.rb, line 23 def create body = {} @connection.request(method: :post, path: "/secrets/create", headers: {"Content-Type": "application/json"}, body: body.to_json) end
Delete a secret
Docker
API: DELETE /secrets/{id} @see docs.docker.com/engine/api/v1.40/#operation/SecretDelete
@param name [String]: The ID or name of the secret.
# File lib/docker/api/secret.rb, line 55 def delete name @connection.delete("/secrets/#{name}") end
Inspect a secret
Docker
API: GET /secrets/{id} @see docs.docker.com/engine/api/v1.40/#operation/SecretInspect
@param name [String]: The ID or name of the secret.
# File lib/docker/api/secret.rb, line 33 def details name @connection.get("/secrets/#{name}") end
List secrets
Docker
API: GET /secrets @see docs.docker.com/engine/api/v1.40/#operation/SecretList
@param params [Hash]: Parameters that are appended to the URL.
# File lib/docker/api/secret.rb, line 13 def list params = {} @connection.get(build_path("/secrets",params)) end
Update a secret
Docker
API: POST /secrets/{id}/update @see docs.docker.com/engine/api/v1.40/#operation/SecretUpdate
@param name [String]: The ID or name of the secret. @param params [Hash]: Parameters that are appended to the URL. @param body [Hash]: Request body to be sent as json.
# File lib/docker/api/secret.rb, line 45 def update name, params = {}, body = {} @connection.request(method: :post, path: build_path("/secrets/#{name}/update",params), headers: {"Content-Type": "application/json"}, body: body.to_json) end