Class: DockerEngineAPI::Resources::Plugins

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_engine_api/resources/plugins.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Plugins

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

Parameters:



312
313
314
# File 'lib/docker_engine_api/resources/plugins.rb', line 312

def initialize(client:)
  @client = client
end

Instance Method Details

#create(name:, body:, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::PluginCreateParams for more details.

Create a plugin

Parameters:

Returns:

  • (nil)

See Also:



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/docker_engine_api/resources/plugins.rb', line 22

def create(params)
  parsed, options = DockerEngineAPI::PluginCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "plugins/create",
    query: parsed.except(:body),
    headers: {"content-type" => "application/x-tar"},
    body: parsed[:body],
    model: NilClass,
    options: options
  )
end

#delete(name, force: nil, request_options: {}) ⇒ DockerEngineAPI::Models::Plugin

Some parameter documentations has been truncated, see Models::PluginDeleteParams for more details.

Remove a plugin

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is optional, and is the

  • force (Boolean)

    Disable the plugin before removing. This may result in issues if the

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



76
77
78
79
80
81
82
83
84
85
# File 'lib/docker_engine_api/resources/plugins.rb', line 76

def delete(name, params = {})
  parsed, options = DockerEngineAPI::PluginDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["plugins/%1$s", name],
    query: parsed,
    model: DockerEngineAPI::Plugin,
    options: options
  )
end

#disable(name, force: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::PluginDisableParams for more details.

Disable a plugin

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is optional, and is the

  • force (Boolean)

    Force disable a plugin even if still in use.

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



103
104
105
106
107
108
109
110
111
112
# File 'lib/docker_engine_api/resources/plugins.rb', line 103

def disable(name, params = {})
  parsed, options = DockerEngineAPI::PluginDisableParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["plugins/%1$s/disable", name],
    query: parsed,
    model: NilClass,
    options: options
  )
end

#enable(name, timeout: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::PluginEnableParams for more details.

Enable a plugin

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is optional, and is the

  • timeout (Integer)

    Set the HTTP client timeout (in seconds)

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



130
131
132
133
134
135
136
137
138
139
# File 'lib/docker_engine_api/resources/plugins.rb', line 130

def enable(name, params = {})
  parsed, options = DockerEngineAPI::PluginEnableParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["plugins/%1$s/enable", name],
    query: parsed,
    model: NilClass,
    options: options
  )
end

#inspect_(name, request_options: {}) ⇒ DockerEngineAPI::Models::Plugin

Some parameter documentations has been truncated, see Models::PluginInspectParams for more details.

Inspect a plugin

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is optional, and is the

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



155
156
157
158
159
160
161
162
# File 'lib/docker_engine_api/resources/plugins.rb', line 155

def inspect_(name, params = {})
  @client.request(
    method: :get,
    path: ["plugins/%1$s/json", name],
    model: DockerEngineAPI::Plugin,
    options: params[:request_options]
  )
end

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

Some parameter documentations has been truncated, see Models::PluginListParams for more details.

Returns information about installed plugins.

Parameters:

  • filters (String)

    A JSON encoded value of the filters (a map[string][]string) to

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
# File 'lib/docker_engine_api/resources/plugins.rb', line 49

def list(params = {})
  parsed, options = DockerEngineAPI::PluginListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "plugins",
    query: parsed,
    model: DockerEngineAPI::Internal::Type::ArrayOf[DockerEngineAPI::Plugin],
    options: options
  )
end

#privileges(remote:, request_options: {}) ⇒ Array<DockerEngineAPI::Models::Privilege>

Some parameter documentations has been truncated, see Models::PluginPrivilegesParams for more details.

Get plugin privileges

Parameters:

  • remote (String)

    The name of the plugin. The :latest tag is optional, and is the

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



178
179
180
181
182
183
184
185
186
187
# File 'lib/docker_engine_api/resources/plugins.rb', line 178

def privileges(params)
  parsed, options = DockerEngineAPI::PluginPrivilegesParams.dump_request(params)
  @client.request(
    method: :get,
    path: "plugins/privileges",
    query: parsed,
    model: DockerEngineAPI::Internal::Type::ArrayOf[DockerEngineAPI::Privilege],
    options: options
  )
end

#pull(remote:, name: nil, body: nil, x_registry_auth: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::PluginPullParams for more details.

Pulls and installs a plugin. After the plugin is installed, it can be enabled using the [‘POST /plugins/name/enable` endpoint](#operation/PostPluginsEnable).

Parameters:

  • remote (String)

    Query param: Remote reference for plugin to install.

  • name (String)

    Query param: Local name for the pulled plugin.

  • body (Array<DockerEngineAPI::Models::Privilege>)

    Body param

  • x_registry_auth (String)

    Header param: A base64url-encoded auth configuration to use when pulling a plugi

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/docker_engine_api/resources/plugins.rb', line 211

def pull(params)
  parsed, options = DockerEngineAPI::PluginPullParams.dump_request(params)
  query_params = [:remote, :name]
  @client.request(
    method: :post,
    path: "plugins/pull",
    query: parsed.slice(*query_params),
    headers: parsed.except(:body, *query_params).transform_keys(x_registry_auth: "x-registry-auth"),
    body: parsed[:body],
    model: NilClass,
    options: options
  )
end

#push(name, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::PluginPushParams for more details.

Push a plugin to the registry.

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is optional, and is the

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



239
240
241
242
243
244
245
246
# File 'lib/docker_engine_api/resources/plugins.rb', line 239

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

#set(name, body: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::PluginSetParams for more details.

Configure a plugin

Parameters:

  • name (String)

    The name of the plugin. The :latest tag is optional, and is the

  • body (Array<String>)
  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



264
265
266
267
268
269
270
271
272
273
# File 'lib/docker_engine_api/resources/plugins.rb', line 264

def set(name, params = {})
  parsed, options = DockerEngineAPI::PluginSetParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["plugins/%1$s/set", name],
    body: parsed[:body],
    model: NilClass,
    options: options
  )
end

#upgrade(name, remote:, body: nil, x_registry_auth: nil, request_options: {}) ⇒ nil

Some parameter documentations has been truncated, see Models::PluginUpgradeParams for more details.

Upgrade a plugin

Parameters:

  • name (String)

    Path param: The name of the plugin. The :latest tag is optional, and is the

  • remote (String)

    Query param: Remote reference to upgrade to.

  • body (Array<DockerEngineAPI::Models::Privilege>)

    Body param

  • x_registry_auth (String)

    Header param: A base64url-encoded auth configuration to use when pulling a plugi

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/docker_engine_api/resources/plugins.rb', line 295

def upgrade(name, params)
  parsed, options = DockerEngineAPI::PluginUpgradeParams.dump_request(params)
  query_params = [:remote]
  @client.request(
    method: :post,
    path: ["plugins/%1$s/upgrade", name],
    query: parsed.slice(*query_params),
    headers: parsed.except(:body, *query_params).transform_keys(x_registry_auth: "x-registry-auth"),
    body: parsed[:body],
    model: NilClass,
    options: options
  )
end