ruby_vcloud_sdk 0.4.8 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +296 -0
  3. data/lib/ruby_vcloud_sdk.rb +0 -4
  4. data/lib/ruby_vcloud_sdk/catalog.rb +377 -0
  5. data/lib/ruby_vcloud_sdk/catalog_item.rb +26 -0
  6. data/lib/ruby_vcloud_sdk/client.rb +25 -882
  7. data/lib/ruby_vcloud_sdk/config.rb +1 -7
  8. data/lib/ruby_vcloud_sdk/connection/connection.rb +114 -54
  9. data/lib/ruby_vcloud_sdk/cpu.rb +11 -0
  10. data/lib/ruby_vcloud_sdk/disk.rb +55 -0
  11. data/lib/ruby_vcloud_sdk/edge_gateway.rb +32 -0
  12. data/lib/ruby_vcloud_sdk/infrastructure.rb +135 -0
  13. data/lib/ruby_vcloud_sdk/ip_ranges.rb +95 -0
  14. data/lib/ruby_vcloud_sdk/memory.rb +11 -0
  15. data/lib/ruby_vcloud_sdk/network.rb +32 -0
  16. data/lib/ruby_vcloud_sdk/powerable.rb +78 -0
  17. data/lib/ruby_vcloud_sdk/resources.rb +13 -0
  18. data/lib/ruby_vcloud_sdk/session.rb +46 -0
  19. data/lib/ruby_vcloud_sdk/vapp.rb +122 -0
  20. data/lib/ruby_vcloud_sdk/vdc.rb +210 -0
  21. data/lib/ruby_vcloud_sdk/vdc_storage_profile.rb +23 -0
  22. data/lib/ruby_vcloud_sdk/version.rb +1 -1
  23. data/lib/ruby_vcloud_sdk/vm.rb +132 -0
  24. data/lib/ruby_vcloud_sdk/xml/constants.rb +6 -4
  25. data/lib/ruby_vcloud_sdk/xml/wrapper.rb +109 -30
  26. data/lib/ruby_vcloud_sdk/xml/wrapper_classes.rb +45 -2
  27. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/admin_catalog.rb +13 -4
  28. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/allocated_ip_addresses.rb +9 -0
  29. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/catalog_item.rb +6 -14
  30. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk.rb +24 -14
  31. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk_attach_or_detach_params.rb +0 -2
  32. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk_create_params.rb +1 -3
  33. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/edge_gateway.rb +13 -0
  34. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/gateway_interface.rb +22 -0
  35. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/hard_disk_item_wrapper.rb +4 -4
  36. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_address.rb +10 -0
  37. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_range.rb +13 -0
  38. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_ranges.rb +9 -0
  39. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_scope.rb +6 -32
  40. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/item.rb +1 -7
  41. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/link.rb +14 -0
  42. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/media.rb +4 -20
  43. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/media_insert_or_eject_params.rb +1 -3
  44. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network_connection_section.rb +0 -4
  45. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/nic_item_wrapper.rb +0 -2
  46. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/org.rb +44 -0
  47. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/org_vdc_network.rb +11 -3
  48. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/query_result_records.rb +14 -0
  49. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/recompose_vapp_params.rb +42 -0
  50. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/session.rb +5 -5
  51. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/supported_versions.rb +19 -0
  52. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/task.rb +1 -1
  53. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/upload_vapp_template_params.rb +2 -4
  54. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vapp.rb +13 -22
  55. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vapp_template.rb +0 -2
  56. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vcloud.rb +5 -3
  57. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb +72 -15
  58. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb +8 -6
  59. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vm.rb +29 -25
  60. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vms.rb +12 -0
  61. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminCatalog.xml +6 -1
  62. data/lib/ruby_vcloud_sdk/xml/xml_templates/RecomposeVAppParams.xml +16 -1
  63. metadata +116 -233
  64. data/README +0 -1
  65. data/Rakefile +0 -50
  66. data/lib/ruby_vcloud_sdk/util.rb +0 -21
  67. data/spec/assets/admin_org_response.xml +0 -75
  68. data/spec/assets/catalog_add_item_response.xml +0 -8
  69. data/spec/assets/catalog_add_vapp_request.xml +0 -5
  70. data/spec/assets/catalog_item_added_response.xml +0 -19
  71. data/spec/assets/catalog_response.xml +0 -19
  72. data/spec/assets/existing_media_busy_response.xml +0 -19
  73. data/spec/assets/existing_media_catalog_item.xml +0 -8
  74. data/spec/assets/existing_media_delete_task_done.xml +0 -6
  75. data/spec/assets/existing_media_done_response.xml +0 -11
  76. data/spec/assets/existing_vapp_resolver_response.xml +0 -3
  77. data/spec/assets/existing_vapp_template_catalog_resolver_response.xml +0 -3
  78. data/spec/assets/existing_vapp_template_instantiate_response.xml +0 -20
  79. data/spec/assets/existing_vapp_template_instantiate_task_error_response.xml +0 -7
  80. data/spec/assets/existing_vapp_template_instantiate_task_start_response.xml +0 -7
  81. data/spec/assets/existing_vapp_template_instantiate_task_success_response.xml +0 -7
  82. data/spec/assets/existing_vapp_template_item_response.xml +0 -8
  83. data/spec/assets/existing_vapp_template_ready_response.xml +0 -79
  84. data/spec/assets/finalize_upload_task_done_response.xml +0 -7
  85. data/spec/assets/finalize_upload_task_response.xml +0 -7
  86. data/spec/assets/indy_disk_attach_request.xml +0 -3
  87. data/spec/assets/indy_disk_attach_task.xml +0 -6
  88. data/spec/assets/indy_disk_attach_task_error.xml +0 -6
  89. data/spec/assets/indy_disk_create_error.xml +0 -1
  90. data/spec/assets/indy_disk_create_request.xml +0 -4
  91. data/spec/assets/indy_disk_create_response.xml +0 -19
  92. data/spec/assets/indy_disk_delete_task.xml +0 -6
  93. data/spec/assets/indy_disk_detach_request.xml +0 -3
  94. data/spec/assets/indy_disk_detach_task.xml +0 -6
  95. data/spec/assets/indy_disk_response.xml +0 -11
  96. data/spec/assets/instantiated_suspended_vapp_response.xml +0 -209
  97. data/spec/assets/instantiated_vapp_delelete_done_task.xml +0 -5
  98. data/spec/assets/instantiated_vapp_delelete_running_task.xml +0 -6
  99. data/spec/assets/instantiated_vapp_network_config_add_network_request.xml +0 -36
  100. data/spec/assets/instantiated_vapp_network_config_modify_network_task_success.xml +0 -6
  101. data/spec/assets/instantiated_vapp_network_config_remove_network_request.xml +0 -6
  102. data/spec/assets/instantiated_vapp_network_config_section_response.xml +0 -17
  103. data/spec/assets/instantiated_vapp_off_response.xml +0 -206
  104. data/spec/assets/instantiated_vapp_on_response.xml +0 -205
  105. data/spec/assets/instantiated_vapp_power_task_running.xml +0 -6
  106. data/spec/assets/instantiated_vapp_power_task_success.xml +0 -6
  107. data/spec/assets/instantiated_vapp_response.xml +0 -205
  108. data/spec/assets/instantiated_vm_change_task_running.xml +0 -6
  109. data/spec/assets/instantiated_vm_change_task_success.xml +0 -6
  110. data/spec/assets/instantiated_vm_cpu_response.xml +0 -11
  111. data/spec/assets/instantiated_vm_insert_media_task_done.xml +0 -6
  112. data/spec/assets/instantiated_vm_memory_response.xml +0 -11
  113. data/spec/assets/instantiated_vm_modify_task_running.xml +0 -6
  114. data/spec/assets/instantiated_vm_modify_task_success.xml +0 -5
  115. data/spec/assets/instantiated_vm_network_section_response.xml +0 -11
  116. data/spec/assets/instantiated_vm_response.xml +0 -149
  117. data/spec/assets/media_add_to_catalog_request.xml +0 -5
  118. data/spec/assets/media_add_to_catalog_response.xml +0 -8
  119. data/spec/assets/media_delete_task_done.xml +0 -6
  120. data/spec/assets/media_upload_pending_response.xml +0 -13
  121. data/spec/assets/media_upload_request.xml +0 -2
  122. data/spec/assets/metadata_set_request.xml +0 -3
  123. data/spec/assets/metadata_set_task_done.xml +0 -6
  124. data/spec/assets/org_network_response.xml +0 -22
  125. data/spec/assets/reconfigure_vm_request.xml +0 -133
  126. data/spec/assets/reconfigure_vm_task.xml +0 -8
  127. data/spec/assets/session.xml +0 -7
  128. data/spec/assets/test-config.yml +0 -38
  129. data/spec/assets/undeploy_params.xml +0 -1
  130. data/spec/assets/vapp_template_catalog_resolver_response.xml +0 -3
  131. data/spec/assets/vapp_template_delelete_done_task.xml +0 -5
  132. data/spec/assets/vapp_template_delelete_running_task.xml +0 -6
  133. data/spec/assets/vapp_template_instantiate_request.xml +0 -8
  134. data/spec/assets/vapp_template_instantiate_with_locality_request.xml +0 -14
  135. data/spec/assets/vapp_template_no_disk_response.xml +0 -27
  136. data/spec/assets/vapp_template_ready_response.xml +0 -79
  137. data/spec/assets/vapp_template_upload_complete.xml +0 -28
  138. data/spec/assets/vapp_template_upload_failed.xml +0 -28
  139. data/spec/assets/vapp_template_upload_request.xml +0 -4
  140. data/spec/assets/vapp_template_upload_response.xml +0 -25
  141. data/spec/assets/vcloud_response.xml +0 -56
  142. data/spec/assets/vdc_response.xml +0 -57
  143. data/spec/spec_helper.rb +0 -107
  144. data/spec/unit/client_response.rb +0 -700
  145. data/spec/unit/client_spec.rb +0 -1152
