fog 0.3.25 → 0.3.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Gemfile.lock +9 -9
  2. data/fog.gemspec +10 -5
  3. data/lib/fog.rb +1 -1
  4. data/lib/fog/aws/compute.rb +1 -1
  5. data/lib/fog/aws/models/compute/address.rb +2 -2
  6. data/lib/fog/aws/models/compute/addresses.rb +44 -0
  7. data/lib/fog/aws/models/compute/flavors.rb +124 -0
  8. data/lib/fog/aws/models/compute/images.rb +31 -3
  9. data/lib/fog/aws/models/compute/key_pairs.rb +48 -0
  10. data/lib/fog/aws/models/compute/security_groups.rb +57 -1
  11. data/lib/fog/aws/models/compute/servers.rb +79 -0
  12. data/lib/fog/aws/models/compute/snapshots.rb +1 -1
  13. data/lib/fog/aws/models/compute/tags.rb +1 -1
  14. data/lib/fog/aws/models/compute/volume.rb +2 -2
  15. data/lib/fog/aws/models/compute/volumes.rb +69 -0
  16. data/lib/fog/aws/requests/cdn/post_distribution.rb +1 -1
  17. data/lib/fog/aws/requests/compute/create_image.rb +7 -1
  18. data/lib/fog/aws/requests/compute/create_snapshot.rb +7 -1
  19. data/lib/fog/bluebox/compute.rb +1 -1
  20. data/lib/fog/go_grid/compute.rb +1 -1
  21. data/lib/fog/new_servers/compute.rb +1 -1
  22. data/lib/fog/rackspace/cdn.rb +1 -1
  23. data/lib/fog/rackspace/compute.rb +5 -1
  24. data/lib/fog/rackspace/models/compute/server.rb +1 -1
  25. data/lib/fog/rackspace/requests/compute/confirm_resized_server.rb +34 -0
  26. data/lib/fog/rackspace/requests/compute/reboot_server.rb +5 -7
  27. data/lib/fog/rackspace/requests/compute/resize_server.rb +39 -0
  28. data/lib/fog/rackspace/requests/compute/revert_resized_server.rb +35 -0
  29. data/lib/fog/rackspace/requests/compute/server_action.rb +33 -0
  30. data/lib/fog/rackspace/storage.rb +1 -1
  31. data/lib/fog/slicehost/compute.rb +1 -1
  32. data/spec/aws/models/compute/volume_spec.rb +50 -28
  33. data/spec/aws/models/compute/volumes_spec.rb +1 -1
  34. data/tests/aws/requests/storage/bucket_tests.rb +6 -5
  35. data/tests/helper.rb +4 -0
  36. data/tests/rackspace/requests/compute/resize_tests.rb +47 -0
  37. metadata +14 -10
@@ -1,28 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fog (0.3.25)
4
+ fog (0.3.26)
5
5
  builder
6
- excon (>= 0.2.4)
6
+ excon (>= 0.2.8)
7
7
  formatador (>= 0.0.16)
8
8
  json
9
9
  mime-types
10
- net-ssh (~> 2.0.23)
11
- nokogiri (~> 1.4.3.1)
10
+ net-ssh (>= 2.0.23)
11
+ nokogiri (>= 1.4.4)
12
12
  ruby-hmac
13
13
 
14
14
  GEM
15
15
  remote: http://rubygems.org/
16
16
  specs:
17
17
  builder (2.1.2)
18
- excon (0.2.4)
18
+ excon (0.2.8)
19
19
  formatador (0.0.16)
20
20
  gestalt (0.0.11)
21
21
  formatador (>= 0.0.12)
22
22
  json (1.4.6)
23
23
  mime-types (1.16)
24
24
  net-ssh (2.0.23)
25
- nokogiri (1.4.3.1)
25
+ nokogiri (1.4.4)
26
26
  rake (0.8.7)
27
27
  rspec (1.3.1)
28
28
  ruby-hmac (0.4.0)
@@ -35,13 +35,13 @@ PLATFORMS
35
35
 
