fog-terremark 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.rubocop.yml +20 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +17 -0
  7. data/CONTRIBUTING.md +18 -0
  8. data/CONTRIBUTORS.md +10 -0
  9. data/Gemfile +4 -0
  10. data/LICENSE.md +20 -0
  11. data/README.md +36 -0
  12. data/Rakefile +11 -0
  13. data/fog-terremark.gemspec +34 -0
  14. data/gemfiles/Gemfile.1.9.2- +8 -0
  15. data/gemfiles/Gemfile.1.9.3+ +7 -0
  16. data/lib/fog/compute/terremark.rb +62 -0
  17. data/lib/fog/compute/terremark/common.rb +18 -0
  18. data/lib/fog/compute/terremark/mock.rb +144 -0
  19. data/lib/fog/compute/terremark/models/address.rb +23 -0
  20. data/lib/fog/compute/terremark/models/addresses.rb +33 -0
  21. data/lib/fog/compute/terremark/models/image.rb +17 -0
  22. data/lib/fog/compute/terremark/models/images.rb +26 -0
  23. data/lib/fog/compute/terremark/models/internetservice.rb +60 -0
  24. data/lib/fog/compute/terremark/models/internetservices.rb +24 -0
  25. data/lib/fog/compute/terremark/models/network.rb +29 -0
  26. data/lib/fog/compute/terremark/models/networks.rb +37 -0
  27. data/lib/fog/compute/terremark/models/nodeservice.rb +44 -0
  28. data/lib/fog/compute/terremark/models/nodeservices.rb +14 -0
  29. data/lib/fog/compute/terremark/models/server.rb +201 -0
  30. data/lib/fog/compute/terremark/models/servers.rb +35 -0
  31. data/lib/fog/compute/terremark/models/task.rb +44 -0
  32. data/lib/fog/compute/terremark/models/tasks.rb +41 -0
  33. data/lib/fog/compute/terremark/models/vdc.rb +39 -0
  34. data/lib/fog/compute/terremark/models/vdcs.rb +36 -0
  35. data/lib/fog/compute/terremark/parser.rb +16 -0
  36. data/lib/fog/compute/terremark/real.rb +67 -0
  37. data/lib/fog/compute/terremark/requests/add_internet_service.rb +54 -0
  38. data/lib/fog/compute/terremark/requests/add_node_service.rb +51 -0
  39. data/lib/fog/compute/terremark/requests/configure_vapp.rb +58 -0
  40. data/lib/fog/compute/terremark/requests/create_internet_service.rb +57 -0
  41. data/lib/fog/compute/terremark/requests/delete_internet_service.rb +21 -0
  42. data/lib/fog/compute/terremark/requests/delete_node_service.rb +21 -0
  43. data/lib/fog/compute/terremark/requests/delete_public_ip.rb +21 -0
  44. data/lib/fog/compute/terremark/requests/delete_vapp.rb +20 -0
  45. data/lib/fog/compute/terremark/requests/deploy_vapp.rb +33 -0
  46. data/lib/fog/compute/terremark/requests/get_catalog.rb +30 -0
  47. data/lib/fog/compute/terremark/requests/get_catalog_item.rb +33 -0
  48. data/lib/fog/compute/terremark/requests/get_internet_services.rb +32 -0
  49. data/lib/fog/compute/terremark/requests/get_keys_list.rb +32 -0
  50. data/lib/fog/compute/terremark/requests/get_network.rb +70 -0
  51. data/lib/fog/compute/terremark/requests/get_network_ips.rb +29 -0
  52. data/lib/fog/compute/terremark/requests/get_node_services.rb +29 -0
  53. data/lib/fog/compute/terremark/requests/get_organization.rb +89 -0
  54. data/lib/fog/compute/terremark/requests/get_organizations.rb +45 -0
  55. data/lib/fog/compute/terremark/requests/get_public_ip.rb +31 -0
  56. data/lib/fog/compute/terremark/requests/get_public_ips.rb +69 -0
  57. data/lib/fog/compute/terremark/requests/get_task.rb +37 -0
  58. data/lib/fog/compute/terremark/requests/get_tasks_list.rb +30 -0
  59. data/lib/fog/compute/terremark/requests/get_vapp.rb +40 -0
  60. data/lib/fog/compute/terremark/requests/get_vapp_template.rb +33 -0
  61. data/lib/fog/compute/terremark/requests/get_vdc.rb +153 -0
  62. data/lib/fog/compute/terremark/requests/instantiate_vapp_template.rb +75 -0
  63. data/lib/fog/compute/terremark/requests/power_off.rb +33 -0
  64. data/lib/fog/compute/terremark/requests/power_on.rb +33 -0
  65. data/lib/fog/compute/terremark/requests/power_reset.rb +33 -0
  66. data/lib/fog/compute/terremark/requests/power_shutdown.rb +22 -0
  67. data/lib/fog/parsers/terremark.rb +26 -0
  68. data/lib/fog/parsers/terremark/base.rb +23 -0
  69. data/lib/fog/parsers/terremark/get_catalog.rb +31 -0
  70. data/lib/fog/parsers/terremark/get_catalog_item.rb +30 -0
  71. data/lib/fog/parsers/terremark/get_internet_services.rb +55 -0
  72. data/lib/fog/parsers/terremark/get_keys_list.rb +36 -0
  73. data/lib/fog/parsers/terremark/get_network_ips.rb +22 -0
  74. data/lib/fog/parsers/terremark/get_node_services.rb +30 -0
  75. data/lib/fog/parsers/terremark/get_organization.rb +46 -0
  76. data/lib/fog/parsers/terremark/get_organizations.rb +27 -0
  77. data/lib/fog/parsers/terremark/get_public_ips.rb +24 -0
  78. data/lib/fog/parsers/terremark/get_tasks_list.rb +33 -0
  79. data/lib/fog/parsers/terremark/get_vapp_template.rb +29 -0
  80. data/lib/fog/parsers/terremark/get_vdc.rb +85 -0
  81. data/lib/fog/parsers/terremark/instantiate_vapp_template.rb +24 -0
  82. data/lib/fog/parsers/terremark/internet_service.rb +56 -0
  83. data/lib/fog/parsers/terremark/network.rb +37 -0
  84. data/lib/fog/parsers/terremark/node_service.rb +26 -0
  85. data/lib/fog/parsers/terremark/public_ip.rb +20 -0
  86. data/lib/fog/parsers/terremark/task.rb +23 -0
  87. data/lib/fog/parsers/terremark/vapp.rb +59 -0
  88. data/lib/fog/terremark.rb +17 -0
  89. data/lib/fog/terremark/vcloud.rb +27 -0
  90. data/lib/fog/terremark/vcloud/mock.rb +24 -0
  91. data/lib/fog/terremark/vcloud/real.rb +66 -0
  92. data/lib/fog/terremark/version.rb +5 -0
  93. data/spec/minitest_helper.rb +31 -0
  94. metadata +251 -0