@@ -1,3 +1,46 @@
1
- $:.unshift(File.join(File.dirname(__FILE__), "wrapper_classes"))
1
+ require "ruby_vcloud_sdk/xml/wrapper_classes/item"
2
2
 
3
- Dir[File.dirname(__FILE__) + "/wrapper_classes/*.rb"].each { |r| require File.expand_path(r) }
3
+ require "ruby_vcloud_sdk/xml/wrapper_classes/admin_catalog"
4
+ require "ruby_vcloud_sdk/xml/wrapper_classes/admin_org"
5
+ require "ruby_vcloud_sdk/xml/wrapper_classes/allocated_ip_addresses"
6
+ require "ruby_vcloud_sdk/xml/wrapper_classes/catalog_item"
7
+ require "ruby_vcloud_sdk/xml/wrapper_classes/disk"
8
+ require "ruby_vcloud_sdk/xml/wrapper_classes/disk_attach_or_detach_params"
9
+ require "ruby_vcloud_sdk/xml/wrapper_classes/disk_create_params"
10
+ require "ruby_vcloud_sdk/xml/wrapper_classes/edge_gateway"
11
+ require "ruby_vcloud_sdk/xml/wrapper_classes/entity"
12
+ require "ruby_vcloud_sdk/xml/wrapper_classes/file"
13
+ require "ruby_vcloud_sdk/xml/wrapper_classes/gateway_interface"
14
+ require "ruby_vcloud_sdk/xml/wrapper_classes/hard_disk_item_wrapper"
15
+ require "ruby_vcloud_sdk/xml/wrapper_classes/instantiate_vapp_template_params"
16
+ require "ruby_vcloud_sdk/xml/wrapper_classes/ip_address"
17
+ require "ruby_vcloud_sdk/xml/wrapper_classes/ip_scope"
18
+ require "ruby_vcloud_sdk/xml/wrapper_classes/ip_range"
19
+ require "ruby_vcloud_sdk/xml/wrapper_classes/ip_ranges"
20
+ require "ruby_vcloud_sdk/xml/wrapper_classes/link"
21
+ require "ruby_vcloud_sdk/xml/wrapper_classes/media"
22
+ require "ruby_vcloud_sdk/xml/wrapper_classes/media_insert_or_eject_params"
23
+ require "ruby_vcloud_sdk/xml/wrapper_classes/metadata_value"
24
+ require "ruby_vcloud_sdk/xml/wrapper_classes/network"
25
+ require "ruby_vcloud_sdk/xml/wrapper_classes/network_config"
26
+ require "ruby_vcloud_sdk/xml/wrapper_classes/network_config_section"
27
+ require "ruby_vcloud_sdk/xml/wrapper_classes/network_connection"
28
+ require "ruby_vcloud_sdk/xml/wrapper_classes/network_connection_section"
29
+ require "ruby_vcloud_sdk/xml/wrapper_classes/nic_item_wrapper"
30
+ require "ruby_vcloud_sdk/xml/wrapper_classes/org"
31
+ require "ruby_vcloud_sdk/xml/wrapper_classes/org_network"
32
+ require "ruby_vcloud_sdk/xml/wrapper_classes/org_vdc_network"
33
+ require "ruby_vcloud_sdk/xml/wrapper_classes/query_result_records"
34
+ require "ruby_vcloud_sdk/xml/wrapper_classes/recompose_vapp_params"
35
+ require "ruby_vcloud_sdk/xml/wrapper_classes/session"
36
+ require "ruby_vcloud_sdk/xml/wrapper_classes/supported_versions"
37
+ require "ruby_vcloud_sdk/xml/wrapper_classes/task"
38
+ require "ruby_vcloud_sdk/xml/wrapper_classes/upload_vapp_template_params"
39
+ require "ruby_vcloud_sdk/xml/wrapper_classes/vapp"
40
+ require "ruby_vcloud_sdk/xml/wrapper_classes/vapp_template"
41
+ require "ruby_vcloud_sdk/xml/wrapper_classes/vcloud"
42
+ require "ruby_vcloud_sdk/xml/wrapper_classes/vdc"
43
+ require "ruby_vcloud_sdk/xml/wrapper_classes/vdc_storage_profile"
44
+ require "ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section"
45
+ require "ruby_vcloud_sdk/xml/wrapper_classes/vm"
46
+ require "ruby_vcloud_sdk/xml/wrapper_classes/vms"
@@ -2,16 +2,25 @@ module VCloudSdk
2
2
  module Xml
