fog 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. data/README.rdoc +1 -1
  2. data/Rakefile +1 -0
  3. data/VERSION.yml +2 -2
  4. data/bin/fog +23 -102
  5. data/fog.gemspec +48 -2
  6. data/lib/fog.rb +17 -46
  7. data/lib/fog/aws.rb +10 -4
  8. data/lib/fog/aws/bin.rb +69 -0
  9. data/lib/fog/aws/ec2.rb +82 -86
  10. data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +20 -16
  11. data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +19 -15
  12. data/lib/fog/aws/requests/s3/get_object.rb +4 -0
  13. data/lib/fog/aws/requests/simpledb/select.rb +42 -24
  14. data/lib/fog/aws/s3.rb +28 -25
  15. data/lib/fog/aws/simpledb.rb +21 -17
  16. data/lib/fog/bin.rb +79 -0
  17. data/lib/fog/collection.rb +20 -9
  18. data/lib/fog/model.rb +9 -4
  19. data/lib/fog/rackspace.rb +10 -3
  20. data/lib/fog/rackspace/bin.rb +44 -0
  21. data/lib/fog/rackspace/files.rb +16 -9
  22. data/lib/fog/rackspace/requests/files/delete_container.rb +2 -1
  23. data/lib/fog/rackspace/requests/files/delete_object.rb +2 -1
  24. data/lib/fog/rackspace/requests/files/get_container.rb +2 -1
  25. data/lib/fog/rackspace/requests/files/get_containers.rb +2 -1
  26. data/lib/fog/rackspace/requests/files/head_container.rb +2 -1
  27. data/lib/fog/rackspace/requests/files/head_containers.rb +2 -1
  28. data/lib/fog/rackspace/requests/files/put_container.rb +2 -1
  29. data/lib/fog/rackspace/requests/files/put_object.rb +2 -1
  30. data/lib/fog/rackspace/requests/servers/get_flavor_details.rb +1 -0
  31. data/lib/fog/rackspace/requests/servers/list_flavors.rb +1 -0
  32. data/lib/fog/rackspace/requests/servers/list_flavors_detail.rb +1 -0
  33. data/lib/fog/rackspace/requests/servers/list_images.rb +0 -1
  34. data/lib/fog/rackspace/requests/servers/reboot_server.rb +2 -1
  35. data/lib/fog/rackspace/servers.rb +31 -26
  36. data/lib/fog/slicehost.rb +35 -17
  37. data/lib/fog/slicehost/bin.rb +42 -0
  38. data/lib/fog/slicehost/models/flavor.rb +41 -0
  39. data/lib/fog/slicehost/models/flavors.rb +33 -0
  40. data/lib/fog/slicehost/models/image.rb +13 -0
  41. data/lib/fog/slicehost/models/images.rb +35 -0
  42. data/lib/fog/slicehost/models/server.rb +55 -0
  43. data/lib/fog/slicehost/models/servers.rb +37 -0
  44. data/lib/fog/slicehost/parsers/get_flavor.rb +24 -0
  45. data/lib/fog/slicehost/parsers/get_image.rb +24 -0
  46. data/lib/fog/slicehost/parsers/get_slice.rb +29 -0
  47. data/lib/fog/slicehost/requests/create_slice.rb +2 -1
  48. data/lib/fog/slicehost/requests/delete_slice.rb +2 -1
  49. data/lib/fog/slicehost/requests/get_backups.rb +1 -0
  50. data/lib/fog/slicehost/requests/get_flavor.rb +42 -0
  51. data/lib/fog/slicehost/requests/get_flavors.rb +1 -0
  52. data/lib/fog/slicehost/requests/get_image.rb +40 -0
  53. data/lib/fog/slicehost/requests/get_images.rb +1 -0
  54. data/lib/fog/slicehost/requests/get_slice.rb +48 -0
  55. data/lib/fog/slicehost/requests/get_slices.rb +1 -0
  56. data/lib/fog/slicehost/requests/reboot_slice.rb +49 -0
  57. data/lib/fog/terremark.rb +71 -0
  58. data/lib/fog/terremark/bin.rb +30 -0
  59. data/lib/fog/terremark/parsers/get_catalog.rb +43 -0
  60. data/lib/fog/terremark/parsers/get_catalog_item.rb +44 -0
  61. data/lib/fog/terremark/parsers/get_organization.rb +44 -0
  62. data/lib/fog/terremark/parsers/get_organizations.rb +26 -0
  63. data/lib/fog/terremark/parsers/get_vapp_template.rb +44 -0
  64. data/lib/fog/terremark/parsers/get_vdc.rb +105 -0
  65. data/lib/fog/terremark/requests/get_catalog.rb +44 -0
  66. data/lib/fog/terremark/requests/get_catalog_item.rb +47 -0
  67. data/lib/fog/terremark/requests/get_organization.rb +46 -0
  68. data/lib/fog/terremark/requests/get_organizations.rb +42 -0
  69. data/lib/fog/terremark/requests/get_vapp_template.rb +47 -0
  70. data/lib/fog/terremark/requests/get_vdc.rb +47 -0
  71. data/spec/slicehost/models/server_spec.rb +51 -0
  72. data/spec/slicehost/models/servers_spec.rb +22 -0
  73. data/spec/slicehost/requests/get_flavor_spec.rb +24 -0
  74. data/spec/slicehost/requests/get_image_spec.rb +24 -0
  75. data/spec/slicehost/requests/get_slice_spec.rb +41 -0
  76. data/spec/slicehost/requests/get_slices_spec.rb +20 -9
  77. data/spec/slicehost/requests/reboot_slice_spec.rb +41 -0
  78. data/spec/spec_helper.rb +10 -0
  79. metadata +55 -2
