Skip to content

Latest commit

 

History

History
323 lines (220 loc) · 7.23 KB

SwarmApi.md

File metadata and controls

323 lines (220 loc) · 7.23 KB

DockerEngineApi.SwarmApi

All URIs are relative to http://localhost/v1.41

Method HTTP request Description
swarmInit POST /swarm/init Initialize a new swarm
swarmInspect GET /swarm Inspect swarm
swarmJoin POST /swarm/join Join an existing swarm
swarmLeave POST /swarm/leave Leave a swarm
swarmUnlock POST /swarm/unlock Unlock a locked manager
swarmUnlockkey GET /swarm/unlockkey Get the unlock key
swarmUpdate POST /swarm/update Update a swarm

swarmInit

'String' swarmInit(body)

Initialize a new swarm

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.SwarmApi();

var body = new DockerEngineApi.Body1(); // Body1 | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.swarmInit(body, callback);

Parameters

Name Type Description Notes
body Body1

Return type

'String'

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json, text/plain

swarmInspect

Swarm swarmInspect()

Inspect swarm

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.SwarmApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.swarmInspect(callback);

Parameters

This endpoint does not need any parameter.

Return type

Swarm

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json, text/plain

swarmJoin

swarmJoin(body)

Join an existing swarm

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.SwarmApi();

var body = new DockerEngineApi.Body2(); // Body2 | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.swarmJoin(body, callback);

Parameters

Name Type Description Notes
body Body2

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json, text/plain

swarmLeave

swarmLeave(opts)

Leave a swarm

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.SwarmApi();

var opts = { 
  'force': false // Boolean | Force leave swarm, even if this is the last manager or that it will break the cluster. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.swarmLeave(opts, callback);

Parameters

Name Type Description Notes
force Boolean Force leave swarm, even if this is the last manager or that it will break the cluster. [optional] [default to false]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json, text/plain

swarmUnlock

swarmUnlock(body)

Unlock a locked manager

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.SwarmApi();

var body = new DockerEngineApi.Body3(); // Body3 | 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.swarmUnlock(body, callback);

Parameters

Name Type Description Notes
body Body3

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

swarmUnlockkey

UnlockKeyResponse swarmUnlockkey()

Get the unlock key

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.SwarmApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.swarmUnlockkey(callback);

Parameters

This endpoint does not need any parameter.

Return type

UnlockKeyResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, text/plain

swarmUpdate

swarmUpdate(body, version, opts)

Update a swarm

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.SwarmApi();

var body = new DockerEngineApi.SwarmSpec(); // SwarmSpec | 

var version = 789; // Number | The version number of the swarm object being updated. This is required to avoid conflicting writes. 

var opts = { 
  'rotateWorkerToken': false, // Boolean | Rotate the worker join token.
  'rotateManagerToken': false, // Boolean | Rotate the manager join token.
  'rotateManagerUnlockKey': false // Boolean | Rotate the manager unlock key.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.swarmUpdate(body, version, opts, callback);

Parameters

Name Type Description Notes
body SwarmSpec
version Number The version number of the swarm object being updated. This is required to avoid conflicting writes.
rotateWorkerToken Boolean Rotate the worker join token. [optional] [default to false]
rotateManagerToken Boolean Rotate the manager join token. [optional] [default to false]
rotateManagerUnlockKey Boolean Rotate the manager unlock key. [optional] [default to false]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json, text/plain