Class: Docker::API::Node

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

Overview

This class represents the Docker API endpoints regarding nodes.

Nodes are instances of the Engine participating in a swarm. 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

#delete(name, params = {}) ⇒ Object

Delete a node.

Docker API: DELETE /nodes/id

Parameters:

  • name (String)

    : The ID or name of the node.

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

    : Parameters that are appended to the URL.

See Also:



39
40
41
# File 'lib/docker/api/node.rb', line 39

def delete name, params = {}
    @connection.delete(build_path("/nodes/#{name}", params))
end

#details(name) ⇒ Object

Inspect a node.

Docker API: GET /nodes/id

Parameters:

  • name (String)

    : The ID or name of the node.

See Also:



50
51
52
# File 'lib/docker/api/node.rb', line 50

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

#list(params = {}) ⇒ Object

List nodes.

Docker API: GET /nodes

Parameters:

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

    : Parameters that are appended to the URL.

See Also:



14
15
16
# File 'lib/docker/api/node.rb', line 14

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

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

Update a node.

Docker API: POST /nodes/id/update

Parameters:

  • name (String)

    : The ID or name of the node.

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

    : Parameters that are appended to the URL.

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

    : Request body to be sent as json.

See Also:



27
28
29
# File 'lib/docker/api/node.rb', line 27

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