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.
- checksums.yaml +7 -0
- data/README.md +296 -0
- data/lib/ruby_vcloud_sdk.rb +0 -4
- data/lib/ruby_vcloud_sdk/catalog.rb +377 -0
- data/lib/ruby_vcloud_sdk/catalog_item.rb +26 -0
- data/lib/ruby_vcloud_sdk/client.rb +25 -882
- data/lib/ruby_vcloud_sdk/config.rb +1 -7
- data/lib/ruby_vcloud_sdk/connection/connection.rb +114 -54
- data/lib/ruby_vcloud_sdk/cpu.rb +11 -0
- data/lib/ruby_vcloud_sdk/disk.rb +55 -0
- data/lib/ruby_vcloud_sdk/edge_gateway.rb +32 -0
- data/lib/ruby_vcloud_sdk/infrastructure.rb +135 -0
- data/lib/ruby_vcloud_sdk/ip_ranges.rb +95 -0
- data/lib/ruby_vcloud_sdk/memory.rb +11 -0
- data/lib/ruby_vcloud_sdk/network.rb +32 -0
- data/lib/ruby_vcloud_sdk/powerable.rb +78 -0
- data/lib/ruby_vcloud_sdk/resources.rb +13 -0
- data/lib/ruby_vcloud_sdk/session.rb +46 -0
- data/lib/ruby_vcloud_sdk/vapp.rb +122 -0
- data/lib/ruby_vcloud_sdk/vdc.rb +210 -0
- data/lib/ruby_vcloud_sdk/vdc_storage_profile.rb +23 -0
- data/lib/ruby_vcloud_sdk/version.rb +1 -1
- data/lib/ruby_vcloud_sdk/vm.rb +132 -0
- data/lib/ruby_vcloud_sdk/xml/constants.rb +6 -4
- data/lib/ruby_vcloud_sdk/xml/wrapper.rb +109 -30
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes.rb +45 -2
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/admin_catalog.rb +13 -4
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/allocated_ip_addresses.rb +9 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/catalog_item.rb +6 -14
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk.rb +24 -14
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk_attach_or_detach_params.rb +0 -2
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk_create_params.rb +1 -3
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/edge_gateway.rb +13 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/gateway_interface.rb +22 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/hard_disk_item_wrapper.rb +4 -4
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_address.rb +10 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_range.rb +13 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_ranges.rb +9 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_scope.rb +6 -32
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/item.rb +1 -7
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/link.rb +14 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/media.rb +4 -20
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/media_insert_or_eject_params.rb +1 -3
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network_connection_section.rb +0 -4
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/nic_item_wrapper.rb +0 -2
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/org.rb +44 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/org_vdc_network.rb +11 -3
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/query_result_records.rb +14 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/recompose_vapp_params.rb +42 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/session.rb +5 -5
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/supported_versions.rb +19 -0
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/task.rb +1 -1
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/upload_vapp_template_params.rb +2 -4
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vapp.rb +13 -22
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vapp_template.rb +0 -2
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vcloud.rb +5 -3
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb +72 -15
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb +8 -6
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vm.rb +29 -25
- data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vms.rb +12 -0
- data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminCatalog.xml +6 -1
- data/lib/ruby_vcloud_sdk/xml/xml_templates/RecomposeVAppParams.xml +16 -1
- metadata +116 -233
- data/README +0 -1
- data/Rakefile +0 -50
- data/lib/ruby_vcloud_sdk/util.rb +0 -21
- data/spec/assets/admin_org_response.xml +0 -75
- data/spec/assets/catalog_add_item_response.xml +0 -8
- data/spec/assets/catalog_add_vapp_request.xml +0 -5
- data/spec/assets/catalog_item_added_response.xml +0 -19
- data/spec/assets/catalog_response.xml +0 -19
- data/spec/assets/existing_media_busy_response.xml +0 -19
- data/spec/assets/existing_media_catalog_item.xml +0 -8
- data/spec/assets/existing_media_delete_task_done.xml +0 -6
- data/spec/assets/existing_media_done_response.xml +0 -11
- data/spec/assets/existing_vapp_resolver_response.xml +0 -3
- data/spec/assets/existing_vapp_template_catalog_resolver_response.xml +0 -3
- data/spec/assets/existing_vapp_template_instantiate_response.xml +0 -20
- data/spec/assets/existing_vapp_template_instantiate_task_error_response.xml +0 -7
- data/spec/assets/existing_vapp_template_instantiate_task_start_response.xml +0 -7
- data/spec/assets/existing_vapp_template_instantiate_task_success_response.xml +0 -7
- data/spec/assets/existing_vapp_template_item_response.xml +0 -8
- data/spec/assets/existing_vapp_template_ready_response.xml +0 -79
- data/spec/assets/finalize_upload_task_done_response.xml +0 -7
- data/spec/assets/finalize_upload_task_response.xml +0 -7
- data/spec/assets/indy_disk_attach_request.xml +0 -3
- data/spec/assets/indy_disk_attach_task.xml +0 -6
- data/spec/assets/indy_disk_attach_task_error.xml +0 -6
- data/spec/assets/indy_disk_create_error.xml +0 -1
- data/spec/assets/indy_disk_create_request.xml +0 -4
- data/spec/assets/indy_disk_create_response.xml +0 -19
- data/spec/assets/indy_disk_delete_task.xml +0 -6
- data/spec/assets/indy_disk_detach_request.xml +0 -3
- data/spec/assets/indy_disk_detach_task.xml +0 -6
- data/spec/assets/indy_disk_response.xml +0 -11
- data/spec/assets/instantiated_suspended_vapp_response.xml +0 -209
- data/spec/assets/instantiated_vapp_delelete_done_task.xml +0 -5
- data/spec/assets/instantiated_vapp_delelete_running_task.xml +0 -6
- data/spec/assets/instantiated_vapp_network_config_add_network_request.xml +0 -36
- data/spec/assets/instantiated_vapp_network_config_modify_network_task_success.xml +0 -6
- data/spec/assets/instantiated_vapp_network_config_remove_network_request.xml +0 -6
- data/spec/assets/instantiated_vapp_network_config_section_response.xml +0 -17
- data/spec/assets/instantiated_vapp_off_response.xml +0 -206
- data/spec/assets/instantiated_vapp_on_response.xml +0 -205
- data/spec/assets/instantiated_vapp_power_task_running.xml +0 -6
- data/spec/assets/instantiated_vapp_power_task_success.xml +0 -6
- data/spec/assets/instantiated_vapp_response.xml +0 -205
- data/spec/assets/instantiated_vm_change_task_running.xml +0 -6
- data/spec/assets/instantiated_vm_change_task_success.xml +0 -6
- data/spec/assets/instantiated_vm_cpu_response.xml +0 -11
- data/spec/assets/instantiated_vm_insert_media_task_done.xml +0 -6
- data/spec/assets/instantiated_vm_memory_response.xml +0 -11
- data/spec/assets/instantiated_vm_modify_task_running.xml +0 -6
- data/spec/assets/instantiated_vm_modify_task_success.xml +0 -5
- data/spec/assets/instantiated_vm_network_section_response.xml +0 -11
- data/spec/assets/instantiated_vm_response.xml +0 -149
- data/spec/assets/media_add_to_catalog_request.xml +0 -5
- data/spec/assets/media_add_to_catalog_response.xml +0 -8
- data/spec/assets/media_delete_task_done.xml +0 -6
- data/spec/assets/media_upload_pending_response.xml +0 -13
- data/spec/assets/media_upload_request.xml +0 -2
- data/spec/assets/metadata_set_request.xml +0 -3
- data/spec/assets/metadata_set_task_done.xml +0 -6
- data/spec/assets/org_network_response.xml +0 -22
- data/spec/assets/reconfigure_vm_request.xml +0 -133
- data/spec/assets/reconfigure_vm_task.xml +0 -8
- data/spec/assets/session.xml +0 -7
- data/spec/assets/test-config.yml +0 -38
- data/spec/assets/undeploy_params.xml +0 -1
- data/spec/assets/vapp_template_catalog_resolver_response.xml +0 -3
- data/spec/assets/vapp_template_delelete_done_task.xml +0 -5
- data/spec/assets/vapp_template_delelete_running_task.xml +0 -6
- data/spec/assets/vapp_template_instantiate_request.xml +0 -8
- data/spec/assets/vapp_template_instantiate_with_locality_request.xml +0 -14
- data/spec/assets/vapp_template_no_disk_response.xml +0 -27
- data/spec/assets/vapp_template_ready_response.xml +0 -79
- data/spec/assets/vapp_template_upload_complete.xml +0 -28
- data/spec/assets/vapp_template_upload_failed.xml +0 -28
- data/spec/assets/vapp_template_upload_request.xml +0 -4
- data/spec/assets/vapp_template_upload_response.xml +0 -25
- data/spec/assets/vcloud_response.xml +0 -56
- data/spec/assets/vdc_response.xml +0 -57
- data/spec/spec_helper.rb +0 -107
- data/spec/unit/client_response.rb +0 -700
- data/spec/unit/client_spec.rb +0 -1152
@@ -1,3 +1,46 @@
|
|
1
|
-
|
1
|
+
require "ruby_vcloud_sdk/xml/wrapper_classes/item"
|
2
2
|
|
3
|
-
|
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(
|
7
|
-
|
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(
|
21
|
+
get_nodes(XML_TYPE[:CATALOGITEM], { name: name })
|
13
22
|
else
|
14
|
-
get_nodes(
|
23
|
+
get_nodes(XML_TYPE[:CATALOGITEM])
|
15
24
|
end
|
16
25
|
end
|
17
26
|
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 =
|
15
|
-
entity_node[
|
16
|
-
entity_node[
|
17
|
-
entity_node[
|
18
|
-
entity_node[
|
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(
|
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
|
14
|
-
|
20
|
+
def size_mb
|
21
|
+
@root["size"].to_i / 1024 / 1024
|
15
22
|
end
|
16
23
|
|
17
|
-
def
|
18
|
-
|
24
|
+
def running_tasks
|
25
|
+
tasks.select { |t| RUNNING.include?(t.status) }
|
19
26
|
end
|
20
27
|
|
21
|
-
def
|
22
|
-
|
28
|
+
def tasks
|
29
|
+
get_nodes(XML_TYPE[:TASK])
|
23
30
|
end
|
24
31
|
|
25
|
-
def
|
26
|
-
|
32
|
+
def status
|
33
|
+
@root["status"]
|
27
34
|
end
|
28
35
|
|
29
|
-
def
|
30
|
-
get_nodes(
|
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],
|
36
|
-
|
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,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
|
-
|
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
|
@@ -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(
|
5
|
+
get_nodes(:IsInherited).first.content
|
7
6
|
end
|
8
7
|
|
9
8
|
def is_inherited=(value)
|
10
|
-
get_nodes(
|
9
|
+
get_nodes(:IsInherited).first.content = value
|
11
10
|
end
|
12
11
|
|
13
12
|
def gateway
|
14
|
-
get_nodes(
|
13
|
+
get_nodes(:Gateway).first.content
|
15
14
|
end
|
16
15
|
|
17
16
|
def gateway=(value)
|
18
|
-
get_nodes(
|
17
|
+
get_nodes(:Gateway).first.content = value
|
19
18
|
end
|
20
19
|
|
21
20
|
def netmask
|
22
|
-
get_nodes(
|
21
|
+
get_nodes(:Netmask).first.content
|
23
22
|
end
|
24
23
|
|
25
24
|
def netmask=(value)
|
26
|
-
get_nodes(
|
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
|
-
|
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
|
@@ -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.
|
40
|
-
|
41
|
-
|
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
|