Module: CloudstackClient::Zone
- Defined in:
- lib/cloudstack_client/commands/zone.rb
Instance Method Summary collapse
-
#get_default_zone ⇒ Object
Finds the default zone for your account.
-
#get_zone(name) ⇒ Object
Finds the zone with the specified name.
-
#list_zones ⇒ Object
Lists all available zones.
Instance Method Details
#get_default_zone ⇒ Object
Finds the default zone for your account.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cloudstack_client/commands/zone.rb', line 30 def get_default_zone params = { 'command' => 'listZones', 'available' => 'true' } json = send_request(params) zones = json['zone'] return nil unless zones zones.first end |
#get_zone(name) ⇒ Object
Finds the zone with the specified name.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cloudstack_client/commands/zone.rb', line 8 def get_zone(name) params = { 'command' => 'listZones', 'available' => 'true' } json = send_request(params) networks = json['zone'] return nil unless networks networks.each { |z| if z['name'] == name then return z end } nil end |
#list_zones ⇒ Object
Lists all available zones.
46 47 48 49 50 51 52 53 |
# File 'lib/cloudstack_client/commands/zone.rb', line 46 def list_zones params = { 'command' => 'listZones', 'available' => 'true' } json = send_request(params) json['zone'] || [] end |