3
3
 
4
4
  class AdminCatalog < Wrapper
5
+ def description
6
+ get_nodes("Description").first
7
+ end
8
+
9
+ def description=(desc)
10
+ description.content = desc
11
+ end
12
+
5
13
  def add_item_link
6
- get_nodes("Link", {"type"=>ADMIN_MEDIA_TYPE[:CATALOG_ITEM],
7
- "rel"=>"add"}).first
14
+ get_nodes(XML_TYPE[:LINK],
15
+ { type: ADMIN_MEDIA_TYPE[:CATALOG_ITEM],
16
+ rel: XML_TYPE[:ADD] }).first
8
17
  end
9
18
 
10
19
  def catalog_items(name = nil)
11
20
  if name
12
- get_nodes("CatalogItem", {"name" => name})
21
+ get_nodes(XML_TYPE[:CATALOGITEM], { name: name })
13
22
  else
14
- get_nodes("CatalogItem")
23
+ get_nodes(XML_TYPE[:CATALOGITEM])
15
24
  end
16
25
  end
17
26
  end
@@ -0,0 +1,9 @@
1
+ module VCloudSdk
2
+ module Xml
3
+ class AllocatedIpAddresses < Wrapper
4
+ def ip_addresses
5
+ get_nodes(:IpAddress, nil, true)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -2,24 +2,16 @@ module VCloudSdk
2
2
  module Xml
