Class: Docker::API::Config

Inherits:
Base
  • Object
show all
Defined in:
lib/docker/api/config.rb

Overview

This class represents the Docker API endpoints regarding configs.

Configs are application configurations that can be used by services. Swarm mode must be enabled for these endpoints to work.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Docker::API::Base

Instance Method Details

#create(body = {}) ⇒ Object

Create a config

Docker API: POST /configs/create

Parameters:

  • body (Hash) (defaults to: {})

    : Request body to be sent as json.

See Also:



26
27
28
# File 'lib/docker/api/config.rb', line 26

def create body = {}
    @connection.request(method: :post, path: "/configs/create", headers: {"Content-Type": "application/json"}, body: body.to_json)
end

#delete(name) ⇒ Object

Delete a config

Docker API: DELETE /configs/id

Parameters:

  • name (String)

    : The ID or name of the config.

See Also:



63
64
65
# File 'lib/docker/api/config.rb', line 63

def delete name
    @connection.delete("/configs/#{name}")
end

#details(name) ⇒ Object

Inspect a config

Docker API: GET /configs/id

Parameters:

  • name (String)

    : The ID or name of the config.

See Also:



37
38
39
# File 'lib/docker/api/config.rb', line 37

def details name
    @connection.get("/configs/#{name}")
end

#list(params = {}) ⇒ Object

List configs

Docker API: GET /configs

Parameters:

  • params (Hash) (defaults to: {})

    : Parameters that are appended to the URL.

See Also:



15
16
17
# File 'lib/docker/api/config.rb', line 15

def list params = {}
    @connection.get(build_path("/configs",params))
end

#update(name, params = {}, body = {}) ⇒ Object

Update a config

Docker API: POST /configs/id/update

Parameters:

  • name (String)

    : The ID or name of the config.

  • params (Hash) (defaults to: {})

    : Parameters that are appended to the URL.

  • body (Hash) (defaults to: {})

    : Request body to be sent as json.

See Also:



52
53
54
# File 'lib/docker/api/config.rb', line 52

def update name, params = {}, body = {}
    @connection.request(method: :post, path: build_path("/configs/#{name}/update",params), headers: {"Content-Type": "application/json"}, body: body.to_json)
end