Class: DockerEngineRuby::Resources::Configs

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Configs

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 Configs.

Parameters:



118
119
120
# File 'lib/docker_engine_ruby/resources/configs.rb', line 118

def initialize(client:)
  @client = client
end

Instance Method Details

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

Create a config



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

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

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

Delete a config

Parameters:

Returns:

  • (nil)

See Also:



87
88
89
90
91
92
93
94
# File 'lib/docker_engine_ruby/resources/configs.rb', line 87

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

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

Inspect a config

Parameters:

Returns:

See Also:



106
107
108
109
110
111
112
113
# File 'lib/docker_engine_ruby/resources/configs.rb', line 106

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

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

List configs

Parameters:

Returns:

See Also:



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

def list(params = {})
  parsed, options = DockerEngineRuby::ConfigListParams.dump_request(params)
  query = DockerEngineRuby::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "configs",
    query: query,
    model: DockerEngineRuby::Internal::Type::ArrayOf[DockerEngineRuby::ConfigObject],
    options: options
  )
end

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

Update a Config

Parameters:

Returns:

  • (nil)

See Also:



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

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