ruby_vcloud_sdk 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/README.md +182 -3
  2. data/lib/ruby_vcloud_sdk/catalog.rb +18 -13
  3. data/lib/ruby_vcloud_sdk/client.rb +10 -1
  4. data/lib/ruby_vcloud_sdk/connection/connection.rb +1 -1
  5. data/lib/ruby_vcloud_sdk/disk.rb +1 -13
  6. data/lib/ruby_vcloud_sdk/infrastructure.rb +11 -1
  7. data/lib/ruby_vcloud_sdk/internal_disk.rb +12 -0
  8. data/lib/ruby_vcloud_sdk/network.rb +8 -3
  9. data/lib/ruby_vcloud_sdk/right_record.rb +12 -0
  10. data/lib/ruby_vcloud_sdk/vapp.rb +85 -0
  11. data/lib/ruby_vcloud_sdk/vdc.rb +61 -41
  12. data/lib/ruby_vcloud_sdk/vm.rb +233 -0
  13. data/lib/ruby_vcloud_sdk/xml/constants.rb +10 -0
  14. data/lib/ruby_vcloud_sdk/xml/wrapper.rb +10 -1
  15. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk.rb +1 -1
  16. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_ranges.rb +16 -0
  17. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_scope.rb +4 -0
  18. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network_config_section.rb +4 -6
  19. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/org_vdc_network.rb +0 -4
  20. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/product_section.rb +35 -0
  21. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/product_section_list.rb +14 -0
  22. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/query_result_records.rb +4 -0
  23. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb +6 -4
  24. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vm.rb +31 -47
  25. data/lib/ruby_vcloud_sdk/xml/wrapper_classes.rb +2 -0
  26. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkConfig.xml +1 -6
  27. data/lib/ruby_vcloud_sdk/xml/xml_templates/ProductSectionList.xml +8 -1
  28. metadata +29 -13
  29. checksums.yaml +0 -7
@@ -13,6 +13,13 @@ module VCloudSdk
13
13
  .first
14
14
  end
15
15
 
16
+ def product_sections_link
17
+ get_nodes(XML_TYPE[:LINK],
18
+ { type: MEDIA_TYPE[:PRODUCT_SECTIONS] },
19
+ true)
20
+ .first
21
+ end
22
+
16
23
  def attach_disk_link
17
24
  get_nodes(XML_TYPE[:LINK],
18
25
  { rel: "disk:attach",
@@ -41,10 +48,13 @@ module VCloudSdk
41
48
  node = nodes.first
42
49
  return unless node
43
50
  node.content = value
51
+ value
44
52
  end
45
53
 
46
54
  def reconfigure_link
47
- get_nodes("Link", {"rel" => "reconfigureVm"}, true).first
55
+ get_nodes(XML_TYPE[:LINK],
56
+ { rel: "reconfigureVm" },
57
+ true).first
48
58
  end
49
59
 
50
60
  def insert_media_link
@@ -60,7 +70,9 @@ module VCloudSdk
60
70
  end
61
71
 
62
72
  def metadata_link
63
- get_nodes("Link", {"type" => MEDIA_TYPE[:METADATA]}, true).first
73
+ get_nodes(XML_TYPE[:LINK],
74
+ { type: MEDIA_TYPE[:METADATA] },
75
+ true).first
64
76
  end
65
77
 
66
78
  def hardware_section
@@ -73,20 +85,22 @@ module VCloudSdk
73
85
 
74
86
  def network_connection_section
75
87
  get_nodes("NetworkConnectionSection",
76
- {"type" => MEDIA_TYPE[:NETWORK_CONNECTION_SECTION]}).first
88
+ type: MEDIA_TYPE[:NETWORK_CONNECTION_SECTION]).first
89
+ end
90
+
91
+ def product_section
92
+ get_nodes("ProductSection", nil, true, OVF).first
77
93
  end
78
94
 
79
95
  # hardware modification methods
80
96
 
81
- def add_hard_disk(size_mb)
97
+ def add_hard_disk(capacity, bus_type, bus_sub_type)
82
98
  section = hardware_section
83
- scsi_controller = section.scsi_controller
84
- unless scsi_controller
85
- raise ObjectNotFoundError, "No SCSI controller found for VM #{name}"
86
- end
87
99
  # Create a RASD item
88
- new_disk = WrapperFactory.create_instance("Item", nil,
89
- hardware_section.doc_namespaces)
100
+ new_disk = WrapperFactory
101
+ .create_instance("Item",
102
+ nil,
103
+ hardware_section.doc_namespaces)
90
104
  section.add_item(new_disk)
91
105
  # The order matters!
92
106
  new_disk.add_rasd(RASD_TYPES[:HOST_RESOURCE])
@@ -96,12 +110,11 @@ module VCloudSdk
96
110
  new_disk.set_rasd(rt, HARDWARE_TYPE[:HARD_DISK])
97
111
  host_resource = new_disk.get_rasd(RASD_TYPES[:HOST_RESOURCE])
98
112
  host_resource[new_disk.create_qualified_name(
99
- "capacity", VCLOUD_NAMESPACE)] = size_mb.to_s
113
+ "capacity", VCLOUD_NAMESPACE)] = capacity.to_s
100
114
  host_resource[new_disk.create_qualified_name(
101
- "busSubType", VCLOUD_NAMESPACE)] = scsi_controller.get_rasd_content(
102
- RASD_TYPES[:RESOURCE_SUB_TYPE])
115
+ "busSubType", VCLOUD_NAMESPACE)] = bus_sub_type
103
116
  host_resource[new_disk.create_qualified_name(
104
- "busType", VCLOUD_NAMESPACE)] = HARDWARE_TYPE[:SCSI_CONTROLLER]
117
+ "busType", VCLOUD_NAMESPACE)] = bus_type
105
118
  end