3
3
 
4
4
  class CatalogItem < Wrapper
5
- def name=(name)
6
- @root["name"] = name
7
- end
8
-
9
- def remove_link
10
- get_nodes("Link", {"rel" => "remove"}, true).first
11
- end
12
-
13
5
  def entity=(entity)
14
- entity_node = get_nodes("Entity").first
15
- entity_node["name"] = entity.name
16
- entity_node["id"] = entity.urn
17
- entity_node["href"] = entity.href
18
- entity_node["type"] = entity.type
6
+ entity_node = self.entity
7
+ entity_node[:name] = entity.name
8
+ entity_node[:id] = entity.urn
9
+ entity_node[:href] = entity.href
10
+ entity_node[:type] = entity.type
19
11
  end
20
12
 
21
13
  def entity
22
- get_nodes("Entity").first
14
+ get_nodes(XML_TYPE[:ENTITY]).first
23
15
  end
24
16
  end
25
17
 
@@ -1,40 +1,50 @@
1
1
  module VCloudSdk
2
2
  module Xml
3
-
4
3
  class Disk < Wrapper
4
+ def bus_type
5
+ @root["busType"]
6
+ end
7
+
5
8
  def bus_type=(value)
6
9
  @root["busType"] = value.to_s
7
10
  end
8
11
 
12
+ def bus_sub_type
13
+ @root["busSubType"]
14
+ end
15
+
9
16
  def bus_sub_type=(value)
10
17
  @root["busSubType"] = value.to_s
11
18
  end
12
19
 
13
- def delete_link
14
- get_nodes("Link", {"rel" => "remove"}, true).first
20
+ def size_mb
21
+ @root["size"].to_i / 1024 / 1024
15
22
  end
16
23
 
17
- def name=(name)
18
- @root["name"] = name.to_s
24
+ def running_tasks
25
+ tasks.select { |t| RUNNING.include?(t.status) }
19
26
  end
