Class: DockerCloud::NodeTypeAPI

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

Constant Summary collapse

TYPE =
'NodeType'.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

Lists all node types of all supported cloud providers Returns a list of NodeType objects



11
12
13
14
# File 'lib/docker_cloud/api/node_type_api.rb', line 11

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

#get(provider_name, node_type_name) ⇒ Object

Returns the details of a specific NodeType



17
18
19
20
21
# File 'lib/docker_cloud/api/node_type_api.rb', line 17

def get(provider_name, node_type_name)
  name = "#{provider_name}/#{node_type_name}"
  response = http_get(resource_url(name))
  format_object(response, TYPE)
end

#resource_url(name = '') ⇒ Object



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

def resource_url(name = '')
  "/nodetype/#{name}"
end