fog 1.2.0 → 1.3.0

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 (93) hide show
  1. data/Rakefile +1 -0
  2. data/changelog.txt +91 -0
  3. data/fog.gemspec +3 -3
  4. data/lib/fog.rb +1 -1
  5. data/lib/fog/aws/compute.rb +5 -4
  6. data/lib/fog/aws/models/compute/security_group.rb +7 -1
  7. data/lib/fog/aws/models/compute/subnet.rb +0 -1
  8. data/lib/fog/aws/parsers/compute/create_security_group.rb +24 -0
  9. data/lib/fog/aws/requests/cloud_watch/get_metric_statistics.rb +1 -1
  10. data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +19 -11
  11. data/lib/fog/aws/requests/compute/create_security_group.rb +5 -3
  12. data/lib/fog/aws/requests/compute/describe_security_groups.rb +1 -1
  13. data/lib/fog/aws/requests/storage/get_object_http_url.rb +2 -2
  14. data/lib/fog/aws/requests/storage/get_object_https_url.rb +2 -2
  15. data/lib/fog/aws/simpledb.rb +6 -1
  16. data/lib/fog/bin.rb +1 -0
  17. data/lib/fog/bin/ibm.rb +34 -0
  18. data/lib/fog/compute.rb +3 -0
  19. data/lib/fog/core/errors.rb +2 -0
  20. data/lib/fog/ibm.rb +176 -0
  21. data/lib/fog/ibm/compute.rb +233 -0
  22. data/lib/fog/ibm/models/compute/address.rb +62 -0
  23. data/lib/fog/ibm/models/compute/addresses.rb +28 -0
  24. data/lib/fog/ibm/models/compute/image.rb +61 -0
  25. data/lib/fog/ibm/models/compute/images.rb +27 -0
  26. data/lib/fog/ibm/models/compute/instance-type.rb +14 -0
  27. data/lib/fog/ibm/models/compute/instance-types.rb +15 -0
  28. data/lib/fog/ibm/models/compute/key.rb +35 -0
  29. data/lib/fog/ibm/models/compute/keys.rb +35 -0
  30. data/lib/fog/ibm/models/compute/location.rb +15 -0
  31. data/lib/fog/ibm/models/compute/locations.rb +27 -0
  32. data/lib/fog/ibm/models/compute/server.rb +193 -0
  33. data/lib/fog/ibm/models/compute/servers.rb +27 -0
  34. data/lib/fog/ibm/models/storage/offering.rb +18 -0
  35. data/lib/fog/ibm/models/storage/offerings.rb +19 -0
  36. data/lib/fog/ibm/models/storage/volume.rb +95 -0
  37. data/lib/fog/ibm/models/storage/volumes.rb +27 -0
  38. data/lib/fog/ibm/requests/compute/clone_image.rb +48 -0
  39. data/lib/fog/ibm/requests/compute/create_address.rb +50 -0
  40. data/lib/fog/ibm/requests/compute/create_image.rb +56 -0
  41. data/lib/fog/ibm/requests/compute/create_instance.rb +80 -0
  42. data/lib/fog/ibm/requests/compute/create_key.rb +61 -0
  43. data/lib/fog/ibm/requests/compute/delete_address.rb +46 -0
  44. data/lib/fog/ibm/requests/compute/delete_image.rb +43 -0
  45. data/lib/fog/ibm/requests/compute/delete_instance.rb +52 -0
  46. data/lib/fog/ibm/requests/compute/delete_key.rb +41 -0
  47. data/lib/fog/ibm/requests/compute/get_image.rb +67 -0
  48. data/lib/fog/ibm/requests/compute/get_image_agreement.rb +66 -0
  49. data/lib/fog/ibm/requests/compute/get_image_manifest.rb +39 -0
  50. data/lib/fog/ibm/requests/compute/get_instance.rb +76 -0
  51. data/lib/fog/ibm/requests/compute/get_instance_logs.rb +25 -0
  52. data/lib/fog/ibm/requests/compute/get_key.rb +49 -0
  53. data/lib/fog/ibm/requests/compute/get_location.rb +55 -0
  54. data/lib/fog/ibm/requests/compute/get_request.rb +78 -0
  55. data/lib/fog/ibm/requests/compute/list_address_offerings.rb +58 -0
  56. data/lib/fog/ibm/requests/compute/list_addresses.rb +53 -0
  57. data/lib/fog/ibm/requests/compute/list_images.rb +58 -0
  58. data/lib/fog/ibm/requests/compute/list_instances.rb +57 -0
  59. data/lib/fog/ibm/requests/compute/list_keys.rb +57 -0
  60. data/lib/fog/ibm/requests/compute/list_locations.rb +37 -0
  61. data/lib/fog/ibm/requests/compute/list_vlans.rb +52 -0
  62. data/lib/fog/ibm/requests/compute/modify_instance.rb +71 -0
  63. data/lib/fog/ibm/requests/compute/modify_key.rb +52 -0
  64. data/lib/fog/ibm/requests/storage/create_volume.rb +66 -0
  65. data/lib/fog/ibm/requests/storage/delete_volume.rb +42 -0
  66. data/lib/fog/ibm/requests/storage/get_volume.rb +72 -0
  67. data/lib/fog/ibm/requests/storage/list_offerings.rb +76 -0
  68. data/lib/fog/ibm/requests/storage/list_volumes.rb +47 -0
  69. data/lib/fog/ibm/storage.rb +82 -0
  70. data/lib/fog/ovirt/compute.rb +1 -0
  71. data/lib/fog/ovirt/models/compute/server.rb +5 -0
  72. data/lib/fog/ovirt/requests/compute/vm_ticket.rb +21 -0
  73. data/lib/fog/providers.rb +1 -0
  74. data/lib/fog/storage.rb +3 -0
  75. data/tests/aws/requests/compute/security_group_tests.rb +37 -39
  76. data/tests/compute/helper.rb +4 -0
  77. data/tests/compute/models/flavors_tests.rb +1 -1
  78. data/tests/helper.rb +1 -1
  79. data/tests/helpers/mock_helper.rb +2 -0
  80. data/tests/ibm/models/compute/image_tests.rb +10 -0
  81. data/tests/ibm/models/compute/key_tests.rb +23 -0
  82. data/tests/ibm/models/compute/keys_tests.rb +35 -0
  83. data/tests/ibm/models/compute/locations_tests.rb +18 -0
  84. data/tests/ibm/models/compute/server_tests.rb +88 -0
  85. data/tests/ibm/models/compute/servers_tests.rb +37 -0
  86. data/tests/ibm/models/storage/volume_tests.rb +60 -0
  87. data/tests/ibm/requests/compute/address_tests.rb +44 -0
  88. data/tests/ibm/requests/compute/image_tests.rb +110 -0
  89. data/tests/ibm/requests/compute/instance_tests.rb +102 -0
  90. data/tests/ibm/requests/compute/key_tests.rb +50 -0
  91. data/tests/ibm/requests/compute/location_tests.rb +28 -0
  92. data/tests/ibm/requests/storage/volume_tests.rb +100 -0
  93. metadata +122 -43
