fog 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
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
data/Rakefile CHANGED
@@ -233,6 +233,7 @@ task :changelog do
233
233
  'Dylan Egan',
234
234
  'geemus',
235
235
  'Henry Addison',
236
+ 'Kevin Menard',
236
237
  'Lincoln Stoll',
237
238
  'Luqman Amjad',
238
239
  'Michael Zeng',
@@ -1,3 +1,94 @@
1
+ 1.3.0 03/21/2012 f78afe98242a60ae4dbbfcd8c5ab67ba71c6d773
2
+ =========================================================
3
+
4
+ Stats! { 'collaborators' => 32, 'downloads' => 513974, 'forks' => 387, 'open_issues' => 24, 'watchers' => 1893 }
5
+
6
+ MVP! Decklin Foster
7
+
8
+ [aws|cloud_watch]
9
+ GitHub Edit! s/prodide/provide/ :v:. thanks Dylan Egan
10
+
11
+ [aws|simpledb]
12
+ fix region/host for us-east-1. thanks geemus
13
+
14
+ [ibm]
15
+ Added Mocking and Tests. thanks Carl Hicks
16
+ Moar convenience methods for servers. thanks Carl Hicks
17
+ Update model for Volume. thanks Carl Hicks
18
+ Added request tests for addresses. thanks Carl Hicks
19
+ Initial IBM SmartCloud support. thanks Decklin Foster
20
+ Add Location model and requests. thanks Decklin Foster
21
+ Rename collection requests get->list so we have get_foo and list_foos. thanks Decklin Foster
22
+ Don't need json_body, so we can simplify requests; remove unused params. thanks Decklin Foster
23
+ Pass optional params to requests with hashes. thanks Decklin Foster
24
+ Add a InstanceType model, returned as part of Images. thanks Decklin Foster
25
+ Rename model test files into compute, storage dirs. thanks Decklin Foster
26
+ Remove trailing whitespace. thanks Decklin Foster
27
+ Update tests to match model arguments (attribs hash) and lower-level request methods. thanks Decklin Foster
28
+ Update mocks to reflect moving volume models from from compute to storage. thanks Decklin Foster
29
+ Add some missing mocks, fix list_instances. thanks Decklin Foster
30
+ Raise NotFound in mock instead of returning a 404. thanks Decklin Foster
31
+ Fix form_encode to stringify args (e.g. booleans) to URI.escape. thanks Decklin Foster
32
+ Typos in state names and status vs. state. thanks Decklin Foster
33
+ Fix key model for passing public_key, add setting/testing whether key is default. thanks Decklin Foster
34
+ Setting default key returns success, not key name. thanks Decklin Foster
35
+ Typo, assignment instead of equality, made some tests incorrectly pass. thanks Decklin Foster
36
+ Flesh out modify_instance and modify_key for different modes. thanks Decklin Foster
37
+ Restarting should return success, changing expiration should only return time. thanks Decklin Foster
38
+ Delete instance mock should return success. thanks Decklin Foster
39
+ Remove IBM from flavors tests. thanks Decklin Foster
40
+ Make names used in tests unique using current time. thanks Decklin Foster
41
+ Add vlan_id attrib so that it can be used in creating an instance. thanks Decklin Foster
42
+ Return nil for public_hostname if primary_ip unset (e.g. state is Failed). thanks Decklin Foster
43
+ Change default location and image ID. thanks Decklin Foster
44
+ Rename ibm_user_id -> ibm_username. thanks Decklin Foster
45
+ Create temporary keys in tests that need to create instances. thanks Decklin Foster
46
+ servers are not sorted, don't assume we can just take the last. thanks Decklin Foster
47
+ create_image should do a PUT, not a POST, and needs 'state' param. thanks Decklin Foster
48
+ Correct spelling of test volume format ('RAW') and fix parameter typo. thanks Decklin Foster
49
+ Rename data -> body. thanks Decklin Foster
50
+ Don't reboot or immediately expire, interferes with other tests. thanks Decklin Foster
51
+ Use Raleigh location for tests. thanks Decklin Foster
52
+ Nullable formats for attributes that may not be returned. thanks Decklin Foster
53
+ Set expire a few seconds in the future since it takes a while to process. thanks Decklin Foster
54
+ Return nil if instance_id is nil. thanks Decklin Foster
55
+ Can't access Fog::Compute::IBM::Location class from here, just check if ID returned. thanks Decklin Foster
56
+ servers.length will include already existing servers. thanks Decklin Foster
57
+ Add state and ready? method to Image. thanks Decklin Foster
58
+ Change public key format. thanks Decklin Foster
59
+ vlan is part of primaryIP. thanks Decklin Foster
60
+ Rename root_only -> is_mini_ephemeral. thanks Decklin Foster
61
+ Description is mandatory. thanks Decklin Foster
62
+ Wait for instance to be ready before deleting it or creating image. thanks Decklin Foster
63
+ Add state/ready? methods for Address. thanks Decklin Foster
64
+ Expiration time should be epoch in ms. thanks Decklin Foster
65
+ launched_at convenience method. thanks Decklin Foster
66
+ Don't set server to nil. thanks Decklin Foster
67
+ Set a longer timeout on all wait_for calls. thanks Decklin Foster
68
+ Generated key needs different name, supplied key only returns success. thanks Decklin Foster
69
+ Invalid instance creation will return a 412 and thus raise PreconditionFailed. thanks Decklin Foster
70
+ Don't calculate expiration time until ready to make the request. thanks Decklin Foster
71
+ Fix volume formats and mocks. thanks Decklin Foster
72
+ Wait for volume to be ready before deleting. thanks Decklin Foster
73
+ Mark volume attach/detach pending, won't create instance. thanks Decklin Foster
74
+ Return pending if provisioning times out in the real tests. thanks Decklin Foster
75
+ adding documentation. thanks Wyatt Walter
76
+ add bin helpers for storage. thanks geemus
77
+
78
+ [misc]
79
+ ovirt added support for 'set vm ticket'. This api call is needed for openning a console to the server. thanks Amos Benari
80
+ wrangled security tests into working. thanks Eric Stonfer
81
+ Changes to the security group handling: * CreateSecurityGroup now includes the group id in the reply, this patch makes the code store this * The patch also changes the delete call to use the group id if present (since you must use the id when deleting VPC groups). thanks MaF
82
+ Changes to the security group handling: * CreateSecurityGroup now includes the group id in the reply, this patch makes the code store this * The patch also changes the delete call to use the group id if present (since you must use the id when deleting VPC groups) * Fix teh security group mock and test code to handle this new behavior. thanks MaF
83
+ Removed merge commit. thanks MaF
84
+
85
+ [release]
86
+ add Kevin Menard to future MVP exclusion list. thanks geemus
87
+
88
+ [storage|aws]
89
+ fix hardcoded host in get_object_http(s)_url methods. thanks geemus
90
+
91
+
1
92
  1.2.0 03/19/2012 70e0f48fa446dbf233ae31c4f055eb26ea2dadd1