20
27
 
21
- def size_mb
22
- @root["size"].to_i/1024/1024
28
+ def tasks
29
+ get_nodes(XML_TYPE[:TASK])
23
30
  end
24
31
 
25
- def running_tasks
26
- tasks.find_all {|t| RUNNING.include?(t.status)}
32
+ def status
33
+ @root["status"]
27
34
  end
28
35
 
29
- def tasks
30
- get_nodes("Task")
36
+ def vms_link
37
+ get_nodes(XML_TYPE[:LINK],
38
+ { type: MEDIA_TYPE[:VMS] },
39
+ true)
40
+ .first
31
41
  end
32
42
 
33
43
  private
34
44
 
35
- RUNNING = [TASK_STATUS[:RUNNING], TASK_STATUS[:QUEUED],
36
- TASK_STATUS[:PRE_RUNNING]]
45
+ RUNNING = [TASK_STATUS[:RUNNING],
46
+ TASK_STATUS[:QUEUED],
47
+ TASK_STATUS[:PRE_RUNNING]]
37
48
  end
38
-
39
49
  end
40
50
  end
@@ -1,12 +1,10 @@
1
1
  module VCloudSdk
2
2
  module Xml
3
-
4
3
  class DiskAttachOrDetachParams < Wrapper
5
4
  def disk_href=(value)
6
5
  disk = get_nodes("Disk").first
7
6
  disk["href"] = value.to_s
8
7
  end
9
8
  end
10
-
11
9
  end
12
10
  end
@@ -1,6 +1,5 @@
1
1
  module VCloudSdk
2
2
  module Xml
3
-
4
3
  class DiskCreateParams < Wrapper
5
4
  def bus_type=(value)
6
5
  disk["busType"] = value.to_s
@@ -20,7 +19,7 @@ module VCloudSdk
20
19
 
21
20
  def add_locality(local)
22
21
  if !@local_exists.nil? && @local_exists
23
- raise "Cannot add locality more than once to DiskCreateParams"
22
+ fail "Cannot add locality more than once to DiskCreateParams"
24
23
  end
25
24
  @local_exists = true
26
25
  node = create_child("Locality")
@@ -42,6 +41,5 @@ module VCloudSdk
42
41
  id.split(":").first
43
42
  end
44
43
  end
45
-
46
44
  end
47
45
  end
@@ -0,0 +1,13 @@
1
+ module VCloudSdk
2
+ module Xml
3
+ class EdgeGateway < Wrapper
4
+ def gateway_interfaces
5
+ get_nodes(:Configuration, nil, true)
6
+ .first
7
+ .get_nodes(:GatewayInterfaces, nil, true)
8
+ .first
9
+ .get_nodes(:GatewayInterface, nil, true)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ module VCloudSdk
2
+ module Xml
3
+ class GatewayInterface < Wrapper
4
+ def interface_type
5
+ get_nodes(:InterfaceType, nil, true)
6
+ .first
7
+ .content
8
+ end
9
+
10
+ def subnet_participation
11
+ get_nodes(:SubnetParticipation, nil, true)
12
+ .first
13
+ end
14
+
15
+ def ip_ranges
16
+ subnet_participation
17
+ .get_nodes(:IpRanges, nil, true)
18
+ .first
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,8 +1,5 @@
1
- require "item"
2
-
3
1
  module VCloudSdk
4
2
  module Xml
5
-
6
3
  class HardDiskItemWrapper < Item
7
4
  def hash
8
5
  [disk_id, instance_id, bus_type, bus_sub_type].hash
@@ -41,10 +38,13 @@ module VCloudSdk
41
38
  get_rasd_content(RASD_TYPES[:PARENT])
42
39
  end
43
40
 
41
+ def element_name
42
+ get_rasd_content(RASD_TYPES[:ELEMENT_NAME])
43
+ end
44
+
44
45
  def host_resource
45
46
  get_rasd(RASD_TYPES[:HOST_RESOURCE])
46
47
  end
47
48
  end
48
-
49
49
  end
50
50
  end
@@ -0,0 +1,10 @@
1
+ module VCloudSdk
2
+ module Xml
3
+ class IpAddress < Wrapper
4
+ def ip_address
5
+ get_nodes(:IpAddress, nil, true)
6
+ .first.content
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ module VCloudSdk
2
+ module Xml
3
+ class IpRange < Wrapper
4
+ def start_address
5
+ get_nodes(:StartAddress).first.content
6
+ end
7
+
8
+ def end_address
9
+ get_nodes(:EndAddress).first.content
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module VCloudSdk
2
+ module Xml
3
+ class IpRanges < Wrapper
4
+ def ranges
5
+ get_nodes(:IpRange)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,55 +1,29 @@
1
1
  module VCloudSdk