36
36
  DEPENDENCIES
37
37
  builder
38
- excon (>= 0.2.4)
38
+ excon (>= 0.2.8)
39
39
  fog!
40
40
  formatador (>= 0.0.16)
41
41
  json
42
42
  mime-types
43
- net-ssh (~> 2.0.23)
44
- nokogiri (~> 1.4.3.1)
43
+ net-ssh (>= 2.0.23)
44
+ nokogiri (>= 1.4.4)
45
45
  rake
46
46
  rspec (= 1.3.1)
47
47
  ruby-hmac
@@ -7,8 +7,8 @@ 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.3.25'
11
- s.date = '2010-11-23'
10
+ s.version = '0.3.26'
11
+ s.date = '2010-12-01'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -43,12 +43,12 @@ Gem::Specification.new do |s|
43
43
  ## List your runtime dependencies here. Runtime dependencies are those
44
44
  ## that are needed for an end user to actually USE your code.
45
45
  s.add_dependency('builder')
46
- s.add_dependency('excon', '>=0.2.4')
46
+ s.add_dependency('excon', '>=0.2.8')
47
47
  s.add_dependency('formatador', '>=0.0.16')
48
48
  s.add_dependency('json')
49
49
  s.add_dependency('mime-types')
50
- s.add_dependency('net-ssh', '~>2.0.23')
51
- s.add_dependency('nokogiri', '~>1.4.3.1')
50
+ s.add_dependency('net-ssh', '>=2.0.23')
51
+ s.add_dependency('nokogiri', '>=1.4.4')
52
52
  s.add_dependency('ruby-hmac')
53
53
 
54
54
  ## List your development dependencies here. Development dependencies are
@@ -462,6 +462,7 @@ Gem::Specification.new do |s|
462
462
  lib/fog/rackspace/requests/cdn/get_containers.rb
463
463
  lib/fog/rackspace/requests/cdn/head_container.rb
464
464
  lib/fog/rackspace/requests/cdn/put_container.rb
465
+ lib/fog/rackspace/requests/compute/confirm_resized_server.rb
465
466
  lib/fog/rackspace/requests/compute/create_image.rb
466
467
  lib/fog/rackspace/requests/compute/create_server.rb
467
468
  lib/fog/rackspace/requests/compute/delete_image.rb
@@ -479,6 +480,9 @@ Gem::Specification.new do |s|
479
480
  lib/fog/rackspace/requests/compute/list_servers.rb
480
481
  lib/fog/rackspace/requests/compute/list_servers_detail.rb
481
482
  lib/fog/rackspace/requests/compute/reboot_server.rb
483
+ lib/fog/rackspace/requests/compute/resize_server.rb
484
+ lib/fog/rackspace/requests/compute/revert_resized_server.rb
485
+ lib/fog/rackspace/requests/compute/server_action.rb
482
486
  lib/fog/rackspace/requests/compute/update_server.rb
483
487
  lib/fog/rackspace/requests/storage/delete_container.rb
484
488
  lib/fog/rackspace/requests/storage/delete_object.rb
@@ -801,6 +805,7 @@ Gem::Specification.new do |s|
801
805
  tests/rackspace/requests/compute/address_tests.rb
802
806
  tests/rackspace/requests/compute/flavor_tests.rb
803
807
  tests/rackspace/requests/compute/image_tests.rb
808
+ tests/rackspace/requests/compute/resize_tests.rb
804
809
  tests/rackspace/requests/compute/server_tests.rb
805
810
  tests/rackspace/requests/storage/container_tests.rb
806
811
  tests/rackspace/requests/storage/object_tests.rb
data/lib/fog.rb CHANGED
@@ -18,7 +18,7 @@ module Fog
18
18
  @mocking = false
19
19
 
20
20
  unless const_defined?(:VERSION)
21
- VERSION = '0.3.25'
21
+ VERSION = '0.3.26'
22
22
  end
23
23
 
24
24
  module Mock
@@ -219,7 +219,7 @@ module Fog
219
219
  :method => 'POST',
220
220
  :parser => parser
