Class: Docker::API::Swarm

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

Overview

This class represents the Docker API endpoints regarding swamrs.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#detailsObject

Inspect swarm.

Docker API: GET /swarm



34
35
36
# File 'lib/docker/api/swarm.rb', line 34

def details
    @connection.get("/swarm")
end

#init(body = {}) ⇒ Object

Initialize a new swarm.

Docker API: POST /swarm/init

Parameters:

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

    : Request body to be sent as json.

See Also:



13
14
15
# File 'lib/docker/api/swarm.rb', line 13

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

#join(body = {}) ⇒ Object

Join an existing swarm.

Docker API: POST /swarm/join

Parameters:

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

    : Request body to be sent as json.

See Also:



65
66
67
# File 'lib/docker/api/swarm.rb', line 65

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

#leave(params = {}) ⇒ Object

Leave a swarm.

Docker API: POST /swarm/leave

Parameters:

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

    : Parameters that are appended to the URL.

See Also:



76
77
78
# File 'lib/docker/api/swarm.rb', line 76

def leave params = {}
    @connection.post(build_path("/swarm/leave", params))
end

#unlock(body = {}) ⇒ Object

Unlock a locked manager.

Docker API: POST /swarm/unlock

Parameters:

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

    : Request body to be sent as json.

See Also:



54
55
56
# File 'lib/docker/api/swarm.rb', line 54

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

#unlock_keyObject

Get the unlock key.

Docker API: GET /swarm/unlockkey



43
44
45
# File 'lib/docker/api/swarm.rb', line 43

def unlock_key
    @connection.get("/swarm/unlockkey")
end

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

Update a swarm.

Docker API: POST /swarm/update

Parameters:

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

    : Parameters that are appended to the URL.

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

    : Request body to be sent as json.

See Also:



25
26
27
# File 'lib/docker/api/swarm.rb', line 25

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