@@ -0,0 +1,75 @@
1
+ module Fog
2
+ module Compute
3
+ module Terremark
4
+ module Real
5
+ # Instatiate a vapp template
6
+ #
7
+ # ==== Parameters
8
+ # * name<~String>: Name of the resulting vapp .. must start with letter, up to 15 chars alphanumeric.
9
+ # * options<~Hash>:
10
+ # * cpus<~Integer>: Number of cpus in [1, 2, 4, 8], defaults to 1
11
+ # * memory<~Integer>: Amount of memory either 512 or a multiple of 1024, defaults to 512
12
+ # * vapp_template<~String>: id of the vapp template to be instantiated
13
+ # ==== Returns
14
+ # * response<~Excon::Response>:
15
+ # * body<~Hash>:
16
+ # * 'Links;<~Array> (e.g. up to vdc)
17
+ # * 'href'<~String> Link to the resulting vapp
18
+ # * 'name'<~String> - name of item
19
+ # * 'type'<~String> - type of item
20
+ # * 'status'<~String> - 0(pending) --> 2(off) -->4(on)
21
+ def instantiate_vapp_template(name, vapp_template, options = {})
22
+ raise ArgumentError.new('Name must be fewer than 15 characters') unless name.length < 15
23
+ raise ArgumentError.new("vApp Image Template is a compulsary parameter") unless vapp_template
24
+ options['ssh_key_fingerprint'] ||= default_ssh_key["FingerPrint"]
25
+ options['cpus'] ||= 1
26
+ options['memory'] ||= 512
27
+ options['network_id'] ||= default_network_id
28
+ options['vdc_id'] ||= default_vdc_id
29
+ options['primary_dns'] ||= '208.67.222.222'
30
+ options['secondary_dns'] ||= '208.67.220.220'
31
+
32
+ data = <<-DATA
33
+ <?xml version="1.0" encoding="UTF-8"?>
34
+ <InstantiateVAppTemplateParams name="#{name}" xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://services.vcloudexpress.terremark.com/api/v0.8/ns/vcloud.xsd">
35
+ <VAppTemplate href="#{@scheme}://#{@host}/#{@path}/vAppTemplate/#{vapp_template}" />
36
+ <InstantiationParams xmlns:vmw="http://www.vmware.com/schema/ovf">
37
+ <ProductSection xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:q1="http://www.vmware.com/vcloud/v0.8">
38
+ <Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="primaryDNS" ovf:value="#{options['primary_dns']}" />
39
+ <Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="secondaryDNS" ovf:value="#{options['secondary_dns']}" />
40
+ <Property xmlns="http://schemas.dmtf.org/ovf/envelope/1" ovf:key="sshKeyFingerprint" ovf:value="#{options['ssh_key_fingerprint']}" />
41
+ </ProductSection>
42
+ <VirtualHardwareSection xmlns:q1="http://www.vmware.com/vcloud/v0.8">
43
+ <Item xmlns="http://schemas.dmtf.org/ovf/envelope/1">
44
+ <InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID>
45
+ <ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType>
46
+ <VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">#{options['cpus']}</VirtualQuantity>
47
+ </Item>
48
+ <Item xmlns="http://schemas.dmtf.org/ovf/envelope/1">
49
+ <InstanceID xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID>
50
+ <ResourceType xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType>
51
+ <VirtualQuantity xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">#{options['memory']}</VirtualQuantity>
52
+ </Item>
53
+ </VirtualHardwareSection>
54
+ <NetworkConfigSection>
55
+ <NetworkConfig>
56
+ <NetworkAssociation href="#{@scheme}://#{@host}/#{@path}/network/#{options['network_id']}"/>
57
+ </NetworkConfig>
58
+ </NetworkConfigSection>
59
+ </InstantiationParams>
60
+ </InstantiateVAppTemplateParams>
61
+ DATA
62
+
63
+ request(
64
+ :body => data,
65
+ :expects => 200,
66
+ :headers => { 'Content-Type' => 'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml' },
67
+ :method => 'POST',
68
+ :parser => Fog::Parsers::Terremark::InstantiateVappTemplate.new,
69
+ :path => "vdc/#{options['vdc_id']}/action/instantiatevAppTemplate"
70
+ )
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,33 @@
1
+ module Fog
2
+ module Compute
3
+ module Terremark
4
+ module Real
5
+ # Power off a vapp
6
+ #
7
+ # ==== Parameters
8
+ # * vapp_id<~Integer> - Id of vapp to power off
9
+ #
10
+ # ==== Returns
11
+ # * response<~Excon::Response>:
12
+ # * body<~Hash>:
13
+ # * 'endTime'<~String> - endTime of task
14
+ # * 'href'<~String> - link to task
15
+ # * 'startTime'<~String> - startTime of task
16
+ # * 'status'<~String> - status of task
17
+ # * 'type'<~String> - type of task
18
+ # * 'Owner'<~String> -
19
+ # * 'href'<~String> - href of owner
20
+ # * 'name'<~String> - name of owner
21
+ # * 'type'<~String> - type of owner
22
+ def power_off(vapp_id)
23
+ request(
24
+ :expects => 202,
25
+ :method => 'POST',
26
+ :parser => Fog::Parsers::Terremark::Task.new,
27
+ :path => "vApp/#{vapp_id}/power/action/powerOff"
28
+ )
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ module Fog
2
+ module Compute
3
+ module Terremark
4
+ module Real
5
+ # Power on a vapp
6
+ #
7
+ # ==== Parameters
8
+ # * vapp_id<~Integer> - Id of vapp to power on
9
+ #
10
+ # ==== Returns
11
+ # * response<~Excon::Response>:
12
+ # * body<~Hash>:
13
+ # * 'endTime'<~String> - endTime of task
14
+ # * 'href'<~String> - link to task
15
+ # * 'startTime'<~String> - startTime of task
16
+ # * 'status'<~String> - status of task
17
+ # * 'type'<~String> - type of task
18
+ # * 'Owner'<~String> -
19
+ # * 'href'<~String> - href of owner
20
+ # * 'name'<~String> - name of owner
21
+ # * 'type'<~String> - type of owner
22
+ def power_on(vapp_id)
23
+ request(
24
+ :expects => 202,
25
+ :method => 'POST',
26
+ :parser => Fog::Parsers::Terremark::Task.new,
27
+ :path => "vApp/#{vapp_id}/power/action/powerOn"
28
+ )
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ module Fog
2
+ module Compute
3
+ module Terremark
4
+ module Real
5
+ # Reset a vapp
6
+ #
7
+ # ==== Parameters
8
+ # * vapp_id<~Integer> - Id of vapp to reset
9
+ #
10
+ # ==== Returns
11
+ # * response<~Excon::Response>:
12
+ # * body<~Hash>:
13
+ # * 'endTime'<~String> - endTime of task
14
+ # * 'href'<~String> - link to task
15
+ # * 'startTime'<~String> - startTime of task
16
+ # * 'status'<~String> - status of task
17
+ # * 'type'<~String> - type of task
18
+ # * 'Owner'<~String> -
19
+ # * 'href'<~String> - href of owner
20
+ # * 'name'<~String> - name of owner
21
+ # * 'type'<~String> - type of owner
22
+ def power_reset(vapp_id)
23
+ request(
24
+ :expects => 202,
25
+ :method => 'POST',
26
+ :parser => Fog::Parsers::Terremark::Task.new,
27
+ :path => "vApp/#{vapp_id}/power/action/reset"
28
+ )
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ module Fog
2
+ module Compute
3
+ module Terremark
4
+ module Real
5
+ # Shutdown a vapp
6
+ #
7
+ # ==== Parameters
8
+ # * vapp_id<~Integer> - Id of vapp to shutdown
9
+ #
10
+ # ==== Returns
11
+ # Nothing
12
+ def power_shutdown(vapp_id)
13
+ request(
14
+ :expects => 204,
15
+ :method => 'POST',
16
+ :path => "vApp/#{vapp_id}/power/action/shutdown"
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ autoload :Base, 'fog/parsers/terremark/base'
5
+ autoload :GetCatalog, 'fog/parsers/terremark/get_catalog'
6
+ autoload :GetCatalogItem, 'fog/parsers/terremark/get_catalog_item'
7
+ autoload :GetInternetServices, 'fog/parsers/terremark/get_internet_services'
8
+ autoload :GetKeysList, 'fog/parsers/terremark/get_keys_list'
9
+ autoload :GetNetworkIps, 'fog/parsers/terremark/get_network_ips'
10
+ autoload :GetNodeServices, 'fog/parsers/terremark/get_node_services'
11
+ autoload :GetOrganization, 'fog/parsers/terremark/get_organization'
12
+ autoload :GetOrganizations, 'fog/parsers/terremark/get_organizations'
13
+ autoload :GetPublicIps, 'fog/parsers/terremark/get_public_ips'
14
+ autoload :GetTasksList, 'fog/parsers/terremark/get_tasks_list'
15
+ autoload :GetVappTemplate, 'fog/parsers/terremark/get_vapp_template'
16
+ autoload :GetVdc, 'fog/parsers/terremark/get_vdc'
17
+ autoload :InstantiateVappTemplate, 'fog/parsers/terremark/instantiate_vapp_template'
18
+ autoload :InternetService, 'fog/parsers/terremark/internet_service'
19
+ autoload :Network, 'fog/parsers/terremark/network'
20
+ autoload :NodeService, 'fog/parsers/terremark/node_service'
21
+ autoload :PublicIp, 'fog/parsers/terremark/public_ip'
22
+ autoload :Task, 'fog/parsers/terremark/task'
23
+ autoload :Vapp, 'fog/parsers/terremark/vapp'
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,23 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ class Base < Fog::Parsers::Base
5
+ def extract_attributes(attributes_xml)
6
+ attributes = {}
7
+ until attributes_xml.empty?
8
+ if attributes_xml.first.is_a?(Array)
9
+ until attributes_xml.first.empty?
10
+ attribute = attributes_xml.first.shift
11
+ attributes[attribute.localname] = attribute.value
12
+ end
13
+ else
14
+ attribute = attributes_xml.shift
15
+ attributes[attribute.localname] = attribute.value
16
+ end
17
+ end
18
+ attributes
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ class GetCatalog < Base
5
+ def reset
6
+ @response = { 'CatalogItems' => [] }
7
+ end
8
+
9
+ def start_element(name, attributes)
10
+ super
11
+ case name
12
+ when 'CatalogItem'
13
+ catalog_item = extract_attributes(attributes)
14
+ catalog_item["id"] = catalog_item["href"].split('/').last
15
+ @response['CatalogItems'] << catalog_item
16
+
17
+ when 'Catalog'
18
+ catalog = extract_attributes(attributes)
19
+ @response['name'] = catalog['name']
20
+ end
21
+ end
22
+
23
+ def end_element(name)
24
+ if name == 'Description'
25
+ @response[name] = value
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ class GetCatalogItem < Base
5
+ def reset
6
+ @response = { 'Entity' => {}, 'Properties' => {} }
7
+ end
8
+
9
+ def start_element(name, attributes)
10
+ super
11
+ case name
12
+ when 'Entity'
13
+ @response['Entity'] = extract_attributes(attributes)
14
+ when 'CatalogItem'
15
+ catalog_item = extract_attributes(attributes)
16
+ @response['name'] = catalog_item['name']
17
+ when 'Property'
18
+ @property_key = attributes.value
19
+ end
20
+ end
21
+
22
+ def end_element(name)
23
+ if name == 'Property'
24
+ @response['Properties'][@property_key] = value
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,55 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ class GetInternetServices < Base
5
+ def reset
6
+ @in_public_ip_address = false
7
+ @internet_service = {}
8
+ @response = { 'InternetServices' => [] }
9
+ end
10
+
11
+ def start_element(name, attributes)
12
+ super
13
+ case name
14
+ when 'PublicIpAddress'
15
+ @in_public_ip_address = true
16
+ end
17
+ end
18
+
19
+ def end_element(name)
20
+ case name
21
+ when 'Description', 'Protocol'
22
+ @internet_service[name] = value
23
+ when 'Enabled'
24
+ if value == 'true'
25
+ @internet_service[name] = true
26
+ else
27
+ @internet_service[name] = false
28
+ end
29
+ when 'Href', 'Name'
30
+ if @in_public_ip_address
31
+ @internet_service['PublicIpAddress'] ||= {}
32
+ @internet_service['PublicIpAddress'][name] = value
33
+ else
34
+ @internet_service[name] = value
35
+ end
36
+ when 'Id'
37
+ if @in_public_ip_address
38
+ @internet_service['PublicIpAddress'] ||= {}
39
+ @internet_service['PublicIpAddress'][name] = value.to_i
40
+ else
41
+ @internet_service[name] = value.to_i
42
+ end
43
+ when 'InternetService'
44
+ @response['InternetServices'] << @internet_service
45
+ @internet_service = {}
46
+ when 'Port', 'Timeout'
47
+ @internet_service[name] = value.to_i
48
+ when 'PublicIpAddress'
49
+ @in_public_ip_address = false
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,36 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ class GetKeysList < Base
5
+ def reset
6
+ @response = { 'Keys' => [] }
7
+ @key = {}
8
+ end
9
+
10
+ def start_element(name, attributes)
11
+ super
12
+ case name
13
+ when 'Id', 'Href', 'Name', 'IsDefault','FingerPrint'
14
+ data = extract_attributes(attributes)
15
+ @key[name] = data
16
+ when 'Key'
17
+ @key = extract_attributes(attributes)
18
+ when 'Keys'
19
+ keys_list = extract_attributes(attributes)
20
+ @response['href'] = keys_list['href']
21
+ end
22
+ end
23
+
24
+ def end_element(name)
25
+ case name
26
+ when 'Id', 'Href', 'Name', 'IsDefault','FingerPrint'
27
+ @key[name] = value
28
+ when 'Key'
29
+ @response['Keys'] << @key
30
+ @key = {}
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,22 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ class GetNetworkIps< Base
5
+ def reset
6
+ @ip_address = {}
7
+ @response = { 'IpAddresses' => [] }
8
+ end
9
+
10
+ def end_element(name)
11
+ case name
12
+ when 'Name', 'Status', 'Server'
13
+ @ip_address[name.downcase] = value
14
+ when 'IpAddress'
15
+ @response['IpAddresses'] << @ip_address
16
+ @ip_address = {}
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ class GetNodeServices < Base
5
+ def reset
6
+ @node_service = {}
7
+ @response = { 'NodeServices' => [] }
8
+ end
9
+
10
+ def end_element(name)
11
+ case name
12
+ when 'Description', 'Href', 'Name', 'IpAddress'
13
+ @node_service[name] = value
14
+ when 'Enabled'
15
+ if value == 'true'
16
+ @node_service[name] = true
17
+ else
18
+ @node_service[name] = false
19
+ end
20
+ when 'Id', 'Port'
21
+ @node_service[name] = value.to_i
22
+ when 'NodeService'
23
+ @response['NodeServices'] << @node_service
24
+ @node_service = {}
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end