Class: DockerCloud::NodeClusterAPI

Inherits:
API
  • Object
show all
Defined in:
lib/docker_cloud/api/node_cluster_api.rb

Constant Summary collapse

TYPE =
'NodeCluster'.freeze

Constants inherited from API

API::API_VERSION, API::BASE_API_PATH

Instance Attribute Summary

Attributes inherited from API

#client, #headers, #type

Instance Method Summary collapse

Methods inherited from API

#get_from_uri, #http_delete, #http_get, #http_patch, #http_post, #initialize, #parse, #url

Constructor Details

This class inherits a constructor from DockerCloud::API

Instance Method Details

#all(params = {}) ⇒ Object



9
10
11
12
# File 'lib/docker_cloud/api/node_cluster_api.rb', line 9

def all(params = {})
  response = http_get(resource_url, params)
  format_object(response, TYPE)
end

#create(params) ⇒ Object

Create Params: name (required): name for node cluster node_type (required): type of node to be used for the cluster region (reguired): resource URI of the region where node cluster is to be deployed disk (optional): Size of the volume to create nickname (optional) target_num_nodes (optional): Number of nodes for the cluster. default: 1 tags (optional): default [] provider_options



23
24
25
26
# File 'lib/docker_cloud/api/node_cluster_api.rb', line 23

def create(params)
  response = http_post(resource_url, params)
  format_object(response, TYPE)
end

#deploy(uuid) ⇒ Object



38
39
40
# File 'lib/docker_cloud/api/node_cluster_api.rb', line 38

def deploy(uuid)
  http_post(resource_url("#{uuid}/deploy"))
end

#get(uuid) ⇒ Object



28
29
30
31
# File 'lib/docker_cloud/api/node_cluster_api.rb', line 28

def get(uuid)
  response = http_get(resource_url(uuid))
  format_object(response, TYPE)
end

#resource_url(params = '') ⇒ Object



5
6
7
# File 'lib/docker_cloud/api/node_cluster_api.rb', line 5

def resource_url(params = '')
  "/nodecluster/#{params}"
end

#terminate(uuid) ⇒ Object



42
43
44
# File 'lib/docker_cloud/api/node_cluster_api.rb', line 42

def terminate(uuid)
  http_delete(resource_url(uuid))
end

#update(uuid, params) ⇒ Object



33
34
35
36
# File 'lib/docker_cloud/api/node_cluster_api.rb', line 33

def update(uuid, params)
  response = http_patch(resource_url(uuid), params)
  format_object(response, TYPE)
end