Class: Docker::API::Secret
Overview
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.
Instance Method Summary collapse
-
#create(body = {}) ⇒ Object
Create a secret.
-
#delete(name) ⇒ Object
Delete a secret.
-
#details(name) ⇒ Object
Inspect a secret.
-
#list(params = {}) ⇒ Object
List secrets.
-
#update(name, params = {}, body = {}) ⇒ Object
Update a secret.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Docker::API::Base
Instance Method Details
#create(body = {}) ⇒ Object
Create a secret
Docker API: POST /secrets/create
23 24 25 |
# 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(name) ⇒ Object
Delete a secret
Docker API: DELETE /secrets/id
55 56 57 |
# File 'lib/docker/api/secret.rb', line 55 def delete name @connection.delete("/secrets/#{name}") end |
#details(name) ⇒ Object
Inspect a secret
Docker API: GET /secrets/id
33 34 35 |
# File 'lib/docker/api/secret.rb', line 33 def details name @connection.get("/secrets/#{name}") end |
#list(params = {}) ⇒ Object
List secrets
Docker API: GET /secrets
13 14 15 |
# File 'lib/docker/api/secret.rb', line 13 def list params = {} @connection.get(build_path("/secrets",params)) end |
#update(name, params = {}, body = {}) ⇒ Object
Update a secret
Docker API: POST /secrets/id/update
45 46 47 |
# 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 |