fog 0.0.87 → 0.0.88

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -10,4 +10,3 @@ gem 'nokogiri', ">= 0"
10
10
  gem 'ruby-hmac', ">= 0"
11
11
  gem 'rspec', '>= 0'
12
12
  gem 'shindo', '>= 0'
13
- gem 'fog', :path => '.'
data/Gemfile.lock CHANGED
@@ -2,34 +2,28 @@
2
2
  specs:
3
3
  - rake:
4
4
  version: 0.8.7
5
- - annals:
6
- version: 0.0.3
7
5
  - excon:
8
6
  version: 0.0.21
9
7
  - formatador:
10
- version: 0.0.13
8
+ version: 0.0.14
9
+ - gestalt:
10
+ version: 0.0.6
11
11
  - json:
12
- version: 1.4.1
12
+ version: 1.4.2
13
13
  - mime-types:
14
14
  version: "1.16"
15
15
  - net-ssh:
16
16
  version: 2.0.22
17
17
  - nokogiri:
18
18
  version: 1.4.1
19
- - ruby-hmac:
20
- version: 0.4.0
21
- - fog:
22
- version: 0.0.84
23
- source: 0
24
19
  - rspec:
25
20
  version: 1.3.0
21
+ - ruby-hmac:
22
+ version: 0.4.0
26
23
  - shindo:
27
- version: 0.0.17
28
- hash: 6cf30542dfb9f6105f2e82d59ca1b74d7285aa68
24
+ version: 0.0.18
25
+ hash: e443f12a9a7794f2ff4fc8e8d201b12b1e8b30bb
29
26
  sources:
30
- - Path:
31
- path: !ruby/object:Pathname
32
- path: .
33
27
  - Rubygems:
34
28
  uri: http://gemcutter.org
35
29
  dependencies:
@@ -41,19 +35,19 @@ dependencies:
41
35
  version: ">= 0"
42
36
  group:
43
37
  - :default
44
- rspec:
38
+ rake:
45
39
  version: ">= 0"
46
40
  group:
47
41
  - :default
48
- rake:
42
+ rspec:
49
43
  version: ">= 0"
50
44
  group:
51
45
  - :default
52
- mime-types:
46
+ ruby-hmac:
53
47
  version: ">= 0"
54
48
  group:
55
49
  - :default
56
- ruby-hmac:
50
+ mime-types:
57
51
  version: ">= 0"
58
52
  group:
59
53
  - :default
@@ -61,7 +55,7 @@ dependencies:
61
55
  version: ">= 0"
62
56
  group:
63
57
  - :default
64
- fog:
58
+ json:
65
59
  version: ">= 0"
66
60
  group:
67
61
  - :default
@@ -69,10 +63,6 @@ dependencies:
69
63
  version: ">= 0.0.21"
70
64
  group:
71
65
  - :default
72
- json:
73
- version: ">= 0"
74
- group:
75
- - :default
76
66
  shindo:
77
67
  version: ">= 0"
78
68
  group:
data/bin/fog CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'fog'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
3
3
  require 'irb'
4
4
  require 'yaml'
5
5
  require 'fog/credentials'
data/fog.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.0.87'
10
+ s.version = '0.0.88'
11
11
  s.date = '2010-05-03'
12
12
  s.rubyforge_project = 'fog'
13
13
 
@@ -155,6 +155,7 @@ Gem::Specification.new do |s|
155
155
  lib/fog/aws/requests/ec2/detach_volume.rb
156
156
  lib/fog/aws/requests/ec2/disassociate_address.rb
157
157
  lib/fog/aws/requests/ec2/get_console_output.rb
158
+ lib/fog/aws/requests/ec2/modify_image_attributes.rb
158
159
  lib/fog/aws/requests/ec2/reboot_instances.rb
159
160
  lib/fog/aws/requests/ec2/release_address.rb
160
161
  lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb
data/lib/fog.rb CHANGED
@@ -33,8 +33,8 @@ require 'fog/terremark'
33
33
 
34
34
  module Fog
35
35
 
36
- unless VERSION
37
- VERSION = '0.0.87'
36
+ unless const_defined?(:VERSION)
37
+ VERSION = '0.0.88'
38
38
  end
