fog 0.0.31 → 0.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/.document +0 -2
  2. data/Rakefile +12 -7
  3. data/VERSION +1 -1
  4. data/bin/fog +16 -18
  5. data/fog.gemspec +34 -8
  6. data/lib/fog.rb +11 -0
  7. data/lib/fog/aws/models/ec2/address.rb +4 -0
  8. data/lib/fog/aws/models/ec2/instance.rb +17 -0
  9. data/lib/fog/aws/models/ec2/key_pair.rb +4 -0
  10. data/lib/fog/aws/models/ec2/security_group.rb +8 -0
  11. data/lib/fog/aws/models/ec2/snapshot.rb +7 -1
  12. data/lib/fog/aws/models/ec2/volume.rb +9 -1
  13. data/lib/fog/aws/models/s3/bucket.rb +10 -0
  14. data/lib/fog/aws/models/s3/buckets.rb +10 -4
  15. data/lib/fog/aws/models/s3/object.rb +5 -0
  16. data/lib/fog/aws/requests/ec2/allocate_address.rb +1 -1
  17. data/lib/fog/aws/requests/ec2/associate_address.rb +2 -2
  18. data/lib/fog/aws/requests/ec2/attach_volume.rb +2 -2
  19. data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +1 -1
  20. data/lib/fog/aws/requests/ec2/create_key_pair.rb +2 -2
  21. data/lib/fog/aws/requests/ec2/create_security_group.rb +2 -2
  22. data/lib/fog/aws/requests/ec2/create_snapshot.rb +2 -2
  23. data/lib/fog/aws/requests/ec2/create_volume.rb +1 -1
  24. data/lib/fog/aws/requests/ec2/delete_key_pair.rb +1 -1
  25. data/lib/fog/aws/requests/ec2/delete_security_group.rb +2 -2
  26. data/lib/fog/aws/requests/ec2/delete_snapshot.rb +2 -2
  27. data/lib/fog/aws/requests/ec2/delete_volume.rb +2 -2
  28. data/lib/fog/aws/requests/ec2/describe_addresses.rb +2 -2
  29. data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +1 -1
  30. data/lib/fog/aws/requests/ec2/describe_images.rb +1 -1
  31. data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -2
  32. data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +2 -2
  33. data/lib/fog/aws/requests/ec2/describe_regions.rb +1 -1
  34. data/lib/fog/aws/requests/ec2/describe_security_groups.rb +2 -2
  35. data/lib/fog/aws/requests/ec2/describe_snapshots.rb +2 -2
  36. data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -2
  37. data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
  38. data/lib/fog/aws/requests/ec2/disassociate_address.rb +2 -2
  39. data/lib/fog/aws/requests/ec2/get_console_output.rb +2 -2
  40. data/lib/fog/aws/requests/ec2/reboot_instances.rb +2 -2
  41. data/lib/fog/aws/requests/ec2/release_address.rb +2 -2
  42. data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +1 -1
  43. data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
  44. data/lib/fog/aws/requests/ec2/terminate_instances.rb +2 -2
  45. data/lib/fog/aws/requests/s3/copy_object.rb +2 -2
  46. data/lib/fog/aws/requests/s3/delete_bucket.rb +3 -3
  47. data/lib/fog/aws/requests/s3/delete_object.rb +8 -7
  48. data/lib/fog/aws/requests/s3/get_bucket.rb +2 -2
  49. data/lib/fog/aws/requests/s3/get_bucket_location.rb +2 -2
  50. data/lib/fog/aws/requests/s3/get_object.rb +2 -2
  51. data/lib/fog/aws/requests/s3/get_request_payment.rb +2 -2
  52. data/lib/fog/aws/requests/s3/get_service.rb +1 -1
  53. data/lib/fog/aws/requests/s3/put_bucket.rb +8 -6
  54. data/lib/fog/aws/requests/s3/put_object.rb +9 -9
  55. data/lib/fog/aws/requests/s3/put_request_payment.rb +2 -2
  56. data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +2 -2
  57. data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
  58. data/lib/fog/aws/requests/simpledb/delete_attributes.rb +2 -2
  59. data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
  60. data/lib/fog/aws/requests/simpledb/domain_metadata.rb +2 -2
  61. data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
  62. data/lib/fog/aws/requests/simpledb/list_domains.rb +1 -1
  63. data/lib/fog/aws/s3.rb +1 -12
  64. data/lib/fog/collection.rb +16 -8
  65. data/lib/fog/model.rb +36 -14
  66. data/lib/fog/rackspace/models/servers/image.rb +40 -0
  67. data/lib/fog/rackspace/models/servers/images.rb +50 -0
  68. data/lib/fog/rackspace/models/servers/server.rb +18 -2
  69. data/lib/fog/rackspace/requests/servers/create_image.rb +18 -1
  70. data/lib/fog/rackspace/requests/servers/create_server.rb +5 -5
  71. data/lib/fog/rackspace/requests/servers/delete_image.rb +16 -1
  72. data/lib/fog/rackspace/requests/servers/delete_server.rb +4 -4
  73. data/lib/fog/rackspace/requests/servers/get_server_details.rb +2 -2
  74. data/lib/fog/rackspace/requests/servers/list_addresses.rb +2 -2
  75. data/lib/fog/rackspace/requests/servers/list_images.rb +10 -0
  76. data/lib/fog/rackspace/requests/servers/list_images_detail.rb +16 -1
  77. data/lib/fog/rackspace/requests/servers/list_private_addresses.rb +2 -2
  78. data/lib/fog/rackspace/requests/servers/list_public_addresses.rb +2 -2
  79. data/lib/fog/rackspace/requests/servers/list_servers.rb +1 -1
  80. data/lib/fog/rackspace/requests/servers/list_servers_detail.rb +2 -2
  81. data/lib/fog/rackspace/requests/servers/update_server.rb +2 -2
  82. data/lib/fog/rackspace/servers.rb +8 -2
  83. data/lib/fog/slicehost.rb +66 -0
  84. data/lib/fog/slicehost/parsers/create_slice.rb +29 -0
  85. data/lib/fog/slicehost/parsers/get_backups.rb +30 -0
  86. data/lib/fog/slicehost/parsers/get_flavors.rb +28 -0
  87. data/lib/fog/slicehost/parsers/get_images.rb +28 -0
  88. data/lib/fog/slicehost/parsers/get_slices.rb +33 -0
  89. data/lib/fog/slicehost/requests/create_slice.rb +50 -0
  90. data/lib/fog/slicehost/requests/delete_slice.rb +48 -0
  91. data/lib/fog/slicehost/requests/get_backups.rb +38 -0
  92. data/lib/fog/slicehost/requests/get_flavors.rb +38 -0
  93. data/lib/fog/slicehost/requests/get_images.rb +36 -0
  94. data/lib/fog/slicehost/requests/get_slices.rb +44 -0
  95. data/spec/aws/requests/s3/put_object_spec.rb +8 -0
  96. data/spec/rackspace/requests/servers/create_image_spec.rb +1 -1
  97. data/spec/rackspace/requests/servers/create_server_spec.rb +1 -1
  98. data/spec/rackspace/requests/servers/delete_image_spec.rb +7 -5
  99. data/spec/rackspace/requests/servers/delete_server_spec.rb +1 -1
  100. data/spec/rackspace/requests/servers/get_server_details_spec.rb +1 -1
  101. data/spec/rackspace/requests/servers/list_addresses_spec.rb +1 -1
  102. data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +1 -1
  103. data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +1 -1
  104. data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +1 -1
  105. data/spec/rackspace/requests/servers/list_servers_spec.rb +1 -1
  106. data/spec/rackspace/requests/servers/reboot_server_spec.rb +1 -1
  107. data/spec/rackspace/requests/servers/update_server_spec.rb +1 -1
  108. data/spec/slicehost/requests/create_slice_spec.rb +29 -0
  109. data/spec/slicehost/requests/delete_slice_spec.rb +18 -0
  110. data/spec/slicehost/requests/get_backups_spec.rb +17 -0
  111. data/spec/slicehost/requests/get_flavors_spec.rb +17 -0
  112. data/spec/slicehost/requests/get_images_spec.rb +15 -0
  113. data/spec/slicehost/requests/get_slices_spec.rb +23 -0
  114. data/spec/spec_helper.rb +20 -22
  115. metadata +29 -4
  116. data/lib/fog/aws/models/s3/owner.rb +0 -18