2
93
  =========================================================
3
94
 
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  ## If your rubyforge_project name is different, then edit it and comment out
7
7
  ## the sub! line in the Rakefile
8
8
  s.name = 'fog'
9
- s.version = '1.2.0'
10
- s.date = '2012-03-19'
9
+ s.version = '1.3.0'
10
+ s.date = '2012-03-21'
11
11
  s.rubyforge_project = 'fog'
12
12
 
13
13
  ## Make sure your summary is short. The description may be as long
@@ -54,7 +54,7 @@ Gem::Specification.new do |s|
54
54
  s.add_development_dependency('rdoc')
55
55
  s.add_development_dependency('thor')
56
56
  s.add_development_dependency('rspec', '~>1.3.1')
57
- s.add_development_dependency('rbovirt', '>=0.0.8')
57
+ s.add_development_dependency('rbovirt', '>=0.0.9')
58
58
  s.add_development_dependency('shindo', '~>0.3.4')
59
59
  s.add_development_dependency('virtualbox', '~>0.9.1')
60
60
  s.add_development_dependency('fission')
data/lib/fog.rb CHANGED
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), 'fog', 'core')
3
3
  module Fog
4
4
 
5
5
  unless const_defined?(:VERSION)
6
- VERSION = '1.2.0'
6
+ VERSION = '1.3.0'
7
7
  end
8
8
 
9
9
  end
@@ -117,6 +117,7 @@ module Fog
117
117
  @data ||= Hash.new do |hash, region|
118
118
  hash[region] = Hash.new do |region_hash, key|
119
119
  owner_id = Fog::AWS::Mock.owner_id
