Class: Fog::Terremark::Vcloud::Real
- Inherits:
-
Compute::Terremark::Real
- Object
- Compute::Terremark::Real
- Fog::Terremark::Vcloud::Real
- Defined in:
- lib/fog/terremark/vcloud/real.rb
Instance Method Summary collapse
- #default_network_id ⇒ Object
- #default_public_ip_id ⇒ Object
- #default_vdc_id ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/terremark/vcloud/real.rb', line 5 def initialize(={}) @terremark_password = [:terremark_vcloud_password] @terremark_username = [:terremark_vcloud_username] @connection_options = [:connection_options] || {} @host = [:host] || Fog::Terremark::Vcloud::HOST @path = [:path] || Fog::Terremark::Vcloud::PATH @persistent = [:persistent] || false @port = [:port] || Fog::Terremark::Vcloud::PORT @scheme = [:scheme] || Fog::Terremark::Vcloud::SCHEME @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end |
Instance Method Details
#default_network_id ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fog/terremark/vcloud/real.rb', line 34 def default_network_id if default_vdc_id @default_network_id ||= begin networks = get_vdc(default_vdc_id).body['AvailableNetworks'] if networks.length == 1 networks.first['href'].split('/').last.to_i else nil end end else nil end end |
#default_public_ip_id ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fog/terremark/vcloud/real.rb', line 49 def default_public_ip_id if default_vdc_id @default_public_ip_id ||= begin ips = get_public_ips(default_vdc_id).body['PublicIpAddresses'] if ips.length == 1 ips.first['href'].split('/').last.to_i else nil end end else nil end end |
#default_vdc_id ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/terremark/vcloud/real.rb', line 17 def default_vdc_id if default_organization_id @default_vdc_id ||= begin vdcs = get_organization(default_organization_id).body['Links'].select {|link| link['type'] == 'application/vnd.vmware.vcloud.vdc+xml' } if vdcs.length == 1 vdcs.first['href'].split('/').last.to_i else nil end end else nil end end |