fog 0.0.77 → 0.0.78

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/Gemfile.lock +2 -2
  2. data/fog.gemspec +59 -48
  3. data/lib/fog.rb +2 -1
  4. data/lib/fog/aws/models/ec2/snapshot.rb +3 -1
  5. data/lib/fog/aws/models/ec2/volume.rb +4 -2
  6. data/lib/fog/aws/s3.rb +1 -1
  7. data/lib/fog/deprecation.rb +14 -0
  8. data/lib/fog/terremark.rb +7 -220
  9. data/lib/fog/terremark/bin.rb +24 -14
  10. data/lib/fog/terremark/ecloud.rb +51 -0
  11. data/lib/fog/terremark/models/shared/address.rb +29 -0
  12. data/lib/fog/terremark/models/shared/addresses.rb +49 -0
  13. data/lib/fog/terremark/models/shared/network.rb +30 -0
  14. data/lib/fog/terremark/models/shared/networks.rb +52 -0
  15. data/lib/fog/terremark/models/shared/server.rb +57 -0
  16. data/lib/fog/terremark/models/shared/servers.rb +55 -0
  17. data/lib/fog/terremark/models/shared/task.rb +43 -0
  18. data/lib/fog/terremark/models/shared/tasks.rb +58 -0
  19. data/lib/fog/terremark/parser.rb +18 -0
  20. data/lib/fog/terremark/parsers/shared/get_catalog.rb +46 -0
  21. data/lib/fog/terremark/parsers/shared/get_catalog_item.rb +46 -0
  22. data/lib/fog/terremark/parsers/shared/get_internet_services.rb +60 -0
  23. data/lib/fog/terremark/parsers/{get_node_services.rb → shared/get_node_services.rb} +10 -11
  24. data/lib/fog/terremark/parsers/shared/get_organization.rb +47 -0
  25. data/lib/fog/terremark/parsers/shared/get_organizations.rb +27 -0
  26. data/lib/fog/terremark/parsers/shared/get_public_ips.rb +30 -0
  27. data/lib/fog/terremark/parsers/shared/get_tasks_list.rb +52 -0
  28. data/lib/fog/terremark/parsers/shared/get_vapp_template.rb +46 -0
  29. data/lib/fog/terremark/parsers/shared/get_vdc.rb +108 -0
  30. data/lib/fog/terremark/parsers/shared/instantiate_vapp_template.rb +41 -0
  31. data/lib/fog/terremark/parsers/shared/internet_service.rb +65 -0
  32. data/lib/fog/terremark/parsers/shared/network.rb +51 -0
  33. data/lib/fog/terremark/parsers/shared/node_service.rb +32 -0
  34. data/lib/fog/terremark/parsers/shared/public_ip.rb +26 -0
  35. data/lib/fog/terremark/parsers/shared/task.rb +40 -0
  36. data/lib/fog/terremark/parsers/shared/vapp.rb +47 -0
  37. data/lib/fog/terremark/requests/shared/add_internet_service.rb +63 -0
  38. data/lib/fog/terremark/requests/shared/add_node_service.rb +63 -0
  39. data/lib/fog/terremark/requests/shared/create_internet_service.rb +63 -0
  40. data/lib/fog/terremark/requests/shared/delete_internet_service.rb +42 -0
  41. data/lib/fog/terremark/requests/shared/delete_node_service.rb +42 -0
  42. data/lib/fog/terremark/requests/shared/delete_public_ip.rb +30 -0
  43. data/lib/fog/terremark/requests/shared/delete_vapp.rb +42 -0
  44. data/lib/fog/terremark/requests/shared/deploy_vapp.rb +43 -0
  45. data/lib/fog/terremark/requests/shared/get_catalog.rb +40 -0
  46. data/lib/fog/terremark/requests/shared/get_catalog_item.rb +43 -0
  47. data/lib/fog/terremark/requests/shared/get_internet_services.rb +43 -0
  48. data/lib/fog/terremark/requests/shared/get_network.rb +37 -0
  49. data/lib/fog/terremark/requests/shared/get_node_services.rb +38 -0
  50. data/lib/fog/terremark/requests/shared/get_organization.rb +42 -0
  51. data/lib/fog/terremark/requests/shared/get_organizations.rb +39 -0
  52. data/lib/fog/terremark/requests/shared/get_public_ip.rb +41 -0
  53. data/lib/fog/terremark/requests/shared/get_public_ips.rb +41 -0
  54. data/lib/fog/terremark/requests/shared/get_task.rb +47 -0
  55. data/lib/fog/terremark/requests/shared/get_tasks_list.rb +40 -0
  56. data/lib/fog/terremark/requests/shared/get_vapp.rb +50 -0
  57. data/lib/fog/terremark/requests/shared/get_vapp_template.rb +43 -0
  58. data/lib/fog/terremark/requests/shared/get_vdc.rb +43 -0
  59. data/lib/fog/terremark/requests/shared/instantiate_vapp_template.rb +79 -0
  60. data/lib/fog/terremark/requests/shared/power_off.rb +43 -0
  61. data/lib/fog/terremark/requests/shared/power_on.rb +43 -0
  62. data/lib/fog/terremark/requests/shared/reset.rb +43 -0
  63. data/lib/fog/terremark/requests/shared/shutdown.rb +43 -0
  64. data/lib/fog/terremark/shared.rb +139 -0
  65. data/lib/fog/terremark/vcloud.rb +98 -0
  66. metadata +60 -49
  67. data/lib/fog/terremark/models/server.rb +0 -56
  68. data/lib/fog/terremark/models/servers.rb +0 -53
  69. data/lib/fog/terremark/models/task.rb +0 -41
  70. data/lib/fog/terremark/models/tasks.rb +0 -56
  71. data/lib/fog/terremark/parsers/get_catalog.rb +0 -44
  72. data/lib/fog/terremark/parsers/get_catalog_item.rb +0 -44
  73. data/lib/fog/terremark/parsers/get_internet_services.rb +0 -58
  74. data/lib/fog/terremark/parsers/get_organization.rb +0 -45
  75. data/lib/fog/terremark/parsers/get_organizations.rb +0 -26
  76. data/lib/fog/terremark/parsers/get_public_ips.rb +0 -28
  77. data/lib/fog/terremark/parsers/get_tasks_list.rb +0 -50
  78. data/lib/fog/terremark/parsers/get_vapp_template.rb +0 -44
  79. data/lib/fog/terremark/parsers/get_vdc.rb +0 -106
  80. data/lib/fog/terremark/parsers/instantiate_vapp_template.rb +0 -39
  81. data/lib/fog/terremark/parsers/internet_service.rb +0 -63
  82. data/lib/fog/terremark/parsers/node_service.rb +0 -30
  83. data/lib/fog/terremark/parsers/public_ip.rb +0 -24
  84. data/lib/fog/terremark/parsers/task.rb +0 -38
  85. data/lib/fog/terremark/parsers/vapp.rb +0 -45
  86. data/lib/fog/terremark/requests/add_internet_service.rb +0 -61
  87. data/lib/fog/terremark/requests/add_node_service.rb +0 -61
  88. data/lib/fog/terremark/requests/create_internet_service.rb +0 -61
  89. data/lib/fog/terremark/requests/delete_internet_service.rb +0 -40
  90. data/lib/fog/terremark/requests/delete_node_service.rb +0 -40
  91. data/lib/fog/terremark/requests/delete_public_ip.rb +0 -28
  92. data/lib/fog/terremark/requests/delete_vapp.rb +0 -40
  93. data/lib/fog/terremark/requests/deploy_vapp.rb +0 -41
  94. data/lib/fog/terremark/requests/get_catalog.rb +0 -38
  95. data/lib/fog/terremark/requests/get_catalog_item.rb +0 -41
  96. data/lib/fog/terremark/requests/get_internet_services.rb +0 -41
  97. data/lib/fog/terremark/requests/get_node_services.rb +0 -36
  98. data/lib/fog/terremark/requests/get_organization.rb +0 -40
  99. data/lib/fog/terremark/requests/get_organizations.rb +0 -37
  100. data/lib/fog/terremark/requests/get_public_ip.rb +0 -35
  101. data/lib/fog/terremark/requests/get_public_ips.rb +0 -35
  102. data/lib/fog/terremark/requests/get_task.rb +0 -45
  103. data/lib/fog/terremark/requests/get_tasks_list.rb +0 -38
  104. data/lib/fog/terremark/requests/get_vapp.rb +0 -48
  105. data/lib/fog/terremark/requests/get_vapp_template.rb +0 -41
  106. data/lib/fog/terremark/requests/get_vdc.rb +0 -41
  107. data/lib/fog/terremark/requests/instantiate_vapp_template.rb +0 -77
  108. data/lib/fog/terremark/requests/power_off.rb +0 -41
  109. data/lib/fog/terremark/requests/power_on.rb +0 -41
  110. data/lib/fog/terremark/requests/reset.rb +0 -41
  111. data/lib/fog/terremark/requests/shutdown.rb +0 -41
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Terremark
3
+ module Shared
4
+ module Parser
5
+
6
+ def parse(data)
7
+ case data['type']
8
+ when 'application/vnd.vmware.vcloud.vApp+xml'
9
+ servers.new(data.merge!(:connection => self))
10
+ else
11
+ data
12
+ end
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetCatalog < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'CatalogItems' => [] }
10
+ end
11
+
12
+ def start_element(name, attributes)
13
+ @value = ''
14
+ case name
15
+ when 'CatalogItem'
16
+ catalog_item = {}
17
+ until attributes.empty?
18
+ catalog_item[attributes.shift] = attributes.shift
19
+ end
20
+ @response['CatalogItems'] << catalog_item
21
+ when 'Catalog'
22
+ catalog = {}
23
+ until attributes.empty?
24
+ if attributes.first.is_a?(Array)
25
+ attribute = attributes.shift
26
+ catalog[attribute.first] = attribute.last
27
+ else
28
+ catalog[attributes.shift] = attributes.shift
29
+ end
30
+ end
31
+ @response['name'] = catalog['name']
32
+ end
33
+ end
34
+
35
+ def end_element(name)
36
+ if name == 'Description'
37
+ @response[name] = @value
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetCatalogItem < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'Entity' => {}, 'Properties' => {} }
10
+ end
11
+
12
+ def start_element(name, attributes)
13
+ @value = ''
14
+ case name
15
+ when 'Entity'
16
+ until attributes.empty?
17
+ @response['Entity'][attributes.shift] = attributes.shift
18
+ end
19
+ when 'CatalogItem'
20
+ catalog_item = {}
21
+ until attributes.empty?
22
+ if attributes.first.is_a?(Array)
23
+ attribute = attributes.shift
24
+ catalog_item[attribute.first] = attribute.last
25
+ else
26
+ catalog_item[attributes.shift] = attributes.shift
27
+ end
28
+ end
29
+ @response['name'] = catalog_item['name']
30
+ when 'Property'
31
+ @property_key = attributes.last
32
+ end
33
+ end
34
+
35
+ def end_element(name)
36
+ if name == 'Property'
37
+ @response['Properties'][@property_key] = @value
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,60 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetInternetServices < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @in_public_ip_address = false
10
+ @internet_service = {}
11
+ @response = { 'InternetServices' => [] }
12
+ end
13
+
14
+ def start_element(name, attributes)
15
+ @value = ''
16
+ case name
17
+ when 'PublicIPAddress'
18
+ @in_public_ip_address = true
19
+ end
20
+ end
21
+
22
+ def end_element(name)
23
+ case name
24
+ when 'Description', 'Protocol'
25
+ @internet_service[name] = @value
26
+ when 'Enabled'
27
+ if @value == 'true'
28
+ @internet_service[name] = true
29
+ else
30
+ @internet_service[name] = false
31
+ end
32
+ when 'Href', 'Name'
33
+ if @in_public_ip_address
34
+ @internet_service['PublicIpAddress'] ||= {}
35
+ @internet_service['PublicIpAddress'][name] = @value
36
+ else
37
+ @internet_service[name] = @value
38
+ end
39
+ when 'Id'
40
+ if @in_public_ip_address
41
+ @internet_service['PublicIpAddress'] ||= {}
42
+ @internet_service['PublicIpAddress'][name] = @value.to_i
43
+ else
44
+ @internet_service[name] = @value.to_i
45
+ end
46
+ when 'InternetService'
47
+ @response['InternetServices'] << @internet_service
48
+ @internet_service = {}
49
+ when 'Port', 'Timeout'
50
+ @internet_service[name] = @value.to_i
51
+ when 'PublicIPAddress'
52
+ @in_public_ip_address = false
53
+ end
54
+ end
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,16 +1,17 @@
1
1
  module Fog