120
+ security_group_id = Fog::AWS::Mock.security_group_id
120
121
  region_hash[key] = {
121
122
  :deleted_at => {},
122
123
  :addresses => {},
@@ -135,25 +136,25 @@ module Fog
135
136
  'default' => {
136
137
  'groupDescription' => 'default group',
137
138
  'groupName' => 'default',
138
- 'groupId' => 'sg-11223344',
139
+ 'groupId' => security_group_id,
139
140
  'ipPermissionsEgress' => [],
140
141
  'ipPermissions' => [
141
142
  {
142
- 'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
143
+ 'groups' => [{'groupName' => 'default', 'userId' => owner_id, 'groupId' => security_group_id }],
143
144
  'fromPort' => -1,
144
145
  'toPort' => -1,
145
146
  'ipProtocol' => 'icmp',
146
147
  'ipRanges' => []
147
148
  },
148
149
  {
149
- 'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
150
+ 'groups' => [{'groupName' => 'default', 'userId' => owner_id, 'groupId' => security_group_id}],
150
151
  'fromPort' => 0,
151
152
  'toPort' => 65535,
152
153
  'ipProtocol' => 'tcp',
153
154
  'ipRanges' => []
154
155
  },
155
156
  {
156
- 'groups' => [{'groupName' => 'default', 'userId' => owner_id}],
157
+ 'groups' => [{'groupName' => 'default', 'userId' => owner_id, 'groupId' => security_group_id}],
157
158
  'fromPort' => 0,
158
159
  'toPort' => 65535,
159
160
  'ipProtocol' => 'udp',
@@ -101,7 +101,11 @@ module Fog
101
101
  def destroy
102
102
  requires :name
103
103
 
104
- connection.delete_security_group(name)
104
+ if group_id.nil?
105
+ connection.delete_security_group(name)
106
+ else
107
+ connection.delete_security_group(nil, group_id)
108
+ end
105
109
  true
106
110
  end
107
111
 
@@ -195,6 +199,8 @@ module Fog
195
199
  def save
196
200
  requires :description, :name
197
201
  data = connection.create_security_group(name, description, vpc_id).body
202
+ new_attributes = data.reject {|key,value| key == 'requestId'}
203
+ merge_attributes(new_attributes)
198
204
  true
199
205
  end
200
206
 
@@ -44,7 +44,6 @@ module Fog
44
44
  def save
45
45
  requires :vpc_id, :cidr_block
46
46
  data = connection.create_subnet(vpc_id, cidr_block).body['subnetSet'].first
47
- puts data
48
47
  new_attributes = data.reject {|key,value| key == 'requestId'}
49
48
  merge_attributes(new_attributes)
50
49
  true
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+
6
+ class CreateSecurityGroup < Fog::Parsers::Base
7
+
8
+ def end_element(name)
9
+ case name
10
+ when 'return'
11
+ if value == 'true'
12
+ @response[name] = true
13
+ else
14
+ @response[name] = false
15
+ end
16
+ when 'requestId', 'groupId'
17
+ @response[name] = value
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -26,7 +26,7 @@ module Fog
26
26
  #
27
27
  def get_metric_statistics(options={})
28
28
  %w{Statistics StartTime EndTime Period MetricName Namespace}.each do |required_parameter|
29
- raise ArgumentError, "Must prodide #{required_parameter}" unless options.has_key?(required_parameter)
29
+ raise ArgumentError, "Must provide #{required_parameter}" unless options.has_key?(required_parameter)
30
30
  end
31
31
  statistics = options.delete 'Statistics'
32
32
  options.merge!(AWS.indexed_param('Statistics.member.%d', [*statistics]))
@@ -138,7 +138,7 @@ module Fog
138
138
  if !is_vpc && options['IpProtocol'] && !['tcp', 'udp', 'icmp'].include?(options['IpProtocol'])
139
139
  raise Fog::Compute::AWS::Error.new("InvalidPermission.Malformed => Unsupported IP protocol \"#{options['IpProtocol']}\" - supported: [tcp, udp, icmp]")
140
140
  end
141
- if options['IpProtocol'] && (!options['FromPort'] || !options['ToPort'])
141
+ if !is_vpc && (options['IpProtocol'] && (!options['FromPort'] || !options['ToPort']))
142
142
  raise Fog::Compute::AWS::Error.new("InvalidPermission.Malformed => TCP/UDP port (-1) out of range")
143
143
  end
144
144
  if options.has_key?('IpPermissions')
@@ -151,14 +151,14 @@ module Fog
151
151
 
152
152
  def normalize_permissions(options)
153
153
  normalized_permissions = []
154
-
155
154
  if options['SourceSecurityGroupName']
155
+ source_group_id=self.data[:security_groups][options['SourceSecurityGroupName']]['groupId']
156
156
  ['tcp', 'udp'].each do |protocol|
157
157
  normalized_permissions << {
158
158
  'ipProtocol' => protocol,
159
159
  'fromPort' => 1,
160
160
  'toPort' => 65535,
161
- 'groups' => [{'groupName' => options['SourceSecurityGroupName'], 'userId' => options['SourceSecurityGroupOwnerId'] || self.data[:owner_id]}],
161
+ 'groups' => [{'groupName' => options['SourceSecurityGroupName'], 'userId' => options['SourceSecurityGroupOwnerId'] || self.data[:owner_id], 'groupId' => source_group_id }],
162
162
  'ipRanges' => []
163
163
  }
164
164
  end
@@ -166,7 +166,7 @@ module Fog
166
166
  'ipProtocol' => 'icmp',
167
167
  'fromPort' => -1,
168
168
  'toPort' => -1,
169
- 'groups' => [{'groupName' => options['SourceSecurityGroupName'], 'userId' => options['SourceSecurityGroupOwnerId'] || self.data[:owner_id]}],
169
+ 'groups' => [{'groupName' => options['SourceSecurityGroupName'], 'userId' => options['SourceSecurityGroupOwnerId'] || self.data[:owner_id], 'groupId' => source_group_id }],
170
170
  'ipRanges' => []
171
171
  }
172
172
  elsif options['CidrIp']
@@ -179,13 +179,21 @@ module Fog
179
179
  }
180
180
  elsif options['IpPermissions']
181
181
  options['IpPermissions'].each do |permission|
182
- normalized_permissions << {
183
- 'ipProtocol' => permission['IpProtocol'],
184
- 'fromPort' => Integer(permission['FromPort']),
185
- 'toPort' => Integer(permission['ToPort']),
186
- 'groups' => (permission['Groups'] || []).map {|g| {'groupName' => g['GroupName'], 'userId' => g['UserId'] || self.data[:owner_id]} },
187
- 'ipRanges' => (permission['IpRanges'] || []).map {|r| { 'cidrIp' => r['CidrIp'] } }
188
- }
182
+ if ['tcp', 'udp', 'icmp'].include?(permission['IpProtocol'])
183
+ normalized_permissions << {
184
+ 'ipProtocol' => permission['IpProtocol'],
185
+ 'fromPort' => Integer(permission['FromPort']),
186
+ 'toPort' => Integer(permission['ToPort']),
187
+ 'groups' => (permission['Groups'] || []).map {|g| {'groupName' => g['GroupName'], 'userId' => g['UserId'] || self.data[:owner_id], 'groupId' => self.data[:security_groups][g['GroupName']]['groupId']} },
188
+ 'ipRanges' => (permission['IpRanges'] || []).map {|r| { 'cidrIp' => r['CidrIp'] } }
189
+ }
190
+ else
191
+ normalized_permissions << {
192
+ 'ipProtocol' => permission['IpProtocol'],
193
+ 'groups' => (permission['Groups'] || []).map {|g| {'groupName' => g['GroupName'], 'userId' => g['UserId'] || self.data[:owner_id], 'groupId' => self.data[:security_groups][g['GroupName']]['groupId']} },
194
+ 'ipRanges' => (permission['IpRanges'] || []).map {|r| { 'cidrIp' => r['CidrIp'] } }
195
+ }
196
+ end
189
197
  end
190
198
  end
191
199
 
@@ -3,7 +3,7 @@ module Fog
3
3
  class AWS
4
4
  class Real
5
5
 
6
- require 'fog/aws/parsers/compute/basic'
6
+ require 'fog/aws/parsers/compute/create_security_group'
7
7
 
8
8
  # Create a new security group
9
9
  #
@@ -17,6 +17,7 @@ module Fog
17
17
  # * body<~Hash>:
18
18
  # * 'requestId'<~String> - Id of request
19
19
  # * 'return'<~Boolean> - success?
20
+ # * 'groupId'<~String> - Id of created group
20
21
  #
21
22
  # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSecurityGroup.html]
22
23
  def create_security_group(name, description, vpc_id=nil)
@@ -24,8 +25,8 @@ module Fog
24
25
  'Action' => 'CreateSecurityGroup',
25
26
  'GroupName' => name,
26
27
  'GroupDescription' => description,
27
- :parser => Fog::Parsers::Compute::AWS::Basic.new,
28
- 'VpcId' => vpc_id
28
+ 'VpcId' => vpc_id,
29
+ :parser => Fog::Parsers::Compute::AWS::CreateSecurityGroup.new
29
30
  )
30
31
  end
31
32
 
@@ -48,6 +49,7 @@ module Fog
48
49
  self.data[:security_groups][name] = data
49
50
  response.body = {
50
51
  'requestId' => Fog::AWS::Mock.request_id,
52
+ 'groupId' => data['groupId'],
51
53
  'return' => true
52
54
  }
53
55
  response
@@ -71,7 +71,7 @@ module Fog
71
71
  }