@@ -0,0 +1,26 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+
5
+ class GetOrganizations < Fog::Parsers::Base
6
+
7
+ def reset
8
+ @response = { 'OrgList' => [] }
9
+ end
10
+
11
+ def start_element(name, attributes)
12
+ @value = ''
13
+ if name == 'Org'
14
+ organization = {}
15
+ until attributes.empty?
16
+ organization[attributes.shift] = attributes.shift
17
+ end
18
+ @response['OrgList'] << organization
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,44 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+
5
+ class GetVappTemplate < Fog::Parsers::Base
6
+
7
+ def reset
8
+ @property_key
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
+ vapp_template[attributes.first.first] = attributes.shift.last
26
+ else
27
+ vapp_template[attributes.shift] = attributes.shift
28
+ end
29
+ end
30
+ @response['name'] = vapp_template['name']
31
+ end
32
+ end
33
+
34
+ def end_element(name)
35
+ if name == 'Description'
36
+ @response['Description'] = @value
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,105 @@
1
+ module Fog
2
+ module Parsers
3
+ module Terremark
4
+
5
+ class GetVdc < Fog::Parsers::Base
6
+
7
+ def reset
8
+ @in_storage_capacity = false
9
+ @in_cpu = false
10
+ @in_memory = false
11
+ @in_instantiated_vms_quota = false
12
+ @in_deployed_vms_quota = false
13
+ @response = {
14
+ 'links' => [],
15
+ 'AvailableNetworks' => [],
16
+ 'ComputeCapacity' => {
17
+ 'Cpu' => {},
18
+ 'DeployedVmsQuota' => {},
19
+ 'InstantiatedVmsQuota' => {},
20
+ 'Memory' => {}
21
+ },
22
+ 'StorageCapacity' => {},
23
+ 'ResourceEntities' => {}
24
+ }
25
+ end
26
+
27
+ def start_element(name, attributes)
28
+ @value = ''
29
+ case name
30
+ when 'Cpu'
31
+ @in_cpu = true
32
+ when 'DeployedVmsQuota'
33
+ @in_deployed_vms_quota = true
34
+ when 'InstantiatedVmsQuota'
35
+ @in_instantiated_vms_quota = true
36
+ when 'Link'
37
+ link = {}
38
+ until attributes.empty?
39
+ link[attributes.shift] = attributes.shift
40
+ end
41
+ @response['links'] << link
42
+ when 'Memory'
43
+ @in_memory = true
44
+ when 'Network'
45
+ network = {}
46
+ until attributes.empty?
47
+ network[attributes.shift] = attributes.shift
48
+ end
49
+ @response['AvailableNetworks'] << network
50
+ when 'ResourceEntity'
51
+ resource_entity = {}
52
+ until attributes.empty?
53
+ resource_entity[attributes.shift] = attributes.shift
54
+ end
55
+ @response['ResourceEntity'] << resource_entity
56
+ when 'StorageCapacity'
57
+ @in_storage_capacity = true
58
+ when 'Vdc'
59
+ vdc = {}
60
+ until attributes.empty?
61
+ if attributes.first.is_a?(Array)
62
+ vdc[attributes.first.first] = attributes.shift.last
63
+ else
64
+ vdc[attributes.shift] = attributes.shift
65
+ end
66
+ end
67
+ @response['href'] = vdc['href']
68
+ @response['name'] = vdc['name']
69
+ end
70
+ end
71
+
72
+ def end_element(name)
73
+ case name
74
+ when 'Allocated', 'Limit', 'Units', 'Used'
75
+ if @in_cpu
76
+ @response['Compute Capacity']['Cpu'][name] = @value
77
+ elsif @in_deployed_vms_quota
78
+ @response['Compute Capacity']['DeployedVmsQuota'][name] = @value
79
+ elsif @in_instantiated_vms_quota
80
+ @response['Compute Capacity']['InstantiatedVmsQuota'][name] = @value
81
+ elsif @in_memory
82
+ @response['Compute Capacity']['Memory'][name] = @value
83
+ elsif @in_storage_capacity
84
+ @response['StorageCapacity'][name] = @value
85
+ end
86
+ when 'Cpu'
87
+ @in_cpu = false
88
+ when 'DeployedVmsQuota'
89
+ @in_deployed_vms_quota = false
90
+ when 'InstantiatedVmsQuota'
91
+ @in_instantiated_vms_quota = false
92
+ when 'Memory'
93
+ @in_memory = false
94
+ when 'StorageCapacity'
95
+ @in_storage_capacity = false
96
+ when 'Type'
97
+ @response[name] = @value
98
+ end
99
+ end
100
+
101
+ end
102
+
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,44 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ class Terremark
5
+
6
+ # Get details of a catalog
7
+ #
8
+ # ==== Parameters
9
+ # * vdc_id<~Integer> - Id of vdc to view catalog for
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'CatalogItems'<~Array>
15
+ # * 'href'<~String> - linke to item
16
+ # * 'name'<~String> - name of item
17
+ # * 'type'<~String> - type of item
18
+ # * 'description'<~String> - Description of catalog
19
+ # * 'name'<~String> - Name of catalog
20
+ def get_catalog(vdc_id)
21
+ request(
22
+ :expects => 200,
23
+ :method => 'GET',
24
+ :parser => Fog::Parsers::Terremark::GetCatalog.new,
25
+ :path => "vdc/#{vdc_id}/catalog"
26
+ )
27
+ end
28
+
29
+ end
30
+ end
31
+
32
+ else
33
+
34
+ module Fog
35
+ class Terremark
36
+
37
+ def get_catalog(vdc_id)
38
+ raise MockNotImplemented.new("Contributions welcome!")
39
+ end
40
+
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,47 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ class Terremark
5
+
6
+ # Get details of a catalog item
7
+ #
8
+ # ==== Parameters
9
+ # * catalog_item_id<~Integer> - Id of catalog item to lookup
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+
15
+ # FIXME
16
+
17
+ # * 'CatalogItems'<~Array>
18
+ # * 'href'<~String> - linke to item
19
+ # * 'name'<~String> - name of item
20
+ # * 'type'<~String> - type of item
21
+ # * 'description'<~String> - Description of catalog
22
+ # * 'name'<~String> - Name of catalog
23
+ def get_catalog_item(catalog_item_id)
24
+ request(
25
+ :expects => 200,
26
+ :method => 'GET',
27
+ :parser => Fog::Parsers::Terremark::GetCatalogItem.new,
28
+ :path => "catalogItem/#{catalog_item_id}"
29
+ )
30
+ end
31
+
32
+ end
33
+ end
34
+
35
+ else
36
+
37
+ module Fog
38
+ class Terremark
39
+
40
+ def get_catalog_item(catalog_item_id)
41
+ raise MockNotImplemented.new("Contributions welcome!")
42
+ end
43
+
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,46 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ class Terremark
5
+
6
+ # Get details of an organization
7
+ #
8
+ # ==== Parameters
9
+ # * organization_id<~Integer> - Id of organization to lookup
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'description'<~String> - Description of organization
15
+ # * 'links'<~Array> - An array of links to entities in the organization
16
+ # * 'href'<~String> - location of link
17
+ # * 'name'<~String> - name of link
18
+ # * 'rel'<~String> - action to perform
19
+ # * 'type'<~String> - type of link
20
+ # * 'name'<~String> - Name of organization
21
+ def get_organization(organization_id)
22
+ response = request(
23
+ :expects => 200,
24
+ :method => 'GET',
25
+ :parser => Fog::Parsers::Terremark::GetOrganization.new,
26
+ :path => "org/#{organization_id}"
27
+ )
28
+ response
29
+ end
30
+
31
+ end
32
+ end
33
+
34
+ else
35
+
36
+ module Fog
37
+ class Terremark
38
+
39
+ def get_organization(organization_id)
40
+ raise MockNotImplemented.new("Contributions welcome!")
41
+ end
42
+
43
+ end
44
+ end
45
+
46
+ end
@@ -0,0 +1,42 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ class Terremark
5
+
6
+ # Get list of organizations
7
+ #
8
+ # ==== Returns
9
+ # * response<~Excon::Response>:
10
+ # * body<~Array>:
11
+ # * 'description'<~String> - Description of organization
12
+ # * 'links'<~Array> - An array of links to entities in the organization
13
+ # * 'name'<~String> - Name of organization
14
+ def get_organizations
15
+ request({
16
+ :body => '',
17
+ :expects => 200,
18
+ :headers => {
19
+ 'Authorization' => "Basic #{Base64.encode64("#{@terremark_username}:#{@terremark_password}").chomp!}"
20
+ },
21
+ :method => 'POST',
22
+ :parser => Fog::Parsers::Terremark::GetOrganizations.new,
23
+ :path => 'login'
24
+ })
25
+ end
26
+
27
+ end
28
+ end
29
+
30
+ else
31
+
32
+ module Fog
33
+ class Terremark
34
+
35
+ def get_organizations
36
+ raise MockNotImplemented.new("Contributions welcome!")
37
+ end
38
+
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,47 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ class Terremark
5
+
6
+ # Get details of a vapp template
7
+ #
8
+ # ==== Parameters
9
+ # * vapp_template_id<~Integer> - Id of vapp template to lookup
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+
15
+ # FIXME
16
+
17
+ # * 'CatalogItems'<~Array>
18
+ # * 'href'<~String> - linke to item
19
+ # * 'name'<~String> - name of item
20
+ # * 'type'<~String> - type of item
21
+ # * 'description'<~String> - Description of catalog
22
+ # * 'name'<~String> - Name of catalog
23
+ def get_vapp_template(vapp_template_id)
24
+ request(
25
+ :expects => 200,
26
+ :method => 'GET',
27
+ :parser => Fog::Parsers::Terremark::GetVappTemplate.new,
28
+ :path => "vAppTemplate/#{vapp_template_id}"
29
+ )
30
+ end
31
+
32
+ end
33
+ end
34
+
35
+ else
36
+
37
+ module Fog
38
+ class Terremark
39
+
40
+ def get_vapp_template(vapp_template_id)
41
+ raise MockNotImplemented.new("Contributions welcome!")
42
+ end
43
+
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,47 @@
1
+ unless Fog.mocking?
2
+
3
+ module Fog
4
+ class Terremark
5
+
6
+ # Get details of a vdc
7
+ #
8
+ # ==== Parameters
9
+ # * vdc_id<~Integer> - Id of vdc to lookup
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+
15
+ # FIXME
16
+
17
+ # * 'CatalogItems'<~Array>
18
+ # * 'href'<~String> - linke to item
19
+ # * 'name'<~String> - name of item
20
+ # * 'type'<~String> - type of item
21
+ # * 'description'<~String> - Description of catalog
22
+ # * 'name'<~String> - Name of catalog
23
+ def get_vdc(vdc_id)
24
+ request(
25
+ :expects => 200,
26
+ :method => 'GET',
27
+ :parser => Fog::Parsers::Terremark::GetVdc.new,
28
+ :path => "vdc/#{vdc_id}"
29
+ )
30
+ end
31
+
32
+ end
33
+ end
34
+
35
+ else
36
+
37
+ module Fog
38
+ class Terremark
39
+
40
+ def get_vdc(vdc_id)
41
+ raise MockNotImplemented.new("Contributions welcome!")
42
+ end
43
+
44
+ end
45
+ end
46
+
47
+ end