data/.document CHANGED
@@ -1,5 +1,3 @@
1
1
  README.rdoc
2
2
  lib/**/*.rb
3
3
  bin/*
4
- features/**/*.feature
5
- LICENSE
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require "#{current_directory}/lib/fog"
7
7
  begin
8
8
  require 'jeweler'
9
9
  Jeweler::Tasks.new do |gem|
10
- gem.add_dependency('excon')
10
+ gem.add_dependency('excon', '>=0.0.10')
11
11
  gem.add_dependency('mime-types')
12
12
  gem.add_dependency('nokogiri')
13
13
  gem.add_dependency('ruby-hmac')
@@ -102,12 +102,17 @@ namespace :fog do
102
102
  desc 'Provide a sample yaml file for credentials'
103
103
  task :yml do
104
104
  puts('Copy the following sample to ~/.fog and fill in with your credentials as needed:')
105
- print("\n")
106
- print(":aws_access_key_id: INTENTIONALLY_LEFT_BLANK\n")
107
- print(":aws_secret_access_key: INTENTIONALLY_LEFT_BLANK\n")
108
- print(":rackspace_api_key: INTENTIONALLY_LEFT_BLANK\n")
109
- print(":rackspace_username: INTENTIONALLY_LEFT_BLANK\n")
110
- print("\n")
105
+ yml = <<YML
106
+
107
+ :default:
108
+ :aws_access_key_id: INTENTIONALLY_LEFT_BLANK
109
+ :aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
110
+ :rackspace_api_key: INTENTIONALLY_LEFT_BLANK
111
+ :rackspace_username: INTENTIONALLY_LEFT_BLANK
112
+ :slicehost_password: INTENTIONALLY_LEFT_BLANK
113
+
114
+ YML
115
+ print(yml)
111
116
  end
112
117
 
113
118
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.31
1
+ 0.0.32
data/bin/fog CHANGED
@@ -3,28 +3,18 @@ require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
3
3
  require 'irb'
4
4
  require 'yaml'
5
5
 
6
- def credentials
7
- @credentials ||= begin
8
- if ARGV[0] && File.exists?(File.expand_path(ARGV[0]))
9
- YAML.load(File.open(File.expand_path(ARGV[0])).read)
10
- elsif File.exists?(File.expand_path('~/.fog'))
11
- YAML.load(File.open(File.expand_path('~/.fog')).read)
12
- end
13
- end
14
- end
15
-
16
6
  module AWS
17
7
  class << self
18
- if credentials[:aws_access_key_id] && credentials[:aws_secret_access_key]
8
+ if Fog.credentials[:aws_access_key_id] && Fog.credentials[:aws_secret_access_key]
19
9
 
20
10
  @@ec2 = Fog::AWS::EC2.new(
21
- :aws_access_key_id => credentials[:aws_access_key_id],
22
- :aws_secret_access_key => credentials[:aws_secret_access_key]
11
+ :aws_access_key_id => Fog.credentials[:aws_access_key_id],
12
+ :aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
23
13
  )
24
14
 
25
15
  @@s3 = Fog::AWS::S3.new(
26
- :aws_access_key_id => credentials[:aws_access_key_id],
27
- :aws_secret_access_key => credentials[:aws_secret_access_key]
16
+ :aws_access_key_id => Fog.credentials[:aws_access_key_id],
17
+ :aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
28
18
  )
29
19
 
30
20
  def addresses
@@ -61,13 +51,21 @@ end
61
51
 
62
52
  module Rackspace
63
53
  class << self
64
- if credentials[:rackspace_api_key] && credentials[:rackspace_username]
54
+ if Fog.credentials[:rackspace_api_key] && Fog.credentials[:rackspace_username]
65
55
 
66
56
  @@servers = Fog::Rackspace::Servers.new(
67
- :rackspace_api_key => credentials[:rackspace_api_key],
68
- :rackspace_username => credentials[:rackspace_username]
57
+ :rackspace_api_key => Fog.credentials[:rackspace_api_key],
58
+ :rackspace_username => Fog.credentials[:rackspace_username]
69
59
  )
70
60
 
61
+ def flavors
62
+ @@servers.flavors
63
+ end
64
+
65
+ def images
66
+ @@servers.images
67
+ end
68
+
71
69
  def servers
72
70
  @@servers.servers
73
71
  end
data/fog.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fog}
8
- s.version = "0.0.31"
8
+ s.version = "0.0.32"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["geemus (Wesley Beary)"]
12
- s.date = %q{2009-11-16}
12
+ s.date = %q{2009-12-03}
13
13
  s.default_executable = %q{fog}
14
14
  s.description = %q{brings clouds to you}
15
15
  s.email = %q{me@geemus.com}
@@ -47,7 +47,6 @@ Gem::Specification.new do |s|
47
47
  "lib/fog/aws/models/s3/buckets.rb",
48
48
  "lib/fog/aws/models/s3/object.rb",
49
49
  "lib/fog/aws/models/s3/objects.rb",
50
- "lib/fog/aws/models/s3/owner.rb",
51
50
  "lib/fog/aws/parsers/ec2/allocate_address.rb",
52
51
  "lib/fog/aws/parsers/ec2/attach_volume.rb",
53
52
  "lib/fog/aws/parsers/ec2/basic.rb",
@@ -137,6 +136,8 @@ Gem::Specification.new do |s|
137
136
  "lib/fog/rackspace/files.rb",
138
137
  "lib/fog/rackspace/models/servers/flavor.rb",
139
138
  "lib/fog/rackspace/models/servers/flavors.rb",
139
+ "lib/fog/rackspace/models/servers/image.rb",
140
+ "lib/fog/rackspace/models/servers/images.rb",
140
141
  "lib/fog/rackspace/models/servers/server.rb",
141
142
  "lib/fog/rackspace/models/servers/servers.rb",
142
143
  "lib/fog/rackspace/requests/files/delete_container.rb",
@@ -165,6 +166,18 @@ Gem::Specification.new do |s|
165
166
  "lib/fog/rackspace/requests/servers/reboot_server.rb",
166
167
  "lib/fog/rackspace/requests/servers/update_server.rb",
167
168
  "lib/fog/rackspace/servers.rb",
169
+ "lib/fog/slicehost.rb",
170
+ "lib/fog/slicehost/parsers/create_slice.rb",
171
+ "lib/fog/slicehost/parsers/get_backups.rb",
172
+ "lib/fog/slicehost/parsers/get_flavors.rb",
173
+ "lib/fog/slicehost/parsers/get_images.rb",
174
+ "lib/fog/slicehost/parsers/get_slices.rb",
175
+ "lib/fog/slicehost/requests/create_slice.rb",
176
+ "lib/fog/slicehost/requests/delete_slice.rb",
177
+ "lib/fog/slicehost/requests/get_backups.rb",
178
+ "lib/fog/slicehost/requests/get_flavors.rb",
179
+ "lib/fog/slicehost/requests/get_images.rb",
180
+ "lib/fog/slicehost/requests/get_slices.rb",
168
181
  "spec/aws/models/ec2/address_spec.rb",
169
182
  "spec/aws/models/ec2/addresses_spec.rb",
170
183
  "spec/aws/models/ec2/instance_spec.rb",
@@ -258,6 +271,12 @@ Gem::Specification.new do |s|
258
271
  "spec/rackspace/requests/servers/list_servers_spec.rb",
259
272
  "spec/rackspace/requests/servers/reboot_server_spec.rb",
260
273
  "spec/rackspace/requests/servers/update_server_spec.rb",
274
+ "spec/slicehost/requests/create_slice_spec.rb",
275
+ "spec/slicehost/requests/delete_slice_spec.rb",
276
+ "spec/slicehost/requests/get_backups_spec.rb",
277
+ "spec/slicehost/requests/get_flavors_spec.rb",
278
+ "spec/slicehost/requests/get_images_spec.rb",
279
+ "spec/slicehost/requests/get_slices_spec.rb",
261
280
  "spec/spec.opts",
262
281
  "spec/spec_helper.rb"
263
282
  ]
@@ -360,6 +379,12 @@ Gem::Specification.new do |s|
360
379
  "spec/rackspace/requests/servers/list_servers_spec.rb",
361
380
  "spec/rackspace/requests/servers/reboot_server_spec.rb",
362
381
  "spec/rackspace/requests/servers/update_server_spec.rb",
382
+ "spec/slicehost/requests/create_slice_spec.rb",
383
+ "spec/slicehost/requests/delete_slice_spec.rb",
384
+ "spec/slicehost/requests/get_backups_spec.rb",
385
+ "spec/slicehost/requests/get_flavors_spec.rb",
386
+ "spec/slicehost/requests/get_images_spec.rb",
387
+ "spec/slicehost/requests/get_slices_spec.rb",
363
388
  "spec/spec_helper.rb"
364
389
  ]
365
390
 
@@ -368,20 +393,21 @@ Gem::Specification.new do |s|
368
393
  s.specification_version = 3
369
394
 
370
395
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
371
- s.add_runtime_dependency(%q<excon>, [">= 0"])
396
+ s.add_runtime_dependency(%q<excon>, [">= 0.0.10"])
372
397
  s.add_runtime_dependency(%q<mime-types>, [">= 0"])
373
398
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
374
399
  s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
375
400
  else
376
- s.add_dependency(%q<excon>, [">= 0"])
401
+ s.add_dependency(%q<excon>, [">= 0.0.10"])
377
402
  s.add_dependency(%q<mime-types>, [">= 0"])
378
403
  s.add_dependency(%q<nokogiri>, [">= 0"])
379
404
  s.add_dependency(%q<ruby-hmac>, [">= 0"])
380
405
  end
381
406
  else
382
- s.add_dependency(%q<excon>, [">= 0"])
407
+ s.add_dependency(%q<excon>, [">= 0.0.10"])
383
408
  s.add_dependency(%q<mime-types>, [">= 0"])
384
409
  s.add_dependency(%q<nokogiri>, [">= 0"])
385
410
  s.add_dependency(%q<ruby-hmac>, [">= 0"])
386
411
  end
387
412
  end
413
+
data/lib/fog.rb CHANGED
@@ -35,6 +35,17 @@ module Fog
35
35
 
36
36
  load "fog/aws.rb"
37
37
  load "fog/rackspace.rb"
38
+ load "fog/slicehost.rb"
39
+ end
40
+
41
+ def self.credentials(path = File.expand_path('~/.fog'))
42
+ @credentials ||= begin
43
+ credentials = {}
44
+ File.open(path) do |file|
45
+ credentials = YAML.load(file.read)[:default]
46
+ end
47
+ credentials
48
+ end
38
49
  end
39
50
 
40
51
  end
@@ -9,11 +9,15 @@ module Fog
9
9
  attribute :instance_id, 'instanceId'
10
10
 
11
11
  def destroy
12
+ requires :public_ip
13
+
12
14
  connection.release_address(@public_ip)
13
15
  true
14
16
  end
15
17
 
16
18
  def instance=(new_instance)
19
+ requires :public_ip
20
+
17
21
  if new_instance
18
22
  associate(new_instance)
19
23
  else
@@ -24,10 +24,14 @@ module Fog
24
24
  attribute :user_data
25
25
 
26
26
  def addresses
27
+ requires :instance_id
28
+
27
29
  connection.addresses(:instance => self)
28
30
  end
29
31
 
30
32
  def destroy
33
+ requires :instance_id
34
+
31
35
  connection.terminate_instances(@instance_id)
32
36
  true
33
37
  end
@@ -41,6 +45,8 @@ module Fog
41
45
  # end
42
46
 
43
47
  def key_pair
48
+ requires :key_name
49
+
44
50
  connection.keypairs.all(@key_name).first
45
51
  end
46
52
 
@@ -64,7 +70,16 @@ module Fog
64
70
  end
65
71
  end
66
72
 
73
+ def reboot
74
+ requires :instance_id
75
+
76
+ connection.reboot_instances(@instance_id)
77
+ true
78
+ end
79
+
67
80
  def save
81
+ requires :image_id
82
+
68
83
  options = {}
69
84
  if @availability_zone
70
85
  options['Placement.AvailabilityZone'] = @availability_zone
@@ -96,6 +111,8 @@ module Fog
96
111
  end
97
112
 
98
113
  def volumes
114
+ requires :instance_id
115
+
99
116
  connection.volumes(:instance => self)
100
117
  end
101
118
 
@@ -10,11 +10,15 @@ module Fog
10
10
  attribute :material, 'keyMaterial'
11
11
 
12
12
  def destroy
13
+ requires :name
14
+
13
15
  connection.delete_key_pair(@name)
14
16
  true
15
17
  end
16
18
 
17
19
  def save
20
+ requires :name
21
+
18
22
  data = connection.create_key_pair(@name).body
19
23
  new_attributes = data.reject {|key,value| !['keyFingerprint', 'keyMaterial', 'keyName'].include?(key)}
20
24
  merge_attributes(new_attributes)
@@ -11,6 +11,8 @@ module Fog
11
11
  attribute :owner_id, 'ownerId'
12
12
 
13
13
  def authorize_group_and_owner(group, owner)
14
+ requires :group_name
15
+
14
16
  connection.authorize_security_group_ingress(
15
17
  'GroupName' => @group_name,
16
18
  'SourceSecurityGroupName' => group,
@@ -19,6 +21,8 @@ module Fog
19
21
  end
20
22
 
21
23
  def authorize_port_range(range, options = {})
24
+ requires :group_name
25
+
22
26
  connection.authorize_security_group_ingress(
23
27
  'CidrIp' => options[:cidr_ip] || '0.0.0.0/0',
24
28
  'FromPort' => range.min,
@@ -29,11 +33,15 @@ module Fog
29
33
  end
30
34
 
31
35
  def destroy
36
+ requires :group_name
37
+
32
38
  connection.delete_security_group(@group_name)
33
39
  true
34
40
  end
35
41
 
36
42
  def save
43
+ requires :group_name
44
+
37
45
  data = connection.create_security_group(@group_name, @group_description).body
38
46
  true
39
47
  end
@@ -12,18 +12,24 @@ module Fog
12
12
  attribute :volume_id, 'volumeId'
13
13
 
14
14
  def destroy
15
+ requires :snapshot_id
16
+
15
17
  connection.delete_snapshot(@snapshot_id)
16
18
  true
17
19
  end
18
20
 
19
21
  def save
20
- data = connection.create_snapshot(volume_id).body
22
+ requires :volume_id
23
+
24
+ data = connection.create_snapshot(@volume_id).body
21
25
  new_attributes = data.reject {|key,value| key == 'requestId'}
22
26
  merge_attributes(new_attributes)
23
27
  true
24
28
  end
25
29
 
26
30
  def volume
31
+ requires :snapshot_id
32
+
27
33
  connection.describe_volumes(@volume_id)
28
34
  end
29
35
 
@@ -23,11 +23,15 @@ module Fog
23
23
  end
24
24
 
25
25
  def destroy
26
+ requires :volume_id
27
+
26
28
  connection.delete_volume(@volume_id)
27
29
  true
28
30
  end
29
31
 
30
32
  def instance=(new_instance)
33
+ requires :volume_id
34
+
31
35
  if new_instance
32
36
  attach(new_instance)
33
37
  else
@@ -36,6 +40,8 @@ module Fog
36
40
  end
37
41
 
38
42
  def save
43
+ requires :availability_zone, :size, :snapshot_id
44
+
39
45
  data = connection.create_volume(@availability_zone, @size, @snapshot_id).body
40
46
  new_attributes = data.reject {|key,value| key == 'requestId'}
41
47
  merge_attributes(new_attributes)
@@ -46,7 +52,9 @@ module Fog
46
52
  end
47
53
 
48
54
  def snapshots
49
- connection.snapshots(:volume_id => volume_id)
55
+ requires :volume_id
56
+
57
+ connection.snapshots(:volume_id => @volume_id)
50
58
  end
51
59
 
52
60
  private
@@ -10,6 +10,8 @@ module Fog
10
10
  attribute :owner
11
11
 
12
12
  def destroy
13
+ requires :name
14
+
13
15
  connection.delete_bucket(@name)
14
16
  true
15
17
  rescue Excon::Errors::NotFound
@@ -17,6 +19,8 @@ module Fog
17
19
  end
18
20
 
19
21
  def location
22
+ requires :name
23
+
20
24
  data = connection.get_bucket_location(@name)
21
25
  data.body['LocationConstraint']
22
26
  end
@@ -35,16 +39,22 @@ module Fog
35
39
  end
36
40
 
37
41
  def payer
42
+ requires :name
43
+
38
44
  data = connection.get_request_payment(@name)
39
45
  data.body['Payer']
40
46
  end
41
47
 
42
48
  def payer=(new_payer)
49
+ requires :name
50
+
43
51
  connection.put_request_payment(@name, new_payer)
44
52
  @payer = new_payer
45
53
  end
46
54
 
47
55
  def save
56
+ requires :name
57
+
48
58
  options = {}
49
59
  if @location
50
60
  options['LocationConstraint'] = @location