72
72
  for filter_key, filter_value in filters
73
73
  if permission_key = filter_key.split('ip-permission.')[1]
74
- if permission_key == 'group-name'
74
+ if permission_key == 'group-name'
75
75
  security_group_info = security_group_info.reject{|security_group| !security_group['ipPermissions']['groups'].detect {|group| [*filter_value].include?(group['groupName'])}}
76
76
  elsif permission_key == 'group-id'
77
77
  security_group_info = security_group_info.reject{|security_group| !security_group['ipPermissions']['groups'].detect {|group| [*filter_value].include?(group['groupId'])}}
@@ -12,9 +12,9 @@ module Fog
12
12
  raise ArgumentError.new('object_name is required')
13
13
  end
14
14
  host, path = if bucket_name =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
15
- ["#{bucket_name}.s3.amazonaws.com", object_name]
15
+ ["#{bucket_name}.#{host}", object_name]
16
16
  else
17
- ['s3.amazonaws.com', "#{bucket_name}/#{object_name}"]
17
+ [@host, "#{bucket_name}/#{object_name}"]
18
18
  end
19
19
  http_url({
20
20
  :headers => {},
@@ -12,9 +12,9 @@ module Fog
12
12
  raise ArgumentError.new('object_name is required')
13
13
  end
14
14
  host, path = if bucket_name =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
15
- ["#{bucket_name}.s3.amazonaws.com", object_name]
15
+ ["#{bucket_name}.#{@host}", object_name]
16
16
  else
17
- ['s3.amazonaws.com', "#{bucket_name}/#{object_name}"]
17
+ [@host, "#{bucket_name}/#{object_name}"]
18
18
  end
19
19
  https_url({
20
20
  :headers => {},
@@ -76,7 +76,12 @@ module Fog
76
76
  @nil_string = options[:nil_string]|| 'nil'
77
77
 
78
78
  options[:region] ||= 'us-east-1'
79
- @host = options[:host] || "sdb.#{options[:region]}.amazonaws.com"
79
+ @host = options[:host] || case options[:region]
80
+ when 'us-east-1'
81
+ 'sdb.amazonaws.com'
82
+ else
83
+ "sdb.#{options[:region]}.amazonaws.com"
84
+ end
80
85
  @path = options[:path] || '/'
81
86
  @persistent = options[:persistent] || false
82
87
  @port = options[:port] || 443
@@ -64,6 +64,7 @@ require 'fog/bin/ecloud'
64
64
  require 'fog/bin/glesys'
65
65
  require 'fog/bin/go_grid'
66
66
  require 'fog/bin/google'
67
+ require 'fog/bin/ibm'
67
68
  require 'fog/bin/joyent'
68
69
  require 'fog/bin/libvirt'
69
70
  require 'fog/bin/linode'
@@ -0,0 +1,34 @@
1
+ class IBM < Fog::Bin
2
+ class << self
3
+
4
+ def class_for(key)
5
+ case key
6
+ when :compute
7
+ Fog::Compute::IBM
8
+ when :storage
9
+ Fog::Storage::IBM
10
+ else
11
+ raise ArgumentError, "Unsupported #{self} service: #{key}"
12
+ end
13
+ end
14
+
15
+ def [](service)
16
+ @@connections ||= Hash.new do |hash, key|
17
+ hash[key] = case key
18
+ when :compute
19
+ Fog::Compute.new(:provider => 'IBM')
20
+ when :storage
21
+ Fog::Storage.new(:provider => 'Storage')
22
+ else
23
+ raise ArgumentError, "Unrecognized service: #{service}"
24
+ end
25
+ end
26
+ @@connections[service]
27
+ end
28
+
29
+ def services
30
+ Fog::IBM.services
31
+ end
32
+
33
+ end
34
+ end
@@ -32,6 +32,9 @@ module Fog
32
32
  when :gogrid
33
33
  require 'fog/go_grid/compute'
34
34
  Fog::Compute::GoGrid.new(attributes)
35
+ when :ibm
36
+ require 'fog/ibm/compute'
37
+ Fog::Compute::IBM.new(attributes)
35
38
  when :joyent
36
39
  require 'fog/joyent/compute'
37
40
  Fog::Compute::Joyent.new(attributes)
@@ -84,6 +84,8 @@ An alternate file may be used by placing its path in the FOG_RC environment vari
84
84
  :libvirt_password:
85
85
  :libvirt_uri:
86
86
  :libvirt_ip_command:
87
+ :ibm_username:
88
+ :ibm_password:
87
89
  #
88
90
  # End of Fog Credentials File
89
91
  #######################################################