39
39
 
40
40
  module Mock
data/lib/fog/aws/ec2.rb CHANGED
@@ -66,6 +66,7 @@ module Fog
66
66
  require 'fog/aws/requests/ec2/detach_volume'
67
67
  require 'fog/aws/requests/ec2/disassociate_address'
68
68
  require 'fog/aws/requests/ec2/get_console_output'
69
+ require 'fog/aws/requests/ec2/modify_image_attributes'
69
70
  require 'fog/aws/requests/ec2/reboot_instances'
70
71
  require 'fog/aws/requests/ec2/release_address'
71
72
  require 'fog/aws/requests/ec2/revoke_security_group_ingress'
@@ -29,10 +29,10 @@ module Fog
29
29
  @directory
30
30
  end
31
31
 
32
- def copy(target_directory_name, target_file_key)
32
+ def copy(target_directory_key, target_file_key)
33
33
  requires :directory, :key
34
- data = connection.copy_object(directory.name, @key, target_directory_name, target_file_key).body
35
- target_directory = connection.directories.new(:name => target_directory_name)
34
+ data = connection.copy_object(directory.key, @key, target_directory_key, target_file_key).body
35
+ target_directory = connection.directories.new(:key => target_directory_key)
36
36
  target_file = target_directory.files.new(attributes.merge!(:key => target_file_key))
37
37
  copy_data = {}
38
38
  for key, value in data
@@ -46,7 +46,7 @@ module Fog
46
46
 
47
47
  def destroy
48
48
  requires :directory, :key
49
- connection.delete_object(directory.name, @key)
49
+ connection.delete_object(directory.key, @key)
50
50
  true
51
51
  end
52
52
 
@@ -61,7 +61,7 @@ module Fog
61
61
 
62
62
  def save(options = {})
63
63
  requires :body, :directory, :key
64
- data = connection.put_object(directory.name, @key, @body, options)
64
+ data = connection.put_object(directory.key, @key, @body, options)
65
65
  @etag = data.headers['ETag']
66
66
  true
67
67
  end
@@ -26,7 +26,7 @@ module Fog
26
26
  options = options.reject {|key,value| value.nil? || value.to_s.empty?}
27
27
  merge_attributes(options)
28
28
  parent = directory.collection.get(
29
- directory.name,
29
+ directory.key,
30
30
  options
31
31
  )
32
32
  if parent
@@ -37,7 +37,7 @@ module Fog
37
37
  end
38
38
 
39
39
  def get(key, options = {}, &block)