221
221
  })
222
- rescue Excon::Errors::Error => error
222
+ rescue Excon::Errors::HTTPStatusError => error
223
223
  if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/)
224
224
  raise case match[1].split('.').last
225
225
  when 'NotFound'
@@ -50,7 +50,7 @@ module Fog
50
50
  else
51
51
  @server = nil
52
52
  self.server_id = new_server.id
53
- connection.associate_address(@server_id, @public_ip)
53
+ connection.associate_address(server_id, public_ip)
54
54
  end
55
55
  end
56
56
 
@@ -58,7 +58,7 @@ module Fog
58
58
  @server = nil
59
59
  self.server_id = nil
60
60
  unless new_record?
61
- connection.disassociate_address(@public_ip)
61
+ connection.disassociate_address(public_ip)
62
62
  end
63
63
  end
64
64
 
@@ -12,11 +12,48 @@ module Fog
12
12
 
13
13
  model Fog::AWS::Compute::Address
14
14
 
15
+ # Used to create an IP address
16
+ #
17
+ # ==== Returns
18
+ #
19
+ #>> AWS.addresses.create
20
+ # <Fog::AWS::Compute::Address
21
+ # public_ip="4.88.524.95",
22
+ # server_id=nil
23
+ # >
24
+ #
25
+ # The IP address can be retreived by running AWS.addresses.get("test"). See get method below.
26
+ #
27
+
15
28
  def initialize(attributes)
16
29
  self.filters ||= {}
17
30
  super
18
31
  end
19
32
 
33
+ # AWS.addresses.all
34
+ #
35
+ # ==== Returns
36
+ #
37
+ # Returns an array of all IP addresses
38
+ #
39
+ #>> AWS.addresses.all
40
+ # <Fog::AWS::Compute::Addresses
41
+ # filters={},
42
+ # server=nil
43
+ # [
44
+ # <Fog::AWS::Compute::Address
45
+ # public_ip="76.7.46.54",
46
+ # server_id=nil
47
+ # >,
48
+ # .......
49
+ # <Fog::AWS::Compute::Address
50
+ # public_ip="4.88.524.95",
51
+ # server_id=nil
52
+ # >
53
+ # ]
54
+ # >
55
+ #>>
56
+
20
57
  def all(filters = filters)
21
58
  unless filters.is_a?(Hash)