106
119
 
107
120
  def change_cpu_count(quantity)
@@ -116,37 +129,6 @@ module VCloudSdk
116
129
  item.set_rasd("VirtualQuantity", mb)
117
130
  end
118
131
 
119
- def add_nic(nic_index, network_name, addressing_mode, ip = nil)
120
- section = hardware_section
121
- is_primary = hardware_section.nics.length == 0
122
- new_nic = Xml::NicItemWrapper.new(Xml::WrapperFactory.create_instance(
123
- "Item", nil, hardware_section.doc_namespaces))
124
- section.add_item(new_nic)
125
- new_nic.nic_index = nic_index
126
- new_nic.network = network_name
127
- new_nic.set_ip_addressing_mode(addressing_mode, ip)
128
- new_nic.is_primary = is_primary
129
- @logger.info("Adding NIC #{nic_index} to VM #{name} with the " +
130
- "following parameters: Network name: #{network_name}, " +
131
- "Addressing mode #{addressing_mode}, " +
132
- "IP address: #{ip.nil? ? "blank" : ip}")
133
- end
134
-
135
- # NIC modification methods
136
-
137
- def connect_nic(nic_index, network_name, addressing_mode,
138
- ip_address = nil)
139
- section = network_connection_section
140
- new_connection = WrapperFactory.create_instance("NetworkConnection",
141
- nil, network_connection_section.doc_namespaces)
142
- section.add_item(new_connection)
143
- new_connection.network_connection_index = nic_index
144
- new_connection.network = network_name
145
- new_connection.ip_address_allocation_mode = addressing_mode
146
- new_connection.ip_address = ip_address if ip_address
147
- new_connection.is_connected = true
148
- end
149
-
150
132
  # Deletes NIC from VM. Accepts variable number of arguments for NICs.
151
133
  # To delete all NICs from VM use the splat operator
152
134
  # ex: delete_nic(vm, *vm.hardware_section.nics)
@@ -168,15 +150,17 @@ module VCloudSdk
168
150
  net_conn_section = network_connection_section
169
151
  connection = net_conn_section.network_connection(nic_index)
170
152
  unless connection
171
- raise ObjectNotFoundError,
172
- "NIC #{nic_index} cannot be found on VM #{name}."
153
+ fail ObjectNotFoundError,
154
+ "NIC #{nic_index} cannot be found on VM #{name}."
173
155
  end
174
156
  connection.is_connected = is_connected
157
+ nil
175
158
  end
176
159
 
177
160
  def set_primary_nic(nic_index)
178
161
  net_conn_section = network_connection_section
179
162
  net_conn_section.primary_network_connection_index = nic_index
163
+ nil
180
164
  end
181
165
  end
182
166
  end
@@ -30,6 +30,8 @@ require "ruby_vcloud_sdk/xml/wrapper_classes/nic_item_wrapper"
30
30
  require "ruby_vcloud_sdk/xml/wrapper_classes/org"
31
31
  require "ruby_vcloud_sdk/xml/wrapper_classes/org_network"
32
32
  require "ruby_vcloud_sdk/xml/wrapper_classes/org_vdc_network"
33
+ require "ruby_vcloud_sdk/xml/wrapper_classes/product_section"
34
+ require "ruby_vcloud_sdk/xml/wrapper_classes/product_section_list"
33
35
  require "ruby_vcloud_sdk/xml/wrapper_classes/query_result_records"
34
36
  require "ruby_vcloud_sdk/xml/wrapper_classes/recompose_vapp_params"
35
37
  require "ruby_vcloud_sdk/xml/wrapper_classes/session"
@@ -7,12 +7,7 @@
7
7
  <IsInherited />
8
8
  <Gateway />
9
9
  <Netmask />
10
- <IpRanges>
11
- <IpRange>
12
- <StartAddress />
13
- <EndAddress />
14
- </IpRange>
15
- </IpRanges>
10
+ <IpRanges />
16
11
  </IpScope>
17
12
  </IpScopes>
18
13
  <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="" href=""/>