40
- data = connection.get_object(directory.name, key, options, &block)
40
+ data = connection.get_object(directory.key, key, options, &block)
41
41
  file_data = {
42
42
  :body => data.body,
43
43
  :key => key
@@ -53,11 +53,11 @@ module Fog
53
53
  end
54
54
 
55
55
  def get_url(key, expires)
56
- connection.get_object_url(directory.name, key, expires)
56
+ connection.get_object_url(directory.key, key, expires)
57
57
  end
58
58
 
59
59
  def head(key, options = {})
60
- data = connection.head_object(directory.name, key, options)
60
+ data = connection.head_object(directory.key, key, options)
61
61
  file_data = {
62
62
  :key => key
63
63
  }
@@ -0,0 +1,38 @@
1
+ module Fog
2
+ module AWS
3
+ module EC2
4
+ class Real
5
+
6
+ # Modify image attributes
7
+ #
8
+ # ==== Parameters
9
+ # * image_id<~String> - Id of machine image to modify
10
+ # * attribute<~String> - Attribute to modify, in ['launchPermission', 'productCodes']
11
+ # * operation_type<~String> - Operation to perform on attribute, in ['add', 'remove']
12
+ #
13
+ def modify_image_attributes(image_id, attribute, operation_type, options = {})
14
+ params = {}
15
+ params.merge!(AWS.indexed_param('UserId', options['UserId']))
16
+ params.merge!(AWS.indexed_param('UserGroup', options['UserGroup']))
17
+ params.merge!(AWS.indexed_param('ProductCode', options['ProductCode']))
18
+ request({
19
+ 'Action' => 'ModifyImageAttribute',
20
+ 'Attribute' => attribute,
21
+ 'ImageId' => image_id,
22
+ 'OperationType' => operation,
23
+ :parser => Fog::Parsers::AWS::EC2::Basic.new
24
+ }.merge!(params))
25
+ end
26
+
27
+ end
28
+
29
+ class Mock
30
+
31
+ def modify_image_attributes(image_id, user_id, options = {})
32
+ raise MockNotImplemented.new("Contributions welcome!")
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -4,7 +4,10 @@ module Fog
4
4
  def deprecate(older, newer)
5
5
  class_eval <<-EOS, __FILE__, __LINE__
6
6
  def #{older}(*args)
7
- Formatador.display_line("[yellow][WARN] #{self} => ##{older} is deprecated, use ##{newer} instead[/]")
7
+ location = caller.first
8
+ warning = "[yellow][WARN] #{self} => ##{older} is deprecated, use ##{newer} instead[/]"
9
+ warning << " [light_black](" << location << ")[/] "
10
+ Formatador.display_line(warning)
8
11
  #{newer}(*args)
9
12
  end
10
13
  EOS
data/lib/fog/model.rb CHANGED
@@ -51,6 +51,10 @@ module Fog
51
51
  send(self.class.instance_variable_get('@identity'))
52
52
  end
53
53
 
54
+ def identity=(new_identity)
55
+ send("#{identity}=", new_identity)
56
+ end
57
+
54
58
  def initialize(new_attributes = {})
55
59
  merge_attributes(new_attributes)
56
60
  end
@@ -5,8 +5,8 @@ describe 'Fog::AWS::S3::Directories' do
5
5
  describe "#all" do
6
6
 
7
7
  it "should include persisted directories" do
8
- @directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
9
- AWS[:s3].directories.all.map {|directory| @directory.name}.should include('fogdirectoryname')
8
+ @directory = AWS[:s3].directories.create(:key => 'fogdirectorykey')
9
+ AWS[:s3].directories.all.map {|directory| @directory.key}.should include('fogdirectorykey')
10
10
  @directory.destroy
11
11
  end
12
12
 
@@ -15,8 +15,8 @@ describe 'Fog::AWS::S3::Directories' do
15
15
  describe "#create" do
16
16
 
17
17
  it "should exist on s3" do
18
- directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
19
- AWS[:s3].directories.get(directory.name).should_not be_nil
18
+ directory = AWS[:s3].directories.create(:key => 'fogdirectorykey')
19
+ AWS[:s3].directories.get(directory.key).should_not be_nil
20
20
  directory.destroy
21
21
  end
22
22
 
@@ -25,8 +25,8 @@ describe 'Fog::AWS::S3::Directories' do
25
25
  describe "#get" do
26
26
 
27
27
  it "should return a Fog::AWS::S3::Directory if a matching directory exists" do
28
- directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
29
- get = AWS[:s3].directories.get('fogdirectoryname')
28
+ directory = AWS[:s3].directories.create(:key => 'fogdirectorykey')
29
+ get = AWS[:s3].directories.get('fogdirectorykey')
30
30
  directory.attributes.should == get.attributes
31
31
  directory.destroy
32
32
  end
@@ -8,7 +8,7 @@ describe 'Fog::AWS::S3::Directory' do
8
8
  now = Time.now
9
9
  directory = Fog::AWS::S3::Directory.new(
10
10
  'CreationDate' => now,
11
- 'Key' => 'directorykey'
11
+ 'Name' => 'directorykey'
12
12
  )
13
13
  directory.creation_date.should == now
14
14
  directory.key.should == 'directorykey'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 87
9
- version: 0.0.87
8
+ - 88
9
+ version: 0.0.88
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -233,6 +233,7 @@ files:
233
233
  - lib/fog/aws/requests/ec2/detach_volume.rb
234
234
  - lib/fog/aws/requests/ec2/disassociate_address.rb
235
235
  - lib/fog/aws/requests/ec2/get_console_output.rb
236
+ - lib/fog/aws/requests/ec2/modify_image_attributes.rb
236
237
  - lib/fog/aws/requests/ec2/reboot_instances.rb
237
238
  - lib/fog/aws/requests/ec2/release_address.rb
238
239
  - lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb