fog-maestrodev 1.18.0.20131209091424 → 1.18.0.20131218202447

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/.gitignore +1 -0
  2. data/CONTRIBUTING.md +22 -0
  3. data/LICENSE.md +20 -0
  4. data/README.md +29 -42
  5. data/fog.gemspec +3 -3
  6. data/lib/fog/aws/compute.rb +1 -0
  7. data/lib/fog/aws/models/compute/subnet.rb +4 -0
  8. data/lib/fog/aws/models/compute/vpc.rb +5 -0
  9. data/lib/fog/aws/models/rds/server.rb +2 -0
  10. data/lib/fog/aws/models/storage/file.rb +2 -2
  11. data/lib/fog/aws/parsers/compute/assign_private_ip_addresses.rb +25 -0
  12. data/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb +60 -0
  13. data/lib/fog/aws/requests/compute/describe_subnets.rb +8 -0
  14. data/lib/fog/aws/requests/compute/describe_vpcs.rb +8 -0
  15. data/lib/fog/cloudstack.rb +1 -1
  16. data/lib/fog/core/connection.rb +1 -2
  17. data/lib/fog/core/hmac.rb +3 -3
  18. data/lib/fog/core/mock.rb +2 -2
  19. data/lib/fog/core/wait_for.rb +1 -1
  20. data/lib/fog/core/{timeout.rb → wait_for_defaults.rb} +10 -0
  21. data/lib/fog/core.rb +1 -1
  22. data/lib/fog/google/compute.rb +19 -11
  23. data/lib/fog/google/examples/create.rb +12 -1
  24. data/lib/fog/google/examples/eric-fail.rb +13 -2
  25. data/lib/fog/google/examples/image_create.rb +0 -1
  26. data/lib/fog/google/examples/launch_micro_instance.rb +1 -2
  27. data/lib/fog/google/examples/metadata.rb +14 -2
  28. data/lib/fog/google/examples/network.rb +13 -2
  29. data/lib/fog/google/models/compute/disk.rb +10 -8
  30. data/lib/fog/google/models/compute/image.rb +8 -3
  31. data/lib/fog/google/models/compute/server.rb +19 -4
  32. data/lib/fog/google/models/compute/servers.rb +25 -9
  33. data/lib/fog/google/requests/compute/insert_disk.rb +6 -3
  34. data/lib/fog/google/requests/compute/insert_image.rb +1 -5
  35. data/lib/fog/google/requests/compute/insert_server.rb +8 -21
  36. data/lib/fog/openstack/compute.rb +3 -0
  37. data/lib/fog/openstack/models/compute/host.rb +1 -0
  38. data/lib/fog/openstack/models/compute/security_group.rb +18 -4
  39. data/lib/fog/openstack/models/compute/security_group_rule.rb +32 -0
  40. data/lib/fog/openstack/models/compute/security_group_rules.rb +22 -0
  41. data/lib/fog/openstack/network.rb +33 -3
  42. data/lib/fog/openstack/requests/compute/create_security_group.rb +3 -3
  43. data/lib/fog/openstack/requests/compute/create_security_group_rule.rb +1 -1
  44. data/lib/fog/openstack/requests/compute/create_server.rb +12 -5
  45. data/lib/fog/openstack/requests/compute/delete_security_group.rb +1 -1
  46. data/lib/fog/openstack/requests/compute/delete_security_group_rule.rb +2 -0
  47. data/lib/fog/openstack/requests/compute/get_security_group.rb +14 -24
  48. data/lib/fog/openstack/requests/compute/get_security_group_rule.rb +38 -0
  49. data/lib/fog/openstack/requests/compute/list_hosts.rb +3 -3
  50. data/lib/fog/openstack/volume.rb +3 -1
  51. data/lib/fog/rackspace/docs/auto_scale.md +9 -9
  52. data/lib/fog/rackspace/docs/getting_started.md +1 -0
  53. data/lib/fog/rackspace/docs/queues.md +312 -0
  54. data/lib/fog/vcloud_director/README.md +2 -0
  55. data/lib/fog/vcloud_director/compute.rb +78 -8
  56. data/lib/fog/vcloud_director/generators/compute/org_vdc_network.rb +91 -0
  57. data/lib/fog/vcloud_director/generators/compute/vapp.rb +30 -0
  58. data/lib/fog/vcloud_director/models/compute/vm_customization.rb +2 -0
  59. data/lib/fog/vcloud_director/parsers/compute/vm_customization.rb +2 -0
  60. data/lib/fog/vcloud_director/requests/compute/delete_network.rb +64 -0
  61. data/lib/fog/vcloud_director/requests/compute/get_execute_query.rb +433 -333
  62. data/lib/fog/vcloud_director/requests/compute/get_vapp_metadata.rb +3 -1
  63. data/lib/fog/vcloud_director/requests/compute/post_attach_disk.rb +1 -1
  64. data/lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb +83 -0
  65. data/lib/fog/vcloud_director/requests/compute/post_detach_disk.rb +1 -1
  66. data/lib/fog/vcloud_director/requests/compute/post_eject_cd_rom.rb +1 -1
  67. data/lib/fog/vcloud_director/requests/compute/post_insert_cd_rom.rb +1 -1
  68. data/lib/fog/vcloud_director/requests/compute/put_guest_customization_section_vapp.rb +1 -0
  69. data/lib/fog/vcloud_director/requests/compute/put_vapp_name_and_description.rb +37 -0
  70. data/lib/fog/vsphere/models/compute/server.rb +1 -1
  71. data/lib/fog/xenserver/compute.rb +35 -0
  72. data/lib/fog/xenserver/models/compute/blob.rb +22 -0
  73. data/lib/fog/xenserver/models/compute/blobs.rb +25 -0
  74. data/lib/fog/xenserver/models/compute/bond.rb +23 -0
  75. data/lib/fog/xenserver/models/compute/bonds.rb +25 -0
  76. data/lib/fog/xenserver/models/compute/console.rb +3 -1
  77. data/lib/fog/xenserver/models/compute/crash_dump.rb +19 -0
  78. data/lib/fog/xenserver/models/compute/crash_dumps.rb +25 -0
  79. data/lib/fog/xenserver/models/compute/dr_task.rb +17 -0
  80. data/lib/fog/xenserver/models/compute/dr_tasks.rb +25 -0
  81. data/lib/fog/xenserver/models/compute/gpu_group.rb +22 -0
  82. data/lib/fog/xenserver/models/compute/gpu_groups.rb +25 -0
  83. data/lib/fog/xenserver/models/compute/guest_metrics.rb +2 -1
  84. data/lib/fog/xenserver/models/compute/host.rb +41 -8
  85. data/lib/fog/xenserver/models/compute/host_cpu.rb +2 -1
  86. data/lib/fog/xenserver/models/compute/host_crash_dump.rb +20 -0
  87. data/lib/fog/xenserver/models/compute/host_crash_dumps.rb +25 -0
  88. data/lib/fog/xenserver/models/compute/host_metrics.rb +1 -1
  89. data/lib/fog/xenserver/models/compute/host_patch.rb +25 -0
  90. data/lib/fog/xenserver/models/compute/host_patchs.rb +25 -0
  91. data/lib/fog/xenserver/models/compute/network.rb +7 -6
  92. data/lib/fog/xenserver/models/compute/pbd.rb +3 -1
  93. data/lib/fog/xenserver/models/compute/pci.rb +22 -0
  94. data/lib/fog/xenserver/models/compute/pcis.rb +25 -0
  95. data/lib/fog/xenserver/models/compute/pgpu.rb +20 -0
  96. data/lib/fog/xenserver/models/compute/pgpus.rb +25 -0
  97. data/lib/fog/xenserver/models/compute/pif.rb +19 -8
  98. data/lib/fog/xenserver/models/compute/pif_metrics.rb +28 -0
  99. data/lib/fog/xenserver/models/compute/pifs_metrics.rb +25 -0
  100. data/lib/fog/xenserver/models/compute/pool.rb +18 -1
  101. data/lib/fog/xenserver/models/compute/pool_patch.rb +24 -0
  102. data/lib/fog/xenserver/models/compute/pool_patchs.rb +25 -0
  103. data/lib/fog/xenserver/models/compute/role.rb +19 -0
  104. data/lib/fog/xenserver/models/compute/roles.rb +25 -0
  105. data/lib/fog/xenserver/models/compute/server.rb +59 -26
  106. data/lib/fog/xenserver/models/compute/server_appliance.rb +21 -0
  107. data/lib/fog/xenserver/models/compute/server_appliances.rb +25 -0
  108. data/lib/fog/xenserver/models/compute/storage_manager.rb +28 -0
  109. data/lib/fog/xenserver/models/compute/storage_managers.rb +25 -0
  110. data/lib/fog/xenserver/models/compute/storage_repository.rb +4 -1
  111. data/lib/fog/xenserver/models/compute/tunnel.rb +20 -0
  112. data/lib/fog/xenserver/models/compute/tunnels.rb +25 -0
  113. data/lib/fog/xenserver/models/compute/vbd.rb +3 -2
  114. data/lib/fog/xenserver/models/compute/vbd_metrics.rb +1 -1
  115. data/lib/fog/xenserver/models/compute/vdi.rb +4 -1
  116. data/lib/fog/xenserver/models/compute/vif.rb +11 -2
  117. data/lib/fog/xenserver/models/compute/vlan.rb +2 -1
  118. data/lib/fog/xenserver/models/compute/vmpp.rb +35 -0
  119. data/lib/fog/xenserver/models/compute/vmpps.rb +25 -0
  120. data/lib/fog/xenserver/models/compute/vtpm.rb +18 -0
  121. data/lib/fog/xenserver/models/compute/vtpms.rb +25 -0
  122. data/tests/aws/requests/compute/assign_private_ip_tests.rb +52 -0
  123. data/tests/google/models/compute/servers_tests.rb +12 -1
  124. data/tests/google/requests/compute/image_tests.rb +0 -1
  125. data/tests/helpers/mock_helper.rb +1 -1
  126. data/tests/openstack/models/compute/security_group_tests.rb +54 -0
  127. data/tests/openstack/requests/compute/security_group_tests.rb +22 -20
  128. data/tests/openstack/requests/network/network_tests.rb +8 -8
  129. data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +17 -8
  130. data/tests/vcloud_director/requests/compute/network_tests.rb +25 -1
  131. data/tests/vcloud_director/requests/compute/query_tests.rb +67 -2
  132. metadata +125 -132
  133. checksums.yaml +0 -15
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  *.rbc
4
4
  *.sw?