22
59
  Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('public-ip' => []) instead[/] [light_black](#{caller.first})[/]")
@@ -35,6 +72,13 @@ module Fog
35
72
  self
36
73
  end
37
74
 
75
+ # Used to retreive an IP address
76
+ #
77
+ # public_ip is required to get the associated IP information.
78
+ #
79
+ # You can run the following command to get the details:
80
+ # AWS.addresses.get("76.7.46.54")
81
+
38
82
  def get(public_ip)
39
83
  if public_ip
40
84
  self.class.new(:connection => connection).all('public-ip' => public_ip).first
@@ -9,6 +9,109 @@ module Fog
9
9
 
10
10
  model Fog::AWS::Compute::Flavor
11
11
 
12
+ # Returns an array of all flavors that have been created
13
+ #
14
+ # AWS.flavors.all
15
+ #
16
+ # ==== Returns
17
+ #
18
+ # Returns an array of all available instance sizes
19
+ #
20
+ #>> AWS.flavors.all
21
+ # <Fog::AWS::Compute::Flavors
22
+ # [
23
+ # <Fog::AWS::Compute::Flavor
24
+ # id="t1.micro",
25
+ # bits=0,
26
+ # cores=2,
27
+ # disk=0,
28
+ # name="Micro Instance",
29
+ # ram=613
30
+ # >,
31
+ # <Fog::AWS::Compute::Flavor
32
+ # id="m1.small",
33
+ # bits=32,
34
+ # cores=1,
35
+ # disk=160,
36
+ # name="Small Instance",
37
+ # ram=1740.8
38
+ # >,
39
+ # <Fog::AWS::Compute::Flavor
40
+ # id="m1.large",
41
+ # bits=64,
42
+ # cores=4,
43
+ # disk=850,
44
+ # name="Large Instance",
45
+ # ram=7680
46
+ # >,
47
+ # <Fog::AWS::Compute::Flavor
48
+ # id="m1.xlarge",
49
+ # bits=64,
50
+ # cores=8,
51
+ # disk=1690,
52
+ # name="Extra Large Instance",
53
+ # ram=15360
54
+ # >,
55
+ # <Fog::AWS::Compute::Flavor
56
+ # id="c1.medium",
57
+ # bits=32,
58
+ # cores=5,
59
+ # disk=350,
60
+ # name="High-CPU Medium",
61
+ # ram=1740.8
62
+ # >,
63
+ # <Fog::AWS::Compute::Flavor
64
+ # id="c1.xlarge",
65
+ # bits=64,
66
+ # cores=20,
67
+ # disk=1690,
68
+ # name="High-CPU Extra Large",
69
+ # ram=7168
70
+ # >,
71
+ # <Fog::AWS::Compute::Flavor
72
+ # id="m2.xlarge",
73
+ # bits=64,
74
+ # cores=6.5,
75
+ # disk=420,
76
+ # name="High-Memory Extra Large",
77
+ # ram=17510.4
78
+ # >,
79
+ # <Fog::AWS::Compute::Flavor
80
+ # id="m2.2xlarge",
81
+ # bits=64,
82
+ # cores=13,
83
+ # disk=850,
84
+ # name="High Memory Double Extra Large",
85
+ # ram=35020.8
86
+ # >,
87
+ # <Fog::AWS::Compute::Flavor
88
+ # id="m2.4xlarge",
89
+ # bits=64,
90
+ # cores=26,
91
+ # disk=1690,
92
+ # name="High Memory Quadruple Extra Large",
93
+ # ram=70041.6
94
+ # >,
95
+ # <Fog::AWS::Compute::Flavor
96
+ # id="cc1.4xlarge",
97
+ # bits=64,
98
+ # cores=33.5,
99
+ # disk=1690,
100
+ # name="Cluster Compute Quadruple Extra Large",
101
+ # ram=23552
102
+ # >,
103
+ # <Fog::AWS::Compute::Flavor
104
+ # id="cg1.4xlarge",
105
+ # bits=64,
106
+ # cores=33.5,
107
+ # disk=1690,
108
+ # name="Cluster GPU Quadruple Extra Large",
109
+ # ram=22528
110
+ # >
111
+ # ]
112
+ # >
113
+ #
114
+
12
115
  def all
13
116
  data = [
14
117
  { :bits => 0, :cores => 2, :disk => 0, :id => 't1.micro', :name => 'Micro Instance', :ram => 613},
@@ -31,6 +134,27 @@ module Fog
31
134
  self
32
135
  end
33
136
 
137
+ # Used to retreive a flavor
138
+ # flavor_id is required to get the associated flavor information.
139
+ # flavors available currently:
140
+ # 't1.micro', 'm1.small', 'm1.large', 'm1.xlarge', 'c1.medium', 'c1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'cc1.4xlarge', 'cg1.4xlarge'
141
+ #
142
+ # You can run the following command to get the details:
143
+ # AWS.flavors.get("t1.micro")
144
+ #
145
+ # ==== Returns
146
+ #
147
+ #>> AWS.flavors.get("t1.micro")
148
+ # <Fog::AWS::Compute::Flavor
149
+ # id="t1.micro",
150
+ # bits=0,
151
+ # cores=2,
152
+ # disk=0,
153
+ # name="Micro Instance",
154
+ # ram=613
155
+ #>
156
+ #
157
+
34
158
  def get(flavor_id)
35
159
  self.class.new(:connection => connection).all.detect {|flavor| flavor.id == flavor_id}
36
160
  end
@@ -10,18 +10,46 @@ module Fog
10
10
  attribute :filters
11
11
 
12
12
  model Fog::AWS::Compute::Image
13
-
13
+
14
+ # Creates a new Amazon machine image
15
+ #
16
+ # AWS.images.new
17
+ #
18
+ # ==== Returns
19
+ #
20
+ # Returns the details of the new image
21
+ #
22
+ #>> AWS.images.new
23
+ # <Fog::AWS::Compute::Image
24
+ # id=nil,
25
+ # architecture=nil,
26
+ # block_device_mapping=nil,
27
+ # location=nil,
28
+ # owner_id=nil,
29
+ # state=nil,
30
+ # type=nil,
31
+ # is_public=nil,
32
+ # kernel_id=nil,
33
+ # platform=nil,
34
+ # product_codes=nil,
35
+ # ramdisk_id=nil,
36
+ # root_device_type=nil,
37
+ # root_device_name=nil,
38
+ # tags=nil
39
+ # >
40
+ #
41
+
14
42
  def initialize(attributes)
15
43
  self.filters ||= {}
16
44
  super
17
45
  end
18
-
46
+
19
47
  def all(filters = @filters)
20
48
  self.filters = filters
21
49
  data = connection.describe_images(filters).body
22
50
  load(data['imagesSet'])
23
51
  end
24
-
52
+
25
53
  def get(image_id)
26
54
  if image_id
27
55
  self.class.new(:connection => connection).all('image-id' => image_id).first
@@ -12,11 +12,43 @@ module Fog
12
12
 
13
13
  model Fog::AWS::Compute::KeyPair
14
14
 
15
+ # Used to create a key pair. There are 3 arguments and only name is required. You can generate a new key_pair as follows:
16
+ # AWS.key_pairs.create(:name => "test", :fingerprint => "123", :private_key => '234234')
17
+ #
18
+ # ==== Returns
19
+ #
20
+ #<Fog::AWS::Compute::KeyPair
21
+ # name="test",
22
+ # fingerprint="3a:d3:e5:17:e5:e7:f7:de:fe:db:1b:c2:55:7d:94:0b:07:2e:05:aa",
23
+ # private_key="-----BEGIN RSA PRIVATE KEY-----\nf/VtfXJ/ekTSlRS2GSItBSzMrEGoZ+EXeMOuiA7HFkDcgKt6aBiOX9Bysiyfc1rIrgWdFKqXBRJA\nrtvBPa3/32koMPV4FxG7RZrPuKLITmFoEV86M0DSLo+ErlOPuDChfrR9dk6eI17/o1VmSvYsIpDc\njvbgx+tt7ZEPvduoUag7YdnUI0f20fttsdXjMlyDg9pPOVF3/hqucqOb3t5y9lvVJJxdTnEDFSjb\nvodpaDT9+ssw4IsQsZEIvfL0hK+Lt4phbclUWfG7JVnYfdd2u4zU6Nqe0+3qoR0ZOH4/zaUko7z8\n7JMbJqs5bmdWfnQTrvbJ13545FRI/W48ZRJxqPcj0t2MzasbT4gMgtNJrSadq78RkRJjNTu4lZmK\nvJejkBZPicHvo5IRSEbDc90Rhdh0aZNifXn0d0DSV2N6Ywo2o1lwRAi3/l6XSjukyRpTPcMr14MP\ntGwS1Tvez41Oa7Y96VfsJB2xtKc6LGRFiPUg2ZAEHU15Q9bIISVzHXgdAcef1bsh8UN/fDBrTusm\nvJisQ+dLaPH7cZ03od+XTwJc+IyeL4RqWuASE0NNfEVJMS+qcpt0WeNzfG0C27SwIcfEKL0sC0kn\nCfX2WpZDg7T5xN+88ftKJaN9tymxTgvoJVS1/WKvWBAXVozKp4f6K8wKmwf7VdUt/FWbUi54LW02\nf1ONkaYEOVwDgWlGxVSx43MWqvVdT2MPFNEBL7OA1LPwCO2nyQQ9UM9gCE65S9Najf939Bq8xwqx\nGNFlLmaH6biZUyL8ewRJ8Y7rMQ5cXy/gHZywjkuoyLQ8vVpmVpb7r1FaM/AYSr5l6gJEWdqbJleN\ntnhjPeE6qXISzIUBvwKzzgFTyW8ZHQtgbP3bHEiPG2/OjKHnLUoOId/eetcE+ovIxWsBrTDbf2SV\nYUD91u+W9K35eX89ZaIiohLNg4z9+QHCs4rcWyOXEfprBKcP2QU5+Y9ysnXLAmZt6QhInaAsUpQZ\nyhImA24UqvqrK0yyGhf/quouK7q0QkVQR+f7nGClIaphJkxO/xylrnK/pYObr4s3B8kmksuHiYOu\n1yz6SeRkj8F9dxkRmzbBK/G0tLkxIElDbM7icI9gsEO7vvgaR/K8hSDi0RkFPG43I20tU8PqwHe7\nR4jFW+6sB2+9FDeLn+qkoDSaxzmAuIRW082z/r7rJVIpFEo14hNhQYkNXpH40+P/hA9RFgvhZe8M\nvK4rz/eu246Kij6kObieTfpZhgGHqvtU8x5cnqEZOz5Hc5m4B+gMaTA53kFSPOA0pn6gqgiuYEdI\nZUhO8P1PkNqkmLz7NJRnz3qpAo6RisAxPBVr2WdSg4bP0YpGS/0TE4OOJwGLldx6dCsX60++mn0q\n1fhNw8oyZiguYMAeEEDWP8x/bsRaFz5L8uQVnnnj8ei1oTmZ+Uw9/48snWYcurL2jsbuWhhE0NTt\nfe/cqov7ZaZHs+Tr20ZBEDEqUEWr/MMskj/ZSVxnza1G/hztFJMAThF9ZJoGQkHWHfXCGOLLGY+z\nqi0SC8EIeu8PUxjO2SRj9S9o/Dwg3iHyM3pj57kD7fDNnl3Ed6LMoCXoaQV8BdMX4xh=\n-----END RSA PRIVATE KEY-----"
24
+ #>
25
+ #
26
+ # The key_pair can be retreived by running AWS.key_pairs.get("test"). See get method below.
27
+ #
28
+
15
29
  def initialize(attributes)
16
30
  self.filters ||= {}
17
31
  super
18
32
  end
19
33
 
34
+ # Returns an array of all key pairs that have been created
35
+ #
36
+ # AWS.key_pairs.all
37
+ #
38
+ # ==== Returns
39
+ #
40
+ # <Fog::AWS::Compute::KeyPairs
41
+ # key_name=nil
42
+ # [
43
+ # <Fog::AWS::Compute::KeyPair
44
+ # name="test",
45
+ # fingerprint="1f:26:3d:83:e7:4f:48:74:c3:1c:e6:b3:c7:f6:ec:d8:cb:09:b3:7f",
46
+ # private_key=nil
47
+ # >
48
+ # ]
49
+ #>
50
+ #
51
+
20
52
  def all(filters = filters)
21
53
  unless filters.is_a?(Hash)
22
54
  Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('key-name' => []) instead[/] [light_black](#{caller.first})[/]")
@@ -27,6 +59,22 @@ module Fog
27
59
  load(data['keySet'])
28
60
  end
29
61
 
62
+ # Used to retreive a key pair that was created with the AWS.key_pairs.create method.
63
+ # The name is required to get the associated key_pair information.
64
+ #
65
+ # You can run the following command to get the details:
66
+ # AWS.key_pairs.get("test")
67
+ #
68
+ # ==== Returns
69
+ #
70
+ #>> AWS.key_pairs.get("test")
71
+ # <Fog::AWS::Compute::KeyPair
72
+ # name="test",
73
+ # fingerprint="1f:26:3d:83:e7:4f:48:74:c3:1c:e6:b3:c7:f6:ec:d8:cb:09:b3:7f",
74
+ # private_key=nil
75
+ # >
76
+ #
77
+
30
78
  def get(key_name)
31
79
  if key_name
32
80
  self.class.new(:connection => connection).all('key-name' => key_name).first