Class: DockerEngineRuby::Resources::Secrets

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_engine_ruby/resources/secrets.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Secrets

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Secrets.

Parameters:



116
117
118
# File 'lib/docker_engine_ruby/resources/secrets.rb', line 116

def initialize(client:)
  @client = client
end

Instance Method Details

#create(spec:, request_options: {}) ⇒ DockerEngineRuby::Models::SecretCreateResponse

Create a secret



16
17
18
19
20
21
22
23
24
25
# File 'lib/docker_engine_ruby/resources/secrets.rb', line 16

def create(params)
  parsed, options = DockerEngineRuby::SecretCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "secrets/create",
    body: parsed[:spec],
    model: DockerEngineRuby::Models::SecretCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ nil

Delete a secret

Parameters:

Returns:

  • (nil)

See Also:



85
86
87
88
89
90
91
92
# File 'lib/docker_engine_ruby/resources/secrets.rb', line 85

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["secrets/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#inspect_(id, request_options: {}) ⇒ DockerEngineRuby::Models::Secret

Inspect a secret

Parameters:

Returns:

See Also:



104
105
106
107
108
109
110
111
# File 'lib/docker_engine_ruby/resources/secrets.rb', line 104

def inspect_(id, params = {})
  @client.request(
    method: :get,
    path: ["secrets/%1$s", id],
    model: DockerEngineRuby::Secret,
    options: params[:request_options]
  )
end

#list(filters: nil, request_options: {}) ⇒ Array<DockerEngineRuby::Models::Secret>

List secrets

Parameters:

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
# File 'lib/docker_engine_ruby/resources/secrets.rb', line 64

def list(params = {})
  parsed, options = DockerEngineRuby::SecretListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "secrets",
    query: parsed,
    model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::Secret],
    options: options
  )
end

#update(id, version:, spec:, request_options: {}) ⇒ nil

Update a Secret

Parameters:

Returns:

  • (nil)

See Also:



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/docker_engine_ruby/resources/secrets.rb', line 42

def update(id, params)
  parsed, options = DockerEngineRuby::SecretUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["secrets/%1$s/update", id],
    query: parsed.except(:spec),
    body: parsed[:spec],
    model: NilClass,
    options: options
  )
end