Class: DockerCloud::AvailabilityZoneAPI

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

Constant Summary collapse

TYPE =
'AvailabilityZone'.freeze

Constants inherited from API

DockerCloud::API::API_VERSION, DockerCloud::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 availability zones from all regions of supported cloud providers Returns a list of Availability Zone objects



10
11
12
13
# File 'lib/docker_cloud/api/availability_zone_api.rb', line 10

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

#get(provider_name, region_name, az_name) ⇒ Object

Gets all the details of a specific region for a specific provider Returns a Region object



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

def get(provider_name, region_name, az_name)
  provider_az = "#{provider_name}/#{region_name}/#{az_name}"
  response = http_get(resource_url(provider_az))
  format_object(response, TYPE)
end

#resource_url(zone = '') ⇒ Object



4
5
6
# File 'lib/docker_cloud/api/availability_zone_api.rb', line 4

def resource_url(zone = '')
  "/az/#{zone}"
end