5
5
  .rvmrc
6
+ .ruby-version
6
7
  .bundle
7
8
  .DS_Store
8
9
  .idea
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,22 @@
1
+ ## Getting Involved
2
+
3
+ New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
4
+
5
+ ### Coding
6
+
7
+ * Pick a task:
8
+ * Offer feedback on open [pull requests](https://github.com/fog/fog/pulls).
9
+ * Review open [issues](https://github.com/fog/fog/issues) for things to help on.
10
+ * [Create an issue](https://github.com/fog/fog/issues/new) to start a discussion on additions or features.
11
+ * Fork the project, add your changes and tests to cover them in a topic branch.
12
+ * Commit your changes and rebase against `fog/fog` to ensure everything is up to date.
13
+ * [Submit a pull request](https://github.com/fog/fog/compare/)
14
+
15
+ ### Non-Coding
16
+
17
+ * Offer feedback on open [issues](https://github.com/fog/fog/issues).
18
+ * Write and help edit [documentation](https://github.com/fog/fog.github.com).
19
+ * Translate [documentation](https://github.com/fog/fog.github.com) in to other languages.
20
+ * Organize or volunteer at events.
21
+ * [Donate](https://www.gittip.com/geemus/)
22
+ * Discuss other ideas for contribution with [geemus](mailto:geemus+fog@gmail.com).
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 [geemus (Wesley Beary)](http://github.com/geemus)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -169,45 +169,32 @@ spec.add_dependency 'fog', '~> 1.16'
169
169
  [semver]: http://semver.org/
170
170
  [pvc]: http://guides.rubygems.org/patterns/
171
171
 
172
- ## Contributing
173
-
174
- * Find something you would like to work on.
175
- * Look for anything you can help with in the [issue tracker](https://github.com/fog/fog/issues).
176
- * Look at the [code quality metrics](https://codeclimate.com/github/fog/fog) for anything you can help clean up.
177
- * Or anything else!
178
- * Fork the project and do your work in a topic branch.
179
- * Make sure your changes will work on both Ruby 1.8.7 and Ruby 1.9
180
- * Add a config at `tests/.fog` for the component you want to test.
181
- * Add shindo tests to prove your code works and run all the tests using `bundle exec rake`.
182
- * Rebase your branch against `fog/fog` to make sure everything is up to date.
183
- * Commit your changes and send a pull request.
184
-
185
- ## Additional Resources
186
-
187
- * [fog.io](http://fog.io)
188
- * [Provider Documentation](http://fog.io/about/provider_documentation.html)
189
-
190
- ## Copyright
191
-
192
- (The MIT License)
193
-
194
- Copyright (c) 2013 [geemus (Wesley Beary)](http://github.com/geemus)
195
-
196
- Permission is hereby granted, free of charge, to any person obtaining
197
- a copy of this software and associated documentation files (the
198
- "Software"), to deal in the Software without restriction, including
199
- without limitation the rights to use, copy, modify, merge, publish,
200
- distribute, sublicense, and/or sell copies of the Software, and to
201
- permit persons to whom the Software is furnished to do so, subject to
202
- the following conditions:
203
-
204
- The above copyright notice and this permission notice shall be
205
- included in all copies or substantial portions of the Software.
206
-
207
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
208
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
209
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
210
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
211
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
212
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
213
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
172
+ ## Getting Help
173
+
174
+ * [General Documentation](http://fog.io).
175
+ * [Provider Specific Documentation](http://fog.io/about/provider_documentation.html).
176
+ * Ask specific questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/fog)
177
+ * Report bugs and discuss potential features in [Github issues](https://github.com/fog/fog/issues).
178
+
179
+ ## Getting Involved
180
+
181
+ New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
182
+
183
+ ### Coding
184
+
185
+ * Pick a task:
186
+ * Offer feedback on open [pull requests](https://github.com/fog/fog/pulls).
187
+ * Review open [issues](https://github.com/fog/fog/issues) for things to help on.
188
+ * [Create an issue](https://github.com/fog/fog/issues/new) to start a discussion on additions or features.
189
+ * Fork the project, add your changes and tests to cover them in a topic branch.
190
+ * Commit your changes and rebase against `fog/fog` to ensure everything is up to date.
191
+ * [Submit a pull request](https://github.com/fog/fog/compare/)
192
+
193
+ ### Non-Coding
194
+
195
+ * Offer feedback on open [issues](https://github.com/fog/fog/issues).
196
+ * Write and help edit [documentation](https://github.com/fog/fog.github.com).
197
+ * Translate [documentation](https://github.com/fog/fog.github.com) in to other languages.
198
+ * Organize or volunteer at events.
199
+ * [Donate](https://www.gittip.com/geemus/)
200
+ * Discuss other ideas for contribution with [geemus](mailto:geemus+fog@gmail.com).
data/fog.gemspec CHANGED
@@ -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-maestrodev'
9
- s.version = '1.18.0.20131209091424'
10
- s.date = '2013-12-09'
9
+ s.version = '1.18.0.20131218202447'
10
+ s.date = '2013-12-18'
11
11
  s.rubyforge_project = 'fog'
12
12
 
13
13
  ## Make sure your summary is short. The description may be as long
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  ## List your runtime dependencies here. Runtime dependencies are those
43
43
  ## that are needed for an end user to actually USE your code.
44
44
  s.add_dependency('builder')
45
- s.add_dependency('excon', '~>0.30.0')
45
+ s.add_dependency('excon', '~>0.31.0')
46
46
  s.add_dependency('formatador', '~>0.2.0')
47
47
  s.add_dependency('multi_json', '~>1.0')
48
48
  s.add_dependency('mime-types')
@@ -47,6 +47,7 @@ module Fog
47
47
 
48
48
  request_path 'fog/aws/requests/compute'
49
49
  request :allocate_address
50
+ request :assign_private_ip_addresses
50
51
  request :associate_address
51
52
  request :associate_dhcp_options
52
53
  request :attach_network_interface
@@ -14,6 +14,10 @@ module Fog
14
14
  attribute :availability_zone, :aliases => 'availabilityZone'
15
15
  attribute :tag_set, :aliases => 'tagSet'
16
16
 
17
+ def ready?
18
+ requires :state
19
+ state == 'available'
20
+ end
17
21
 
18
22
  # Removes an existing subnet
19
23
  #
@@ -20,6 +20,11 @@ module Fog
20
20
  super
21
21
  end
22
22
 
23
+ def ready?
24
+ requires :state
25
+ state == 'available'
26
+ end
27
+
23
28
  # Removes an existing vpc
24
29
  #
25
30
  # vpc.destroy
@@ -11,6 +11,7 @@ module Fog
11
11
  attribute :engine_version, :aliases => 'EngineVersion'
12
12
  attribute :state, :aliases => 'DBInstanceStatus'
13
13
  attribute :allocated_storage, :aliases => 'AllocatedStorage', :type => :integer
14
+ attribute :iops, :aliases => 'Iops'
14
15
  attribute :availability_zone , :aliases => 'AvailabilityZone'
15
16
  attribute :flavor_id, :aliases => 'DBInstanceClass'
16
17
  attribute :endpoint, :aliases => 'Endpoint'
@@ -116,6 +117,7 @@ module Fog
116
117
  'Port' => port || attributes['Port'],
117
118
  'Engine' => engine,
118
119
  'EngineVersion' => engine_version,
120
+ 'Iops' => iops,
119
121
  'MasterUsername' => master_username,
120
122
  'MasterUserPassword' => password || attributes['MasterUserPassword'],
121
123
  'PreferredMaintenanceWindow' => preferred_maintenance_window,
@@ -33,13 +33,13 @@ module Fog
33
33
 
34
34
  # Set file's access control list (ACL).
35
35
  #
36
- # valid acls: private, public-read, public-read-write, authenticated-read
36
+ # valid acls: private, public-read, public-read-write, authenticated-read, bucket-owner-read, bucket-owner-full-control
37
37
  #
38
38
  # @param [String] new_acl one of valid options
39
39
  # @return [String] @acl
40
40
  #
41
41
  def acl=(new_acl)
42
- valid_acls = ['private', 'public-read', 'public-read-write', 'authenticated-read']
42
+ valid_acls = ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control']
43
43
  unless valid_acls.include?(new_acl)
44
44
  raise ArgumentError.new("acl must be one of [#{valid_acls.join(', ')}]")
45
45
  end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Parsers
3
+ module Compute
4
+ module AWS
5
+
6
+ class AssignPrivateIpAddresses < Fog::Parsers::Base
7
+
8
+ def end_element(name)
9
+ case name
10
+ when 'requestId'
11
+ @response[name] = value
12
+ when 'return'
13
+ if value == 'true'
14
+ @response[name] = true
15
+ else
16
+ @response[name] = false
17
+ end
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,60 @@
1
+ module Fog
2
+ module Compute
3
+ class AWS
4
+ class Real
5
+
6
+ require 'fog/aws/parsers/compute/assign_private_ip_addresses'
7
+
8
+ # Assigns one or more secondary private IP addresses to the specified network interface.
9
+ #
10
+ # ==== Parameters
11
+ # * NetworkInterfaceId<~String> - The ID of the network interface
12
+ # * PrivateIpAddresses<~Array> - One or more IP addresses to be assigned as a secondary private IP address (conditional)
13
+ # * SecondaryPrivateIpAddressCount<~String> - The number of secondary IP addresses to assign (conditional)
14
+ # * AllowReassignment<~Boolean> - Whether to reassign an IP address
15
+ # ==== Returns
16
+ # * response<~Excon::Response>:
17
+ # * body<~Hash>:
18
+ # * 'requestId'<~String> - The ID of the request.
19
+ # * 'return'<~Boolean> - success?
20
+ #
21
+ # {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-AssignPrivateIpAddresses.html]
22
+ def assign_private_ip_addresses(network_interface_id, options={})
23
+
24
+ if options['PrivateIpAddresses'] && options['SecondaryPrivateIpAddressCount']
25
+ raise Fog::Compute::AWS::Error.new("You may specify secondaryPrivateIpAddressCount or specific secondary private IP addresses, but not both.")
26
+ end
27
+
28
+ if private_ip_addresses = options.delete('PrivateIpAddresses')
29
+ options.merge!(Fog::AWS.indexed_param('PrivateIpAddress.%d', [*private_ip_addresses]))
30
+ end
31
+
32
+ request({
33
+ 'Action' => 'AssignPrivateIpAddresses',
34
+ 'NetworkInterfaceId' => network_interface_id,
35
+ :parser => Fog::Parsers::Compute::AWS::AssignPrivateIpAddresses.new
36
+ }.merge(options))
37
+ end
38
+
39
+ end
40
+
41
+ class Mock
42
+
43
+ def assign_private_ip_addresses(network_interface_id, options={})
44
+ if options['PrivateIpAddresses'] && options['SecondaryPrivateIpAddressCount']
45
+ raise Fog::Compute::AWS::Error.new("You may specify secondaryPrivateIpAddressCount or specific secondary private IP addresses, but not both.")
46
+ end
47
+
48
+ response = Excon::Response.new
49
+ response.status = 200
50
+ response.body = {
51
+ 'requestId' => Fog::AWS::Mock.request_id,
52
+ 'return' => true
53
+ }
54
+ response
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -46,6 +46,14 @@ module Fog
46
46
  def describe_subnets(filters = {})
47
47
  subnets = self.data[:subnets]
48
48
 
49
+ # Transition from pending to available
50
+ subnets.each do |subnet|
51
+ case subnet['state']
52
+ when 'pending'
53
+ subnet['state'] = 'available'
54
+ end
55
+ end
56
+
49
57
  if filters['subnet-id']
50
58
  subnets = subnets.reject {|subnet| subnet['subnetId'] != filters['subnet-id']}
51
59
  end
@@ -43,6 +43,14 @@ module Fog
43
43
  def describe_vpcs(filters = {})
44
44
  vpcs = self.data[:vpcs]
45
45
 
46
+ # Transition from pending to available
47
+ vpcs.each do |vpc|
48
+ case vpc['state']
49
+ when 'pending'
50
+ vpc['state'] = 'available'
51
+ end
52
+ end
53
+
46
54
  if filters['vpc-id']
47
55
  vpcs = vpcs.reject {|vpc| vpc['vpcId'] != filters['vpc-id']}
48
56
  end
@@ -8,7 +8,7 @@ module Fog
8
8
 
9
9
  service(:compute, 'cloudstack/compute','Compute')
10
10
 
11
- @@digest = OpenSSL::Digest::Digest.new('sha1')
11
+ @@digest = OpenSSL::Digest.new('sha1')
12
12
 
13
13
  def self.escape(string)
14
14
  string = CGI::escape(string)
@@ -30,8 +30,8 @@ module Fog
30
30
  end
31
31
  params[:headers] ||= {}
32
32
  params[:headers]['User-Agent'] ||= "fog/#{Fog::VERSION}"
33
+ params.merge!(:persistent => params.fetch(:persistent, persistent))
33
34
  @excon = Excon.new(url, params)
34
- @persistent = persistent
35
35
  end
36
36
 
37
37
  # Makes a request using the connection using Excon
@@ -53,7 +53,6 @@ module Fog
53
53
  # @raise [Excon::Errors::SocketError]
54
54
  #
55
55
  def request(params, &block)
56
- reset unless @persistent
57
56
  @excon.request(params, &block)
58
57
  end
59
58
 
data/lib/fog/core/hmac.rb CHANGED
@@ -18,7 +18,7 @@ module Fog
18
18
  private
19
19
 
20
20
  def setup_sha1
21
- @digest = OpenSSL::Digest::Digest.new('sha1')
21
+ @digest = OpenSSL::Digest.new('sha1')
22
22
  @signer = lambda do |data|
23
23
  OpenSSL::HMAC.digest(@digest, @key, data)
24
24
  end
@@ -26,7 +26,7 @@ module Fog
26
26
 
27
27
  def setup_sha256
28
28
  begin
29
- @digest = OpenSSL::Digest::Digest.new('sha256')
29
+ @digest = OpenSSL::Digest.new('sha256')
30
30
  @signer = lambda do |data|
31
31
  OpenSSL::HMAC.digest(@digest, @key, data)
32
32
  end
@@ -45,4 +45,4 @@ module Fog
45
45
  end
46
46
 
47
47
  end
48
- end
48
+ end
data/lib/fog/core/mock.rb CHANGED
@@ -30,8 +30,8 @@ module Fog
30
30
  @delay = new_delay
31
31
  end
32
32
 
33
- def self.not_implemented
34
- raise Fog::Errors::MockNotImplemented.new("Contributions welcome!")
33
+ def self.not_implemented(message = 'Contributions welcome!')
34
+ raise Fog::Errors::MockNotImplemented.new(message)
35
35
  end
36
36
 
37
37
  def self.random_ip(opts = {:version => :v4})
@@ -1,5 +1,5 @@
1
1
  module Fog
2
- def self.wait_for(timeout=Fog.timeout, interval=1, &block)
2
+ def self.wait_for(timeout=Fog.timeout, interval=Fog.interval, &block)
3
3
  duration = 0
4
4
  start = Time.now
5
5
  until yield || duration > timeout
@@ -1,4 +1,14 @@
1
1
  module Fog
2
+ @interval = 1
3
+ def self.interval
4
+ @interval
5
+ end
6
+
7
+ def self.interval=(interval)
8
+ raise ArgumentError, "interval must be non-negative" unless interval >= 0
9
+ @interval = interval
10
+ end
11
+
2
12
  @timeout = 600
3
13
  def self.timeout
4
14
  @timeout
data/lib/fog/core.rb CHANGED
@@ -28,8 +28,8 @@ require 'fog/core/service'
28
28
  require 'fog/core/ssh'
29
29
  require 'fog/core/scp'
30
30
  require 'fog/core/time'
31
- require 'fog/core/timeout'
32
31
  require 'fog/core/wait_for'
32
+ require 'fog/core/wait_for_defaults'
33
33
  require 'fog/core/class_from_string'
34
34
  require 'fog/core/uuid'
35
35
 
@@ -76,7 +76,7 @@ module Fog
76
76
 
77
77
  def shared_initialize(options = {})
78
78
  @project = options[:google_project]
79
- @api_version = 'v1beta16'
79
+ @api_version = 'v1'
80
80
  end
81
81
 
82
82
  def build_excon_response(body, status=200)
@@ -99,12 +99,14 @@ module Fog
99
99
 
100
100
  def backoff_if_unfound(&block)
101
101
  retries_remaining = 10
102
+ sleep_time = 0.1
102
103
  begin
103
104
  result = block.call
104
105
  rescue Exception => msg
105
106
  if msg.to_s.include? 'was not found' and retries_remaining > 0
106
107
  retries_remaining -= 1
107
- sleep 0.1
108
+ sleep sleep_time
109
+ sleep_time *= 1.6
108
110
  retry
109
111
  else
110
112
  raise msg
@@ -142,7 +144,6 @@ module Fog
142
144
  "name" => "centos-6-2-v20120621",
143
145
  "description" => "CentOS 6.2; Created Thu, 21 Jun 2012 14:22:21 +0000",
144
146
  "sourceType" => "RAW",
145
- "preferredKernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-20120621",
146
147
  "rawDisk" => {
147
148
  "containerType" => "TAR",
148
149
  "source" => ""
@@ -161,7 +162,6 @@ module Fog
161
162
  "name" => "centos-6-v20120912",
162
163
  "description" => "CentOS 6; Created Wed, 12 Sep 2012 00:00:00 +0000",
163
164
  "sourceType" => "RAW",
164
- "preferredKernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20120912",
165
165
  "rawDisk" => {
166
166
  "containerType" => "TAR",
167
167
  "source" => ""
@@ -180,7 +180,6 @@ module Fog
180
180
  "name" => "centos-6-v20121106",
181
181
  "description" => "SCSI-enabled CentOS 6; Created Tue, 06 Nov 2012 00:00:00 +0000",
182
182
  "sourceType" => "RAW",
183
- "preferredKernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20121106",
184
183
  "rawDisk" => {
185
184
  "containerType" => "TAR",
186
185
  "source" => ""
@@ -200,7 +199,6 @@ module Fog
200
199
  "name" => "debian-6-squeeze-v20130816",
201
200
  "description" => "Debian GNU/Linux 6.0.7 (squeeze) built on 2013-08-16",
202
201
  "sourceType" => "RAW",
203
- "preferredKernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20130813",
204
202
  "rawDisk" => {
205
203
  "containerType" => "TAR",
206
204
  "source" => ""
@@ -215,7 +213,6 @@ module Fog
215
213
  "name" => "debian-7-wheezy-v20130816",
216
214
  "description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-08-16",
217
215
  "sourceType" => "RAW",
218
- "preferredKernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20130813",
219
216
  "rawDisk" => {
220
217
  "containerType" => "TAR",
221
218
  "source" => ""
@@ -230,12 +227,26 @@ module Fog
230
227
  "name" => "debian-7-wheezy-v20131014",
231
228
  "description" => "Debian GNU/Linux 7.1 (wheezy) built on 2013-10-14",
232
229
  "sourceType" => "RAW",
233
- "preferredKernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20130813",
234
230
  "rawDisk" => {
235
231
  "containerType" => "TAR",
236
232
  "source" => ""
237
233
  },
238
234
  "status" => "READY"
235
+ },
236
+ "debian-7-wheezy-v20131120" => {
237
+ "kind" => "compute#image",
238
+ "selfLink" => "https://www.googleapis.com/compute/#{api_version}/projects/debian-cloud/global/images/debian-7-wheezy-v20131120",
239
+ "id" => "17312518942796567788",
240
+ "creationTimestamp" => "2013-11-25T15:17:00.436-08:00",
241
+ "name" => "debian-7-wheezy-v20131120",
242
+ "description" => "Debian GNU/Linux 7.2 (wheezy) built on 2013-11-20",
243
+ "sourceType" => "RAW",
244
+ "rawDisk" => {
245
+ "containerType" => "TAR",
246
+ "source" => ""
247
+ },
248
+ "status" => "READY",
249
+ "archiveSizeBytes" => "341857472"
239
250
  }
240
251
  }
241
252
  }
@@ -250,7 +261,6 @@ module Fog
250
261
  "name" => "centos-6-v20130813",
251
262
  "description" => "SCSI-enabled CentOS 6; Created Tue, 13 Aug 2013 00:00:00 +0000",
252
263
  "sourceType" => "RAW",
253
- "preferredKernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20130813",
254
264
  "rawDisk" => {
255
265
  "containerType" => "TAR",
256
266
  "source" => ""
@@ -271,8 +281,6 @@ module Fog
271
281
  "name" => "fog-1380196541",
272
282
  "tags" => { "fingerprint" => "42WmSpB8rSM=" },
273
283
  "machineType" => "https://www.googleapis.com/compute/#{api_version}/projects/#{key}/zones/us-central1-a/machineTypes/n1-standard-1",
274
- "image" => "https://www.googleapis.com/compute/#{api_version}/projects/centos-cloud/global/images/centos-6-v20130813",
275
- "kernel" => "https://www.googleapis.com/compute/#{api_version}/projects/google/global/kernels/gce-v20130813",
276
284
  "canIpForward" => false,
277
285
  "networkInterfaces" => [
278
286
  {
@@ -1,9 +1,20 @@
1
1
  def test
2
2
  connection = Fog::Compute.new({ :provider => "Google" })
3
3
 
4
+ name = "fog-smoke-test-#{Time.now.to_i}"
5
+
6
+ disk = connection.disks.create({
7
+ :name => name,
8
+ :size_gb => 10,
9
+ :zone_name => 'us-central1-a',
10
+ :source_image => 'debian-7-wheezy-v20131120',
11
+ })
12
+
13
+ disk.wait_for { disk.ready? }
14
+
4
15
  server = connection.servers.create(defaults = {
5
16
  :name => "fog-smoke-test-#{Time.now.to_i}",
6
- :image_name => "debian-7-wheezy-v20130522",
17
+ :disks => [disk],
7
18
  :machine_type => "n1-standard-1",
8
19
  :zone_name => "us-central1-a",
9
20
  :private_key_path => File.expand_path("~/.ssh/id_rsa"),
@@ -1,9 +1,20 @@
1
1
  def test
2
2
  connection = Fog::Compute.new({ :provider => "Google" })
3
3
 
4
+ name = "fog-smoke-test-#{Time.now.to_i}"
5
+
6
+ disk = connection.disks.create({
7
+ :name => name,
8
+ :size_gb => 10,
9
+ :zone_name => 'us-central1-a',
10
+ :source_image => 'debian-7-wheezy-v20131120',
11
+ })
12
+
13
+ disk.wait_for { disk.ready? }
14
+
4
15
  server = connection.servers.create(defaults = {
5
- :name => "fog-smoke-test-#{Time.now.to_i}",
6
- :image_name => "debian-7-wheezy-v20130617",
16
+ :name => name,
17
+ :disks => [disk],
7
18
  :machine_type => "n1-standard-1",
8
19
  :zone_name => "us-central1-a",
9
20
  :private_key_path => File.expand_path("~/.ssh/id_rsa"),
@@ -10,7 +10,6 @@ def test
10
10
  return if rawdisk[:source].nil?
11
11
 
12
12
  img = connection.image.create(:name => 'test-image',
13
- :preferred_kernel => 'gce-v20130603',
14
13
  :description => 'Test image (via fog)',
15
14
  :raw_disk => rawdisk)
16
15
 
@@ -14,8 +14,7 @@ def test
14
14
  :machine_type => "f1-micro",
15
15
  :zone_name => "us-central1-a",
16
16
  :disks => [ disk.get_as_boot_disk(true) ],
17
- :user => ENV['USER'],
18
- :kernel => 'gce-v20130522',
17
+ :user => ENV['USER']
19
18
  }
20
19
 
21
20
  server = connection.servers.bootstrap params
@@ -1,8 +1,20 @@
1
1
  def test
2
2
  connection = Fog::Compute.new({ :provider => "Google" })
3
+
4
+ name = "fog-smoke-test-#{Time.now.to_i}"
5
+
6
+ disk = connection.disks.create({
7
+ :name => name,
8
+ :size_gb => 10,
9
+ :zone_name => 'us-central1-a',
10
+ :source_image => 'debian-7-wheezy-v20131120',
11
+ })
12
+
13
+ disk.wait_for { disk.ready? }
14
+
3
15
  server = connection.servers.create(defaults = {
4
- :name => "fog-#{Time.now.to_i}",
5
- :image_name => "debian-7-wheezy-v20130522",
16
+ :name => name,
17
+ :disks => [disk],
6
18
  :machine_type => "n1-standard-1",
7
19
  :zone_name => "us-central1-a",
8
20
  :private_key_path => File.expand_path("~/.ssh/id_rsa"),