2
2
  module Xml
3
-
4
3
  class IpScope < Wrapper
5
4
  def is_inherited?
6
- get_nodes("IsInherited").first.content
5
+ get_nodes(:IsInherited).first.content
7
6
  end
8
7
 
9
8
  def is_inherited=(value)
10
- get_nodes("IsInherited").first.content = value
9
+ get_nodes(:IsInherited).first.content = value
11
10
  end
12
11
 
13
12
  def gateway
14
- get_nodes("Gateway").first.content
13
+ get_nodes(:Gateway).first.content
15
14
  end
16
15
 
17
16
  def gateway=(value)
18
- get_nodes("Gateway").first.content = value
17
+ get_nodes(:Gateway).first.content = value
19
18
  end
20
19
 
21
20
  def netmask
22
- get_nodes("Netmask").first.content
21
+ get_nodes(:Netmask).first.content
23
22
  end
24
23
 
25
24
  def netmask=(value)
26
- get_nodes("Netmask").first.content = value
27
- end
28
-
29
- def start_address
30
- nodes = get_nodes("StartAddress")
31
- return nil unless nodes
32
- node = nodes.first
33
- return nil unless node
34
- return node.content
35
- end
36
-
37
- def start_address=(value)
38
- get_nodes("StartAddress").first.content = value
39
- end
40
-
41
- def end_address
42
- nodes = get_nodes("EndAddress")
43
- return nil unless nodes
44
- node = nodes.first
45
- return nil unless node
46
- return node.content
47
- end
48
-
49
- def end_address=(value)
50
- get_nodes("EndAddress").first.content = value
25
+ get_nodes(:Netmask).first.content = value
51
26
  end
52
27
  end
53
-
54
28
  end
55
29
  end
@@ -1,16 +1,11 @@
1
1
  module VCloudSdk
2
2
  module Xml
3
-
4
3
  class Item < Wrapper
5
4
  def add_rasd(name)
6
5
  raise "Cannot add duplicate RASD element #{name}." if get_rasd(name)
7
6
  add_child(name, "rasd", RASD)
8
7
  end
9
8
 
10
- def edit_link
11
- get_nodes("Link", {"rel" => "edit"}, true).first
12
- end
13
-
14
9
  def get_rasd(name)
15
10
  get_nodes(name, nil, true, RASD).first
16
11
  end
@@ -23,10 +18,9 @@ module VCloudSdk
23
18
 
24
19
  def set_rasd(name, value)
25
20
  node = get_rasd(name)
26
- raise "The RASD element #{name} does not exist." unless node
21
+ fail "The RASD element #{name} does not exist." unless node
27
22
  node.content = value
28
23
  end
29
24
  end
30
-
31
25
  end
32
26
  end
@@ -0,0 +1,14 @@
1
+ module VCloudSdk
2
+ module Xml
3
+ class Link < Wrapper
4
+ def rel
5
+ @root["rel"]
6
+ end
7
+
8
+ def rel=(rel)
9
+ @root["rel"] = rel
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -1,15 +1,6 @@
1
1
  module VCloudSdk
2
2
  module Xml
3
-
4
3
  class Media < Wrapper
5
- def name
6
- @root["name"]
7
- end
8
-
9
- def name=(name)
10
- @root["name"] = name.to_s
11
- end
12
-
13
4
  def size
14
5
  @root["size"]
15
6
  end
@@ -36,18 +27,11 @@ module VCloudSdk
36
27
 
37
28
  # Files that haven"t finished transferring
38
29
  def incomplete_files
39
- files.find_all { |f| f["size"].to_i < 0 ||
40
- (f["size"].to_i > f["bytesTransferred"].to_i) }
41
- end
42
-
43
- def delete_link
44
- get_nodes("Link", {"rel" => "remove"}, true).first
45
- end
46
-
47
- def running_tasks
48
- get_nodes("Task", {"status" => "running"})
30
+ files.select do |f|
31
+ f["size"].to_i < 0 ||
32
+ (f["size"].to_i > f["bytesTransferred"].to_i)
33
+ end
49
34
  end
50
35
  end
51
-
52
36
  end
53
37
  end