Merge pull request #3301 from eLobato/do_server

[DigitalOcean] Helper methods for flavor,image,region,ips
This commit is contained in:
Wesley Beary 2014-12-01 08:27:31 -06:00
Родитель 418fd8fdc1 c974e8f88c
Коммит f539a05aeb
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -174,6 +174,29 @@ module Fog
msg = 'DigitalOcean servers do not support updates'
raise NotImplementedError.new(msg)
end
# Helper method to get the flavor name
def flavor
requires :flavor_id
@flavor ||= service.flavors.get(flavor_id.to_i)
end
# Helper method to get the image name
def image
requires :image_id
@image ||= service.images.get(image_id.to_i)
end
# Helper method to get the region name
def region
requires :region_id
@region ||= service.regions.get(region_id.to_i)
end
# Helper method to get an array with all available IP addresses
def ip_addresses
[public_ip_address, private_ip_address].flatten.select(&:present?)
end
end
end
end