Module: Fog::Vcloud::Terremark::Ecloud::Real

Defined in:
lib/fog/vcloud/terremark/ecloud/models/vdcs.rb,
lib/fog/vcloud/terremark/ecloud/models/networks.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb,
lib/fog/vcloud/terremark/ecloud/models/public_ips.rb,
lib/fog/vcloud/terremark/ecloud/requests/add_node.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_node.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_task.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb,
lib/fog/vcloud/terremark/ecloud/requests/power_on.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb,
lib/fog/vcloud/terremark/ecloud/requests/power_off.rb,
lib/fog/vcloud/terremark/ecloud/requests/clone_vapp.rb,
lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb,
lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_network.rb,
lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb,
lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb,
lib/fog/vcloud/terremark/ecloud/models/internet_services.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_firewall_acl.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_firewall_acls.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_vapp_template.rb,
lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb,
lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb,
lib/fog/vcloud/terremark/ecloud/requests/get_customization_options.rb,
lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb,
lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb

Instance Method Summary collapse

Instance Method Details

#add_internet_service(internet_services_uri, service_data) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb', line 42

def add_internet_service(internet_services_uri, service_data)
  validate_internet_service_data(service_data)

  request(
    :body     => generate_internet_service_request(service_data),
    :expects  => 200,
    :headers  => {'Content-Type' => 'application/vnd.tmrk.ecloud.internetService+xml'},
    :method   => 'POST',
    :uri      => internet_services_uri,
    :parse    => true
  )
end

#add_node(nodes_uri, node_data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/vcloud/terremark/ecloud/requests/add_node.rb', line 7

def add_node(nodes_uri, node_data)
  validate_node_data(node_data)

  request(
    :body     => generate_node_request(node_data),
    :expects  => 200,
    :headers  => {'Content-Type' => 'application/vnd.tmrk.ecloud.nodeService+xml'},
    :method   => 'POST',
    :uri      => nodes_uri,
    :parse    => true
  )
end

#clone_vapp(vdc_uri, vapp_uri, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/vcloud/terremark/ecloud/requests/clone_vapp.rb', line 23

def clone_vapp(vdc_uri, vapp_uri, options = {})
  unless options.has_key?(:poweron)
    options[:poweron] = "false"
  end

  validate_clone_vapp_options(options)

  request(
    :body     => generate_clone_vapp_request(vapp_uri, options),
    :expects  => 202,
    :headers  => {'Content-Type' => 'application/vnd.vmware.vcloud.cloneVAppParams+xml'},
    :method   => 'POST',
    :uri      => vdc_uri + '/action/clonevapp',
    :parse    => true
  )
end

#configure_internet_service(internet_service_uri, service_data, ip_address_data) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb', line 35

def configure_internet_service(internet_service_uri, service_data, ip_address_data)
  validate_internet_service_data(service_data, true)

  validate_public_ip_address_data(ip_address_data)

  request(
    :body     => generate_internet_service_response(service_data, ip_address_data),
    :expects  => 200,
    :headers  => {'Content-Type' => 'application/vnd.tmrk.ecloud.internetService+xml'},
    :method   => 'PUT',
    :uri      => internet_service_uri,
    :parse    => true
  )
end

#configure_network(network_uri, network_data) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb', line 14

def configure_network(network_uri, network_data)
  validate_network_data(network_data)

  request(
    :body     => generate_configure_network_request(network_data),
    :expects  => 200,
    :headers  => {'Content-Type' => 'application/vnd.tmrk.ecloud.networkService+xml'},
    :method   => 'PUT',
    :uri      => network_uri,
    :parse    => true
  )
end

#configure_network_ip(network_ip_uri, network_ip_data) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb', line 14

def configure_network_ip(network_ip_uri, network_ip_data)
  validate_network_ip_data(network_ip_data)

  request(
    :body     => generate_configure_network_ip_request(network_ip_data),
    :expects  => 200,
    :headers  => {'Content-Type' => 'application/vnd.tmrk.ecloud.ip+xml' },
    :method   => 'PUT',
    :uri      => network_ip_uri,
    :parse    => true
  )
end

#configure_node(node_uri, node_data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb', line 7

def configure_node(node_uri, node_data)
  validate_node_data(node_data, true)

  request(
    :body     => generate_configure_node_request(node_data),
    :expects  => 200,
    :headers  => {'Content-Type' => 'application/vnd.tmrk.ecloud.nodeService+xml'},
    :method   => 'PUT',
    :uri      => node_uri,
    :parse    => true
  )
end

#configure_vapp(vapp_uri, vapp_data) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb', line 92

def configure_vapp(vapp_uri, vapp_data)
  validate_vapp_data(vapp_data)

  request(
    :body     => generate_configure_vapp_request(vapp_uri, vapp_data),
    :expects  => 202,
    :headers  => {'Content-Type' => 'application/vnd.vmware.vcloud.vApp+xml' },
    :method   => 'PUT',
    :uri      => vapp_uri,
    :parse    => true
  )