@@ -1 +1,8 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns7:ProductSectionList xmlns="http://www.vmware.com/vcloud/extension/v1" xmlns:ns2="http://www.vmware.com/vcloud/v1" xmlns:ns3="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:ns6="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns7="http://www.vmware.com/vcloud/v1.5" xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns9="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns10="http://www.vmware.com/vcloud/versions" type="" href=""/>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ProductSectionList xmlns="http://www.vmware.com/vcloud/v1.5"
3
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
4
+ <ovf:ProductSection
5
+ required="true">
6
+ <ovf:Info>Information about the installed software</ovf:Info>
7
+ </ovf:ProductSection>
8
+ </ProductSectionList>
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_vcloud_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - VMware
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-02-19 00:00:00.000000000 Z
12
+ date: 2014-03-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: builder
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: httpclient
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - '='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - '='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rest-client
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: nokogiri
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -69,26 +78,27 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: netaddr
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
- description: |-
84
- BOSH vCloud API client
85
- b7e7d7
94
+ description: ! 'BOSH vCloud API client
95
+
96
+ a51aef'
86
97
  email: support@cloudfoundry.com
87
98
  executables: []
88
99
  extensions: []
89
100
  extra_rdoc_files: []
90
101
  files:
91
- - README.md
92
102
  - lib/ruby_vcloud_sdk.rb
93
103
  - lib/ruby_vcloud_sdk/catalog.rb
94
104
  - lib/ruby_vcloud_sdk/catalog_item.rb
@@ -101,12 +111,14 @@ files:
101
111
  - lib/ruby_vcloud_sdk/edge_gateway.rb
102
112
  - lib/ruby_vcloud_sdk/errors.rb
103
113
  - lib/ruby_vcloud_sdk/infrastructure.rb
114
+ - lib/ruby_vcloud_sdk/internal_disk.rb
104
115
  - lib/ruby_vcloud_sdk/ip_ranges.rb
105
116
  - lib/ruby_vcloud_sdk/memory.rb
106
117
  - lib/ruby_vcloud_sdk/network.rb
107
118
  - lib/ruby_vcloud_sdk/ovf_directory.rb
108
119
  - lib/ruby_vcloud_sdk/powerable.rb
109
120
  - lib/ruby_vcloud_sdk/resources.rb
121
+ - lib/ruby_vcloud_sdk/right_record.rb
110
122
  - lib/ruby_vcloud_sdk/session.rb
111
123
  - lib/ruby_vcloud_sdk/vapp.rb
112
124
  - lib/ruby_vcloud_sdk/vdc.rb
@@ -147,6 +159,8 @@ files:
147
159
  - lib/ruby_vcloud_sdk/xml/wrapper_classes/org.rb
148
160
  - lib/ruby_vcloud_sdk/xml/wrapper_classes/org_network.rb
149
161
  - lib/ruby_vcloud_sdk/xml/wrapper_classes/org_vdc_network.rb
162
+ - lib/ruby_vcloud_sdk/xml/wrapper_classes/product_section.rb
163
+ - lib/ruby_vcloud_sdk/xml/wrapper_classes/product_section_list.rb
150
164
  - lib/ruby_vcloud_sdk/xml/wrapper_classes/query_result_records.rb
151
165
  - lib/ruby_vcloud_sdk/xml/wrapper_classes/recompose_vapp_params.rb
152
166
  - lib/ruby_vcloud_sdk/xml/wrapper_classes/session.rb
@@ -353,29 +367,31 @@ files:
353
367
  - lib/ruby_vcloud_sdk/xml/xml_templates/VmPendingQuestion.xml
354
368
  - lib/ruby_vcloud_sdk/xml/xml_templates/VmQuestionAnswer.xml
355
369
  - lib/ruby_vcloud_sdk/xml/xml_templates/generate_dictionary.rb
370
+ - README.md
356
371
  homepage: https://github.com/vchs/ruby_vcloud_sdk
357
372
  licenses:
358
373
  - Apache 2.0
359
- metadata: {}
360
374
  post_install_message:
361
375
  rdoc_options: []
362
376
  require_paths:
363
377
  - lib
364
378
  required_ruby_version: !ruby/object:Gem::Requirement
379
+ none: false
365
380
  requirements:
366
- - - '>='
381
+ - - ! '>='
367
382
  - !ruby/object:Gem::Version
368
383
  version: 1.9.3
369
384
  required_rubygems_version: !ruby/object:Gem::Requirement
385
+ none: false
370
386
  requirements:
371
- - - '>='
387
+ - - ! '>='
372
388
  - !ruby/object:Gem::Version
373
389
  version: '0'
374
390
  requirements: []
375
391
  rubyforge_project:
376
- rubygems_version: 2.2.2
392
+ rubygems_version: 1.8.24
377
393
  signing_key:
378
- specification_version: 4
394
+ specification_version: 3
379
395
  summary: BOSH vCloud API client
380
396
  test_files: []
381
397
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: e4a7a59af14ae30e7e385ec2d53140e95bbeea19
4
- data.tar.gz: f9ea0599b374ae52a64d243754736534d45c6233
5
- SHA512:
6
- metadata.gz: ad8a5d9da2550b289ac57d6570a959ee26d28de8975e901d1b84666f61e14d5aeb5b3c2e1ae9000dfe334e60c3b7d267591d23e06ce062d814b74c91cc0a17c5
7
- data.tar.gz: 098583e00f2b459ead4922fa101056a1c744e26ec16da444c0afb0ea0a684c55d1e2b09c380cd39623fdedde19d954c626472770dea51e803605da8b6d96c16b