@@ -0,0 +1,49 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Returns details of key by name specified
7
+ #
8
+ # ==== Parameters
9
+ # 'key_name'<~String>: name of key to request
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'keyName'<~String>: Name of key
15
+ # * 'lastModifiedTime'<~Integer>: epoch time of last modification
16
+ # * 'default'<~Bool>: bool if key is default for user
17
+ # * 'instanceIds'<~Array>: list of instances associated with key
18
+ # * 'keyMaterial'<~String>: public key
19
+ def get_key(key_name)
20
+ request(
21
+ :method => 'GET',
22
+ :expects => 200,
23
+ :path => "/keys/#{key_name}"
24
+ )
25
+ end
26
+
27
+ end
28
+
29
+ class Mock
30
+
31
+ def get_key(key_name)
32
+ response = Excon::Response.new
33
+ if key_exists? key_name
34
+ response.status = 200
35
+ response.body = self.data[:keys][key_name]
36
+ else
37
+ response.status = 404
38
+ end
39
+ response
40
+ end
41
+
42
+ def key_exists?(name)
43
+ self.data[:keys].key? name
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,55 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Get a location
7
+ #
8
+ # ==== Parameters
9
+ # * location_id<~String> - Id of location
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'name'<~String>: location name
15
+ # * 'location'<~String>:
16
+ # * 'capabilities'<~Array>:
17
+ # * 'oss.storage.format'<~Hash>:
18
+ # * 'entries'<~Array>: list of supported volume formats
19
+ # * 'oss.instance.spec.i386'<~Array>: unsure.. returns empty array
20
+ # * 'oss.instance.spec.x86_64'<~Array>: unsure.. returns empty array
21
+ # * 'oss.storage.availabilityarea'<~Array>: availability area unsupported
22
+ # * 'id'<~String>: id of location
23
+ # * 'description'<~String>: description including geographic location
24
+ # * 'state'<~String>: state of datacenter
25
+ def get_location(location_id)
26
+ request(
27
+ :method => 'GET',
28
+ :expects => 200,
29
+ :path => "/locations/#{location_id}"
30
+ )
31
+ end
32
+
33
+ end
34
+
35
+ class Mock
36
+
37
+ def get_location(location_id)
38
+ response = Excon::Response.new
39
+ if location_exists? location_id
40
+ response.status = 200
41
+ response.body = self.data[:locations][location_id]
42
+ else
43
+ response.status = 404
44
+ end
45
+ response
46
+ end
47
+
48
+ def location_exists?(location_id)
49
+ self.data[:locations].key? location_id
50
+ end
51
+
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,78 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Returns list of instances created with request specified by request_id
7
+ #
8
+ # ==== Parameters
9
+ # * request_id<~String> - Id of request
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * instances<~Array>: array of instances created with request
15
+ # * 'name'<~String>: instance name
16
+ # * 'location'<~String>: instance location id
17
+ # * 'keyName'<~String>: instance assigned keypair
18
+ # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname
19
+ # * 'productCodes'<~Array>: associated product codes
20
+ # * 'requestId'<~String>:
21
+ # * 'imageId'<~String>:
22
+ # * 'launchTime'<~Integer>: UNIX time integer representing when the instance was launched
23
+ # * 'id'<~String>: instance id
24
+ # * 'volumes'<~Array>:
25
+ # * 'isMiniEphemeral'<~Boolean>: minimal local storage
26
+ # * 'instanceType'<~String>: instance type
27
+ # * 'diskSize'<~String>: instance disk size
28
+ # * 'requestName'<~String>: instance request name
29
+ # * 'secondaryIP'<~Array>: additional IP Addresses associated with this instance
30
+ # * 'status'<~Integer>: instance status flag
31
+ # * 'software'<~Array>: Software associated with this instance
32
+ # * 'application'<~Hash>: Application name, type, and version (primarily OS information)
33
+ # * 'expirationTime'<~Integer>: UNIX timestamp representing when the instance expires
34
+ # * 'owner'<~String>: instance owner
35
+ def get_request(request_id)
36
+ request(
37
+ :expects => 200,
38
+ :method => 'GET',
39
+ :path => "computecloud/enterprise/api/rest/20100331/requests/#{request_id}"
40
+ )
41
+ end
42
+
43
+ end
44
+
45
+ class Mock
46
+
47
+ def get_request(request_id)
48
+ response = Excon::Response.new
49
+ response.status = 200
50
+ response.body = {"instances"=>
51
+ [{"name"=>"test from fog",
52
+ "location"=>"101",
53
+ "keyName"=>"mykey",
54
+ "primaryIP"=>
55
+ {"type"=>0, "ip"=>"42.42.42.42 ", "hostname"=>"42.42.42.42 "},
56
+ "productCodes"=>[],
57
+ "requestId"=>"75364",
58
+ "imageId"=>"20020159",
59
+ "launchTime"=>1304012220770,
60
+ "id"=>"75064",
61
+ "volumes"=>[],
62
+ "instanceType"=>"SLV32.2/4096/60*350",
63
+ "requestName"=>"test from fog",
64
+ "secondaryIP"=>[],
65
+ "status"=>1,
66
+ "software"=>
67
+ [{"name"=>"SUSE Linux Enterprise Server",
68
+ "type"=>"OS",
69
+ "version"=>"11 SP1"}],
70
+ "expirationTime"=>1367084229205,
71
+ "owner"=>"user@example.com"}]}
72
+ response
73
+ end
74
+
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,58 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Returns the offerings of static address types/pricing for the authenticated user
7
+ #
8
+ # ==== Parameters
9
+ # No parameters
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'addresses'<~Array>: list of address offerings
15
+ # * 'price'<~Hash>: pricing info for specific address offering
16
+ # * 'price'<~Hash>: hash containing pricing information
17
+ # * 'pricePerQuantity'<~Integer>:
18
+ # * 'effectiveDate'<~Integer>: starting date price is effective
19
+ # * 'rate'<~Float>: rate per unit
20
+ # * 'countryCode'<~String>:
21
+ # * 'unitOfMeasure'<~String>:
22
+ # * 'currencyCode'<~String>: currency used
23
+ # * 'location'<~String>: datacenter location string
24
+ # * 'ipType'<~Integer>: type of ip address
25
+ # * 'id'<~String>: id of offering
26
+ def list_address_offerings
27
+ request(
28
+ :expects => 200,
29
+ :method => 'GET',
30
+ :path => '/offerings/address'
31
+ )
32
+ end
33
+
34
+ end
35
+
36
+ class Mock
37
+
38
+ def list_address_offerings
39
+ response = Excon::Response.new
40
+ response.status = 200
41
+ response.body = {"addresses"=>
42
+ [{"price"=>
43
+ {"pricePerQuantity"=>1,
44
+ "effectiveDate"=>1302566400000,
45
+ "rate"=>0.01,
46
+ "countryCode"=>"897",
47
+ "unitOfMeasure"=>"UHR",
48
+ "currencyCode"=>"USD"},
49
+ "location"=>"101",
50
+ "ipType"=>0,
51
+ "id"=>"20001223"}]}
52
+ response
53
+ end
54
+
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,53 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Returns the list of static IP addresses for current user
7
+ #
8
+ # ==== Parameters
9
+ # No parameters
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'addresses'<~Array>: list of addresses
15
+ # * 'location'<~String>: location of address
16
+ # * 'mode'<~Integer>:
17
+ # * 'offeringId'<~String>: offering ID
18
+ # * 'id'<~String>: id
19
+ # * 'type'<~Integer>: TODO unsure
20
+ # * 'ip'<~String>: IP address.. with space at the end
21
+ # * 'hostname'<~String>: seems to be same as ip
22
+ # * 'state'<~Integer>: state of address
23
+ def list_addresses
24
+ request(
25
+ :method => 'GET',
26
+ :expects => 200,
27
+ :path => '/addresses'
28
+ )
29
+ end
30
+
31
+ end
32
+
33
+ class Mock
34
+
35
+ def list_addresses
36
+ # Loop through addresses and update states and values if they aren't set
37
+ self.data[:addresses].values.each do |address|
38
+ address['state'] = 2 if address['state'] == 0
39
+ address['ip'] = Fog::IBM::Mock.ip_address if address['ip'].empty?
40
+ address['mode'] = 0 unless address.key? 'mode'
41
+ address['hostname'] = Fog::IBM::Mock.hostname unless address.key? 'hostname'
42
+ address['type'] = 1 unless address.key? 'type'
43
+ end
44
+ response = Excon::Response.new
45
+ response.status = 200
46
+ response.body = { 'addresses' => self.data[:addresses].values }
47
+ response
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,58 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Returns the list of Images available to be provisioned on the IBM DeveloperCloud.
7
+ #
8
+ # ==== Parameters
9
+ # No parameters
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'images'<~Array>: list of images
15
+ # * 'name'<~String>: image name
16
+ # * 'location'<~String>: instance location id
17
+ # * 'createdTime'<~Integer>: time created in epoch time
18
+ # * 'supportedInstanceTypes'<~Array>: list of prices per image
19
+ # * 'pricePerQuantity'<~Integer>:
20
+ # * 'effectiveDate'<~Fixnum>:
21
+ # * 'rate'<~Float>: price per unit
22
+ # * 'countryCode'<~String>:
23
+ # * 'unitOfMeasure'<~String>: unit of measurement
24
+ # * 'currencyCode'<~String>: currency billed in
25
+ # * 'productCodes'<~Array>:
26
+ # * 'id'<~String>:
27
+ # * 'documentation'<~String>: link to documentation for image
28
+ # * 'manifest'<~String>: link to xml manifest file
29
+ # * 'description'<~String>: text description of image
30
+ # * 'visibility'<~String>: status of visibilty of image. known values so far are "PUBLIC" and "PRIVATE"
31
+ # * 'platform'<~String>: operating system
32
+ # * 'architecture'<~String>: architecture supported by image
33
+ # * 'documentation'<~String>: link to documentation for image
34
+ # * 'owner'<~String>: owner of image
35
+ # * 'state'<~Integer>: state of availability of image
36
+ def list_images
37
+ request(
38
+ :method => 'GET',
39
+ :expects => 200,
40
+ :path => '/offerings/image'
41
+ )
42
+ end
43
+
44
+ end
45
+
46
+ class Mock
47
+
48
+ def list_images
49
+ response = Excon::Response.new
50
+ response.status = 200
51
+ response.body = {'images' => self.data[:images].values}
52
+ response
53
+ end
54
+
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,57 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Returns list of instances that the authenticated user manages.
7
+ #
8
+ # ==== Parameters
9
+ # No parameters
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'instances'<~Array>: list of instances
15
+ # * 'name'<~String>: instance name
16
+ # * 'location'<~String>: instance location id
17
+ # * 'keyName'<~String>: instance assigned keypair
18
+ # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname
19
+ # * 'productCodes'<~Array>: associated product codes
20
+ # * 'requestId'<~String>:
21
+ # * 'imageId'<~String>:
22
+ # * 'launchTime'<~Integer>: UNIX time integer representing when the instance was launched
23
+ # * 'id'<~String>: instance id
24
+ # * 'volumes'<~Array>:
25
+ # * 'isMiniEphemeral'<~Boolean>: minimal local storage
26
+ # * 'instanceType'<~String>: instance type
27
+ # * 'diskSize'<~String>: instance disk size
28
+ # * 'requestName'<~String>: instance request name
29
+ # * 'secondaryIP'<~Array>: additional IP Addresses associated with this instance
30
+ # * 'status'<~Integer>: instance status flag
31
+ # * 'software'<~Array>: Software associated with this instance
32
+ # * 'application'<~Hash>: Application name, type, and version (primarily OS information)
33
+ # * 'expirationTime'<~Integer>: UNIX timestamp representing when the instance expires
34
+ # * 'owner'<~String>: instance owner
35
+ def list_instances
36
+ request(
37
+ :method => 'GET',
38
+ :expects => 200,
39
+ :path => '/instances'
40
+ )
41
+ end
42
+
43
+ end
44
+
45
+ class Mock
46
+
47
+ def list_instances
48
+ response = Excon::Response.new
49
+ response.status = 200
50
+ response.body = { 'instances' => self.data[:instances].values }
51
+ response
52
+ end
53
+
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,57 @@
1
+ module Fog
2
+ module Compute
3
+ class IBM
4
+ class Real
5
+
6
+ # Returns list of instances that the authenticated user manages.
7
+ #
8
+ # ==== Parameters
9
+ # No parameters
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Hash>:
14
+ # * 'instances'<~Array>: list of instances
15
+ # * 'name'<~String>: instance name
16
+ # * 'location'<~String>: instance location id
17
+ # * 'keyName'<~String>: instance assigned keypair
18
+ # * 'primaryIP'<~Hash>: assigned ip address, type, and hostname
19
+ # * 'productCodes'<~Array>: associated product codes
20
+ # * 'requestId'<~String>:
21
+ # * 'imageId'<~String>:
22
+ # * 'launchTime'<~Integer>: UNIX time integer representing when the instance was launched
23
+ # * 'id'<~String>: instance id
24
+ # * 'volumes'<~Array>:
25
+ # * 'isMiniEphemeral'<~Boolean>: minimal local storage
26
+ # * 'instanceType'<~String>: instance type
27
+ # * 'diskSize'<~String>: instance disk size
28
+ # * 'requestName'<~String>: instance request name
29
+ # * 'secondaryIP'<~Array>: additional IP Addresses associated with this instance
30
+ # * 'status'<~Integer>: instance status flag
31
+ # * 'software'<~Array>: Software associated with this instance
32
+ # * 'application'<~Hash>: Application name, type, and version (primarily OS information)
33
+ # * 'expirationTime'<~Integer>: UNIX timestamp representing when the instance expires
34
+ # * 'owner'<~String>: instance owner
35
+ def list_keys
36
+ request(
37
+ :method => 'GET',
38
+ :expects => 200,
39
+ :path => '/keys'
40
+ )
41
+ end
42
+
43
+ end
44
+
45
+ class Mock
46
+
47
+ def list_keys
48
+ response = Excon::Response.new
49
+ response.status = 200
50
+ response.body = {'keys' => self.data[:keys].values}
51
+ response
52
+ end
53
+
54
+ end
55
+ end
56
+ end
57
+ end