end

#generate_clone_vapp_request(uri, options) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/fog/vcloud/terremark/ecloud/requests/clone_vapp.rb', line 15

def generate_clone_vapp_request(uri, options)
  xml = Builder::XmlMarkup.new
  xml.CloneVAppParams(xmlns.merge!(:name => options[:name], :deploy => "true", :powerOn => options[:poweron])) {
    xml.VApp( :href => uri, :type => "application/vnd.vmware.vcloud.vApp+xml",
              :xmlns => "http://www.vmware.com/vcloud/v0.8")
  }
end

#generate_configure_vapp_request(vapp_uri, vapp_data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb', line 7

def generate_configure_vapp_request(vapp_uri, vapp_data)
  rasd_xmlns = { "xmlns" => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" }

  xml = Nokogiri::XML(request( :uri => vapp_uri).body)
  xml.root['name'] = vapp_data[:name]

  #cpu
  xml.at("//xmlns:ResourceType[.='3']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:cpus]

  #memory
  xml.at("//xmlns:ResourceType[.='4']/..", rasd_xmlns).at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:memory]

  #disks
  real_disks = xml.xpath("//xmlns:ResourceType[ .='17']/..", rasd_xmlns)
  real_disk_numbers = real_disks.map { |disk| disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content }
  disk_numbers = vapp_data[:disks].map { |vdisk| vdisk[:number].to_s }

  if vapp_data[:disks].length < real_disks.length
    #Assume we're removing a disk
    remove_disk_numbers = real_disk_numbers - disk_numbers
    remove_disk_numbers.each do |number|
      if result = xml.at("//xmlns:ResourceType[ .='17']/../xmlns:AddressOnParent[.='#{number}']/..", rasd_xmlns)
        result.remove
      end
    end
  elsif vapp_data[:disks].length > real_disks.length
    add_disk_numbers = disk_numbers - real_disk_numbers

    add_disk_numbers.each do |number|
      new_disk = real_disks.first.dup
      new_disk.at('.//xmlns:AddressOnParent', rasd_xmlns).content = -1
      new_disk.at('.//xmlns:VirtualQuantity', rasd_xmlns).content = vapp_data[:disks].detect { |disk| disk[:number].to_s == number.to_s }[:size]
      real_disks.first.parent << new_disk
    end
  end

  #puts xml.root.to_s
  xml.root.to_s
  
  #builder = Builder::XmlMarkup.new
  #builder.Vapp(:href => vapp_uri.to_s,
  #             :type => 'application/vnd.vmware.vcloud.vApp+xml',
  #             :name => vapp_data[:name],
  #             :status => 2,
  #             :size => 0,
  #             :xmlns => 'http://www.vmware.com/vcloud/v0.8',
  #             :"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance',
  #             :"xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema') {
  #  #builder.VirtualHardwareSection(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
  #  builder.Section(:"xsi:type" => "q2:VirtualHardwareSection_Type", :xmlns => "http://schemas.dmtf.org/ovf/envelope/1", :"xmlns:q2" => "http://www.vmware.com/vcloud/v0.8") {
  #    builder.Info('Virtual Hardware')
  #    builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
  #    #builder.Item {
  #      builder.InstanceID(1, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #      builder.ResourceType(3, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #      builder.VirtualQuantity(vapp_data[:cpus], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #    }
  #    builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
  #    #builder.Item {
  #      builder.InstanceID(2, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #      builder.ResourceType(4, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #      builder.VirtualQuantity(vapp_data[:memory], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #    }
  #    vapp_data[:disks].each do |disk_data|
  #      #builder.Item(:xmlns => 'http://schemas.dmtf.org/ovf/envelope/1') {
  #      builder.Item {
  #        builder.AddressOnParent(disk_data[:number], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #        builder.HostResource(disk_data[:resource], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #        builder.InstanceID(9, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #        builder.ResourceType(17, :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #        builder.VirtualQuantity(disk_data[:size], :xmlns => 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData')
  #      }
  #    end
  #
  #  }
  #}
end

#generate_instantiate_vapp_template_request(options) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb', line 43

def generate_instantiate_vapp_template_request(options)
  xml = Builder::XmlMarkup.new
  xml.InstantiateVAppTemplateParams(xmlns.merge!(:name => options[:name], :"xml:lang" => "en")) {
    xml.VAppTemplate(:href => options[:template_uri])
    xml.InstantiationParams {
      xml.ProductSection( :"xmlns:q1" => "http://www.vmware.com/vcloud/v0.8", :"xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1") {
        if options[:password]
          xml.Property( :xmlns => "http://schemas.dmtf.org/ovf/envelope/1", :"ovf:key" => "password", :"ovf:value" => options[:password] )
        end
        xml.Property( :xmlns => "http://schemas.dmtf.org/ovf/envelope/1", :"ovf:key" => "row", :"ovf:value" => options[:row] )
        xml.Property( :xmlns => "http://schemas.dmtf.org/ovf/envelope/1", :"ovf:key" => "group", :"ovf:value" => options[:group] )
      }
      xml.VirtualHardwareSection( :"xmlns:q1" => "http://www.vmware.com/vcloud/v0.8" ) {
        # # of CPUS
        xml.Item( :xmlns => "http://schemas.dmtf.org/ovf/envelope/1" ) {
          xml.InstanceID(1, :xmlns => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
          xml.ResourceType(3, :xmlns => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
          xml.VirtualQuantity(options[:cpus], :xmlns => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
        }
        # Memory
        xml.Item( :xmlns => "http://schemas.dmtf.org/ovf/envelope/1" ) {
          xml.InstanceID(2, :xmlns => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
          xml.ResourceType(4, :xmlns => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
          xml.VirtualQuantity(options[:memory], :xmlns => "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData")
        }
      }
      xml.NetworkConfigSection {
        xml.NetworkConfig {
          xml.NetworkAssociation( :href => options[:network_uri] )
        }
      }
    }
  }
end

#generate_internet_service_request(service_data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb', line 7

def generate_internet_service_request(service_data)
  builder = Builder::XmlMarkup.new
  builder.CreateInternetServiceRequest(:"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
                                       :"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
                                       :xmlns => "urn:tmrk:eCloudExtensions-2.3") {
    builder.Name(service_data[:name])
    builder.Protocol(service_data[:protocol])
    builder.Port(service_data[:port])
    builder.Enabled(service_data[:enabled])
    builder.Description(service_data[:description])
    builder.RedirectURL(service_data[:redirect_url])
    #builder.Monitor {
    #  builder.MonitorType {}
    #  builder.UrlSendString {}
    #  builder.HttpHeader {}
    #  builder.ReceiveString {}
    #  builder.Interval {}
    #  builder.ResponseTimeOut {}
    #  builder.DownTime {}
    #  builder.Retries {}
    #  builder.IsEnabled {}
    #}
  }
end

#generate_internet_service_response(service_data, ip_address_data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb', line 7

def generate_internet_service_response(service_data,ip_address_data)
  builder = Builder::XmlMarkup.new
  builder.InternetService(:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance",
                          :xmlns => "urn:tmrk:eCloudExtensions-2.3") {
    builder.Id(service_data[:id])
    builder.Href(service_data[:href].to_s)
    builder.Name(service_data[:name])
    builder.Protocol(service_data[:protocol])
    builder.Port(service_data[:port])
    builder.Enabled(service_data[:enabled])
    builder.Description(service_data[:description])
    builder.Timeout(service_data[:timeout])
    builder.RedirectURL(service_data[:redirect_url])
    builder.PublicIpAddress {
      builder.Id(ip_address_data[:id])
      builder.Href(ip_address_data[:href].to_s)
      builder.Name(ip_address_data[:name])
    }
  }
end

#instantiate_vapp_template(catalog_item_uri, options = {}) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb', line 78

def instantiate_vapp_template(catalog_item_uri, options = {})
  validate_instantiate_vapp_template_options(catalog_item_uri, options)

  request(
    :body     => generate_instantiate_vapp_template_request(options),
    :expects  => 200,
    :headers  => {'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml'},
    :method   => 'POST',
    :uri      => options[:vdc_uri] + '/action/instantiatevAppTemplate',
    :parse    => true
  )
end

#internet_services(options = {}) ⇒ Object



7
8
9
# File 'lib/fog/vcloud/terremark/ecloud/models/internet_services.rb', line 7

def internet_services(options = {})
  @internet_services ||= Fog::Vcloud::Terremark::Ecloud::InternetServices.new(options.merge(:connection => self))
end

#networks(options = {}) ⇒ Object



7
8
9
# File 'lib/fog/vcloud/terremark/ecloud/models/networks.rb', line 7

def networks(options = {})
  @networks ||= Fog::Vcloud::Terremark::Ecloud::Networks.new(options.merge(:connection => self))
end

#public_ips(options = {}) ⇒ Object



13
14
15
# File 'lib/fog/vcloud/terremark/ecloud/models/public_ips.rb', line 13

def public_ips(options = {})
  @public_ips ||= Fog::Vcloud::Terremark::Ecloud::PublicIps.new(options.merge(:connection => self))
end

#validate_clone_vapp_options(options) ⇒ Object



8
9
10
11
12
13
# File 'lib/fog/vcloud/terremark/ecloud/requests/clone_vapp.rb', line 8

def validate_clone_vapp_options(options)
  valid_opts = [:name, :poweron]
  unless valid_opts.all? { |opt| options.keys.include?(opt) }
    raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}")
  end
end

#validate_instantiate_vapp_template_options(catalog_item_uri, options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb', line 8

def validate_instantiate_vapp_template_options(catalog_item_uri, options)
  valid_opts = [:name, :vdc_uri, :network_uri, :cpus, :memory, :row, :group]
  unless valid_opts.all? { |opt| options.keys.include?(opt) }
    raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}")
  end

  # Figure out the template_uri
  catalog_item = get_catalog_item( catalog_item_uri ).body
  catalog_item[:Entity] = [ catalog_item[:Entity] ] if catalog_item[:Entity].is_a?(Hash)
  catalog_item[:Link] = [ catalog_item[:Link] ] if catalog_item[:Link].is_a?(Hash)

  options[:template_uri] = begin
     catalog_item[:Entity].detect { |entity| entity[:type] == "application/vnd.vmware.vcloud.vAppTemplate+xml" }[:href]
  rescue
    raise RuntimeError.new("Unable to locate template uri for #{catalog_item_uri}")
  end

  customization_options = begin
      customization_href = catalog_item[:Link].detect { |link| link[:type] == "application/vnd.tmrk.ecloud.catalogItemCustomizationParameters+xml" }[:href]
      get_customization_options( customization_href ).body
  rescue
    raise RuntimeError.new("Unable to get customization options for #{catalog_item_uri}")
  end

  # Check to see if we can set the password
  if options[:password] and customization_options[:CustomizePassword] == "false"
    raise ArgumentError.new("This catalog item (#{catalog_item_uri}) does not allow setting a password.")
  end

  # According to the docs if CustomizePassword is "true" then we NEED to set a password
  if customization_options[:CustomizePassword] == "true" and ( options[:password].nil? or options[:password].empty? )
    raise ArgumentError.new("This catalog item (#{catalog_item_uri}) requires a :password to instantiate.")
  end
end

#validate_internet_service_data(service_data, configure = false) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb', line 32

def validate_internet_service_data(service_data, configure=false)
  valid_opts = [:name, :protocol, :port, :description, :enabled, :redirect_url]
  if configure
    valid_opts + [ :id, :href, :timeout ]
  end
  unless valid_opts.all? { |opt| service_data.keys.include?(opt) }
    raise ArgumentError.new("Required Internet Service data missing: #{(valid_opts - service_data.keys).map(&:inspect).join(", ")}")
  end
end

#validate_network_data(network_data, configure = false) ⇒ Object



7
8
9
10
11
12
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb', line 7

def validate_network_data(network_data, configure=false)
  valid_opts = [:id, :href, :name, :rnat, :address, :broadcast, :gateway]
  unless valid_opts.all? { |opt| network_data.keys.include?(opt) }
    raise ArgumentError.new("Required data missing: #{(valid_opts - network_data.keys).map(&:inspect).join(", ")}")
  end
end

#validate_network_ip_data(network_ip_data, configure = false) ⇒ Object



7
8
9
10
11
12
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_network_ip.rb', line 7

def validate_network_ip_data(network_ip_data, configure=false)
  valid_opts = [:id, :href, :name, :status, :server, :rnat]
  unless valid_opts.all? { |opt| network_ip_data.keys.include?(opt) }
    raise ArgumentError.new("Required data missing: #{(valid_opts - network_ip_data.keys).map(&:inspect).join(", ")}")
  end
end

#validate_public_ip_address_data(ip_address_data) ⇒ Object



28
29
30
31
32
33
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb', line 28

def validate_public_ip_address_data(ip_address_data)
  valid_opts = [:name, :href, :id]
  unless valid_opts.all? { |opt| ip_address_data.keys.include?(opt) }
    raise ArgumentError.new("Required Internet Service data missing: #{(valid_opts - ip_address_data.keys).map(&:inspect).join(", ")}")
  end
end

#validate_vapp_data(vapp_data) ⇒ Object



85
86
87
88
89
90
# File 'lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb', line 85

def validate_vapp_data(vapp_data)
  valid_opts = [:name, :cpus, :memory, :disks]
  unless valid_opts.all? { |opt| vapp_data.keys.include?(opt) }
    raise ArgumentError.new("Required Vapp data missing: #{(valid_opts - vapp_data.keys).map(&:inspect).join(", ")}")
  end
end

#vdcs(options = {}) ⇒ Object



7
8
9
# File 'lib/fog/vcloud/terremark/ecloud/models/vdcs.rb', line 7

def vdcs(options = {})
  @vdcs ||= Fog::Vcloud::Terremark::Ecloud::Vdcs.new(options.merge(:connection => self))
end