2
2
  module Parsers
3
3
  module Terremark
4
+ module Shared
4
5
 
5
- class GetNodeServices < Fog::Parsers::Base
6
+ class GetNodeServices < Fog::Parsers::Base
6
7
 
7
- def reset
8
- @node_service = {}
9
- @response = { 'NodeServices' => [] }
10
- end
8
+ def reset
9
+ @node_service = {}
10
+ @response = { 'NodeServices' => [] }
11
+ end
11
12
 
12
- def end_element(name)
13
- case name
13
+ def end_element(name)
14
+ case name
14
15
  when 'Description', 'Href', 'Name', 'IpAddress'
15
16
  @node_service[name] = @value
16
17
  when 'Enabled'
@@ -21,14 +22,12 @@ module Fog
21
22
  end
22
23
  when 'Id', 'Port'
23
24
  @node_service[name] = @value.to_i
24
- when 'NodeService'
25
- @response['NodeServices'] << @node_service
26
- @node_service = {}
25
+ end
27
26
  end
27
+
28
28
  end
29
29
 
30
30
  end
31
-
32
31
  end
33
32
  end
34
33
  end
@@ -0,0 +1,47 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetOrganization < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'Links' => [] }
10
+ end
11
+
12
+ def start_element(name, attributes)
13
+ @value = ''
14
+ case name
15
+ when 'Link'
16
+ link = {}
17
+ until attributes.empty?
18
+ link[attributes.shift] = attributes.shift
19
+ end
20
+ @response['Links'] << link
21
+ when 'Org'
22
+ org = {}
23
+ until attributes.empty?
24
+ if attributes.first.is_a?(Array)
25
+ attribute = attributes.shift
26
+ org[attribute.first] = attribute.last
27
+ else
28
+ org[attributes.shift] = attributes.shift
29
+ end
30
+ end
31
+ @response['href'] = org['href']
32
+ @response['name'] = org['name']
33
+ end
34
+ end
35
+
36
+ def end_element(name)
37
+ if name == 'Description'
38
+ @response[name] = @value
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetOrganizations < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'OrgList' => [] }
10
+ end
11
+
12
+ def start_element(name, attributes)
13
+ @value = ''
14
+ if name == 'Org'
15
+ organization = {}
16
+ until attributes.empty?
17
+ organization[attributes.shift] = attributes.shift
18
+ end
19
+ @response['OrgList'] << organization
20
+ end
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetPublicIps< Fog::Parsers::Base
7
+
8
+ def reset
9
+ @ip_address = {}
10
+ @response = { 'PublicIpAddresses' => [] }
11
+ end
12
+
13
+ def end_element(name)
14
+ case name
15
+ when 'Href', 'Name'
16
+ @ip_address[name.downcase] = @value
17
+ when 'Id'
18
+ @ip_address['id'] = @value.to_i
19
+ when 'PublicIPAddress'
20
+ @response['PublicIpAddresses'] << @ip_address
21
+ @ip_address = {}
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,52 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetTasksList < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'Tasks' => [] }
10
+ @task = {}
11
+ end
12
+
13
+ def start_element(name, attributes)
14
+ @value = ''
15
+ case name
16
+ when 'Owner', 'Result'
17
+ data = {}
18
+ until attributes.empty?
19
+ data[attributes.shift] = attributes.shift
20
+ end
21
+ @task[name] = data
22
+ when 'Task'
23
+ until attributes.empty?
24
+ @task[attributes.shift] = attributes.shift
25
+ end
26
+ when 'TasksList'
27
+ tasks_list = {}
28
+ until attributes.empty?
29
+ if attributes.first.is_a?(Array)
30
+ attribute = attributes.shift
31
+ tasks_list[attribute.first] = attribute.last
32
+ else
33
+ tasks_list[attributes.shift] = attributes.shift
34
+ end
35
+ end
36
+ @response['href'] = tasks_list['href']
37
+ end
38
+ end
39
+
40
+ def end_element(name)
41
+ if name == 'Task'
42
+ @response['Tasks'] << @task
43
+ @task = {}
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetVappTemplate < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @response = { 'Links' => [] }
10
+ end
11
+
12
+ def start_element(name, attributes)
13
+ @value = ''
14
+ case name
15
+ when 'Link'
16
+ link = {}
17
+ until attributes.empty?
18
+ link[attributes.shift] = attributes.shift
19
+ end
20
+ @response['Links'] << link
21
+ when 'VAppTemplate'
22
+ vapp_template = {}
23
+ until attributes.empty?
24
+ if attributes.first.is_a?(Array)
25
+ attribute = attributes.shift
26
+ vapp_template[attribute.first] = attribute.last
27
+ else
28
+ vapp_template[attributes.shift] = attributes.shift
29
+ end
30
+ end
31
+ @response['name'] = vapp_template['name']
32
+ end
33
+ end
34
+
35
+ def end_element(name)
36
+ if name == 'Description'
37
+ @response['Description'] = @value
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,108 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+ module Shared
5
+
6
+ class GetVdc < Fog::Parsers::Base
7
+
8
+ def reset
9
+ @in_storage_capacity = false
10
+ @in_cpu = false
11
+ @in_memory = false
12
+ @in_instantiated_vms_quota = false
13
+ @in_deployed_vms_quota = false
14
+ @response = {
15
+ 'links' => [],
16
+ 'AvailableNetworks' => [],
17
+ 'ComputeCapacity' => {
18
+ 'Cpu' => {},
19
+ 'DeployedVmsQuota' => {},
20
+ 'InstantiatedVmsQuota' => {},
21
+ 'Memory' => {}
22
+ },
23
+ 'StorageCapacity' => {},
24
+ 'ResourceEntities' => []
25
+ }
26
+ end
27
+
28
+ def start_element(name, attributes)
29
+ @value = ''
30
+ case name
31
+ when 'Cpu'
32
+ @in_cpu = true
33
+ when 'DeployedVmsQuota'
34
+ @in_deployed_vms_quota = true
35
+ when 'InstantiatedVmsQuota'
36
+ @in_instantiated_vms_quota = true
37
+ when 'Link'
38
+ link = {}
39
+ until attributes.empty?
40
+ link[attributes.shift] = attributes.shift
41
+ end
42
+ @response['links'] << link
43
+ when 'Memory'
44
+ @in_memory = true
45
+ when 'Network'
46
+ network = {}
47
+ until attributes.empty?
48
+ network[attributes.shift] = attributes.shift
49
+ end
50
+ @response['AvailableNetworks'] << network
51
+ when 'ResourceEntity'
52
+ resource_entity = {}
53
+ until attributes.empty?
54
+ resource_entity[attributes.shift] = attributes.shift
55
+ end
56
+ @response['ResourceEntities'] << resource_entity
57
+ when 'StorageCapacity'
58
+ @in_storage_capacity = true
59
+ when 'Vdc'
60
+ vdc = {}
61
+ until attributes.empty?
62
+ if attributes.first.is_a?(Array)
63
+ attribute = attributes.shift
64
+ vdc[attribute.first] = attribute.last
65
+ else
66
+ vdc[attributes.shift] = attributes.shift
67
+ end
68
+ end
69
+ @response['href'] = vdc['href']
70
+ @response['name'] = vdc['name']
71
+ end
72
+ end
73
+
74
+ def end_element(name)
75
+ case name
76
+ when 'Allocated', 'Limit', 'Units', 'Used'
77
+ if @in_cpu
78
+ @response['ComputeCapacity']['Cpu'][name] = @value
79
+ elsif @in_deployed_vms_quota
80
+ @response['ComputeCapacity']['DeployedVmsQuota'][name] = @value
81
+ elsif @in_instantiated_vms_quota
82
+ @response['ComputeCapacity']['InstantiatedVmsQuota'][name] = @value
83
+ elsif @in_memory
84
+ @response['ComputeCapacity']['Memory'][name] = @value
85
+ elsif @in_storage_capacity
86
+ @response['StorageCapacity'][name] = @value
87
+ end
88
+ when 'Cpu'
89
+ @in_cpu = false
90
+ when 'DeployedVmsQuota'
91
+ @in_deployed_vms_quota = false
92
+ when 'InstantiatedVmsQuota'
93
+ @in_instantiated_vms_quota = false
94
+ when 'Memory'
95
+ @in_memory = false
96
+ when 'StorageCapacity'
97
+ @in_storage_capacity = false
98
+ when 'Type'
99
+ @response[name] = @value
100
+ end
101
+ end
102
+
103
+ end
104
+
105
+ end
106
+ end
107
+ end
108
+ end