fog 0.3.25 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +9 -9
- data/fog.gemspec +10 -5
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/compute.rb +1 -1
- data/lib/fog/aws/models/compute/address.rb +2 -2
- data/lib/fog/aws/models/compute/addresses.rb +44 -0
- data/lib/fog/aws/models/compute/flavors.rb +124 -0
- data/lib/fog/aws/models/compute/images.rb +31 -3
- data/lib/fog/aws/models/compute/key_pairs.rb +48 -0
- data/lib/fog/aws/models/compute/security_groups.rb +57 -1
- data/lib/fog/aws/models/compute/servers.rb +79 -0
- data/lib/fog/aws/models/compute/snapshots.rb +1 -1
- data/lib/fog/aws/models/compute/tags.rb +1 -1
- data/lib/fog/aws/models/compute/volume.rb +2 -2
- data/lib/fog/aws/models/compute/volumes.rb +69 -0
- data/lib/fog/aws/requests/cdn/post_distribution.rb +1 -1
- data/lib/fog/aws/requests/compute/create_image.rb +7 -1
- data/lib/fog/aws/requests/compute/create_snapshot.rb +7 -1
- data/lib/fog/bluebox/compute.rb +1 -1
- data/lib/fog/go_grid/compute.rb +1 -1
- data/lib/fog/new_servers/compute.rb +1 -1
- data/lib/fog/rackspace/cdn.rb +1 -1
- data/lib/fog/rackspace/compute.rb +5 -1
- data/lib/fog/rackspace/models/compute/server.rb +1 -1
- data/lib/fog/rackspace/requests/compute/confirm_resized_server.rb +34 -0
- data/lib/fog/rackspace/requests/compute/reboot_server.rb +5 -7
- data/lib/fog/rackspace/requests/compute/resize_server.rb +39 -0
- data/lib/fog/rackspace/requests/compute/revert_resized_server.rb +35 -0
- data/lib/fog/rackspace/requests/compute/server_action.rb +33 -0
- data/lib/fog/rackspace/storage.rb +1 -1
- data/lib/fog/slicehost/compute.rb +1 -1
- data/spec/aws/models/compute/volume_spec.rb +50 -28
- data/spec/aws/models/compute/volumes_spec.rb +1 -1
- data/tests/aws/requests/storage/bucket_tests.rb +6 -5
- data/tests/helper.rb +4 -0
- data/tests/rackspace/requests/compute/resize_tests.rb +47 -0
- metadata +14 -10
@@ -11,10 +11,49 @@ module Fog
|
|
11
11
|
|
12
12
|
model Fog::AWS::Compute::SecurityGroup
|
13
13
|
|
14
|
+
# Creates a new security group
|
15
|
+
#
|
16
|
+
# AWS.security_groups.new
|
17
|
+
#
|
18
|
+
# ==== Returns
|
19
|
+
#
|
20
|
+
# Returns the details of the new image
|
21
|
+
#
|
22
|
+
#>> AWS.security_groups.new
|
23
|
+
# <Fog::AWS::Compute::SecurityGroup
|
24
|
+
# name=nil,
|
25
|
+
# description=nil,
|
26
|
+
# ip_permissions=nil,
|
27
|
+
# owner_id=nil
|
28
|
+
# >
|
29
|
+
#
|
30
|
+
|
14
31
|
def initialize(attributes)
|
15
32
|
self.filters ||= {}
|
16
33
|
super
|
17
34
|
end
|
35
|
+
|
36
|
+
# Returns an array of all security groups that have been created
|
37
|
+
#
|
38
|
+
# AWS.security_groups.all
|
39
|
+
#
|
40
|
+
# ==== Returns
|
41
|
+
#
|
42
|
+
# Returns an array of all security groups
|
43
|
+
#
|
44
|
+
#>> AWS.security_groups.all
|
45
|
+
# <Fog::AWS::Compute::SecurityGroups
|
46
|
+
# filters={}
|
47
|
+
# [
|
48
|
+
# <Fog::AWS::Compute::SecurityGroup
|
49
|
+
# name="default",
|
50
|
+
# description="default group",
|
51
|
+
# ip_permissions=[{"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>-1, "toPort"=>-1, "ipRanges"=>[], "ipProtocol"=>"icmp"}, {"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>0, "toPort"=>65535, "ipRanges"=>[], "ipProtocol"=>"tcp"}, {"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>0, "toPort"=>65535, "ipRanges"=>[], "ipProtocol"=>"udp"}],
|
52
|
+
# owner_id="312571045469"
|
53
|
+
# >
|
54
|
+
# ]
|
55
|
+
# >
|
56
|
+
#
|
18
57
|
|
19
58
|
def all(filters = filters)
|
20
59
|
unless filters.is_a?(Hash)
|
@@ -22,10 +61,27 @@ module Fog
|
|
22
61
|
filters = {'group-name' => [*filters]}
|
23
62
|
end
|
24
63
|
self.filters = filters
|
25
|
-
data = connection.describe_security_groups(
|
64
|
+
data = connection.describe_security_groups(filters).body
|
26
65
|
load(data['securityGroupInfo'])
|
27
66
|
end
|
28
67
|
|
68
|
+
# Used to retreive a security group
|
69
|
+
# group name is required to get the associated flavor information.
|
70
|
+
#
|
71
|
+
# You can run the following command to get the details:
|
72
|
+
# AWS.security_groups.get("default")
|
73
|
+
#
|
74
|
+
# ==== Returns
|
75
|
+
#
|
76
|
+
#>> AWS.security_groups.get("default")
|
77
|
+
# <Fog::AWS::Compute::SecurityGroup
|
78
|
+
# name="default",
|
79
|
+
# description="default group",
|
80
|
+
# ip_permissions=[{"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>-1, "toPort"=>-1, "ipRanges"=>[], "ipProtocol"=>"icmp"}, {"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>0, "toPort"=>65535, "ipRanges"=>[], "ipProtocol"=>"tcp"}, {"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>0, "toPort"=>65535, "ipRanges"=>[], "ipProtocol"=>"udp"}],
|
81
|
+
# owner_id="312571045469"
|
82
|
+
# >
|
83
|
+
#
|
84
|
+
|
29
85
|
def get(group_name)
|
30
86
|
if group_name
|
31
87
|
self.class.new(:connection => connection).all('group-name' => group_name).first
|
@@ -11,6 +11,45 @@ module Fog
|
|
11
11
|
|
12
12
|
model Fog::AWS::Compute::Server
|
13
13
|
|
14
|
+
# Creates a new server
|
15
|
+
#
|
16
|
+
# AWS.servers.new
|
17
|
+
#
|
18
|
+
# ==== Returns
|
19
|
+
#
|
20
|
+
# Returns the details of the new server
|
21
|
+
#
|
22
|
+
#>> AWS.servers.new
|
23
|
+
# <Fog::AWS::Compute::Server
|
24
|
+
# id=nil,
|
25
|
+
# ami_launch_index=nil,
|
26
|
+
# availability_zone=nil,
|
27
|
+
# block_device_mapping=nil,
|
28
|
+
# client_token=nil,
|
29
|
+
# dns_name=nil,
|
30
|
+
# groups=["default"],
|
31
|
+
# flavor_id="m1.small",
|
32
|
+
# image_id=nil,
|
33
|
+
# ip_address=nil,
|
34
|
+
# kernel_id=nil,
|
35
|
+
# key_name=nil,
|
36
|
+
# created_at=nil,
|
37
|
+
# monitoring=nil,
|
38
|
+
# product_codes=nil,
|
39
|
+
# private_dns_name=nil,
|
40
|
+
# private_ip_address=nil,
|
41
|
+
# ramdisk_id=nil,
|
42
|
+
# reason=nil,
|
43
|
+
# root_device_name=nil,
|
44
|
+
# root_device_type=nil,
|
45
|
+
# state=nil,
|
46
|
+
# state_reason=nil,
|
47
|
+
# subnet_id=nil,
|
48
|
+
# tags=nil,
|
49
|
+
# user_data=nil
|
50
|
+
# >
|
51
|
+
#
|
52
|
+
|
14
53
|
def initialize(attributes)
|
15
54
|
self.filters ||= {}
|
16
55
|
super
|
@@ -64,6 +103,46 @@ module Fog
|
|
64
103
|
server
|
65
104
|
end
|
66
105
|
|
106
|
+
# Used to retreive a server
|
107
|
+
#
|
108
|
+
# server_id is required to get the associated server information.
|
109
|
+
#
|
110
|
+
# You can run the following command to get the details:
|
111
|
+
# AWS.servers.get("i-5c973972")
|
112
|
+
#
|
113
|
+
# ==== Returns
|
114
|
+
#
|
115
|
+
#>> AWS.servers.get("i-5c973972")
|
116
|
+
# <Fog::AWS::Compute::Server
|
117
|
+
# id="i-5c973972",
|
118
|
+
# ami_launch_index=0,
|
119
|
+
# availability_zone="us-east-1b",
|
120
|
+
# block_device_mapping=[],
|
121
|
+
# client_token=nil,
|
122
|
+
# dns_name="ec2-25-2-474-44.compute-1.amazonaws.com",
|
123
|
+
# groups=["default"],
|
124
|
+
# flavor_id="m1.small",
|
125
|
+
# image_id="test",
|
126
|
+
# ip_address="25.2.474.44",
|
127
|
+
# kernel_id="aki-4e1e1da7",
|
128
|
+
# key_name=nil,
|
129
|
+
# created_at=Mon Nov 29 18:09:34 -0500 2010,
|
130
|
+
# monitoring=false,
|
131
|
+
# product_codes=[],
|
132
|
+
# private_dns_name="ip-19-76-384-60.ec2.internal",
|
133
|
+
# private_ip_address="19.76.384.60",
|
134
|
+
# ramdisk_id="ari-0b3fff5c",
|
135
|
+
# reason=nil,
|
136
|
+
# root_device_name=nil,
|
137
|
+
# root_device_type="instance-store",
|
138
|
+
# state="running",
|
139
|
+
# state_reason={},
|
140
|
+
# subnet_id=nil,
|
141
|
+
# tags={},
|
142
|
+
# user_data=nil
|
143
|
+
# >
|
144
|
+
#
|
145
|
+
|
67
146
|
def get(server_id)
|
68
147
|
if server_id
|
69
148
|
self.class.new(:connection => connection).all('instance-id' => server_id).first
|
@@ -87,7 +87,7 @@ module Fog
|
|
87
87
|
@server = nil
|
88
88
|
self.server_id = nil
|
89
89
|
unless new_record?
|
90
|
-
connection.detach_volume(
|
90
|
+
connection.detach_volume(id)
|
91
91
|
reload
|
92
92
|
end
|
93
93
|
end
|
@@ -96,7 +96,7 @@ module Fog
|
|
96
96
|
@server = nil
|
97
97
|
self.server_id = nil
|
98
98
|
unless new_record?
|
99
|
-
connection.detach_volume(
|
99
|
+
connection.detach_volume(id, 'Force' => true)
|
100
100
|
reload
|
101
101
|
end
|
102
102
|
end
|
@@ -12,11 +12,56 @@ module Fog
|
|
12
12
|
|
13
13
|
model Fog::AWS::Compute::Volume
|
14
14
|
|
15
|
+
# Used to create a volume. There are 3 arguments and availability_zone and size are required. You can generate a new key_pair as follows:
|
16
|
+
# AWS.volumes.create(:availability_zone => 'us-east-1a', :size => 't1.micro')
|
17
|
+
#
|
18
|
+
# ==== Returns
|
19
|
+
#
|
20
|
+
#<Fog::AWS::Compute::Volume
|
21
|
+
# id="vol-1e2028b9",
|
22
|
+
# attached_at=nil,
|
23
|
+
# availability_zone="us-east-1a",
|
24
|
+
# created_at=Tue Nov 23 23:30:29 -0500 2010,
|
25
|
+
# delete_on_termination=nil,
|
26
|
+
# device=nil,
|
27
|
+
# server_id=nil,
|
28
|
+
# size="t1.micro",
|
29
|
+
# snapshot_id=nil,
|
30
|
+
# state="creating",
|
31
|
+
# tags=nil
|
32
|
+
#>
|
33
|
+
#
|
34
|
+
# The volume can be retreived by running AWS.volumes.get("vol-1e2028b9"). See get method below.
|
35
|
+
#
|
36
|
+
|
15
37
|
def initialize(attributes)
|
16
38
|
self.filters ||= {}
|
17
39
|
super
|
18
40
|
end
|
19
41
|
|
42
|
+
# Used to return all volumes.
|
43
|
+
# AWS.volumes.all
|
44
|
+
#
|
45
|
+
# ==== Returns
|
46
|
+
#
|
47
|
+
#>>AWS.volumes.all
|
48
|
+
#<Fog::AWS::Compute::Volume
|
49
|
+
# id="vol-1e2028b9",
|
50
|
+
# attached_at=nil,
|
51
|
+
# availability_zone="us-east-1a",
|
52
|
+
# created_at=Tue Nov 23 23:30:29 -0500 2010,
|
53
|
+
# delete_on_termination=nil,
|
54
|
+
# device=nil,
|
55
|
+
# server_id=nil,
|
56
|
+
# size="t1.micro",
|
57
|
+
# snapshot_id=nil,
|
58
|
+
# state="creating",
|
59
|
+
# tags=nil
|
60
|
+
#>
|
61
|
+
#
|
62
|
+
# The volume can be retreived by running AWS.volumes.get("vol-1e2028b9"). See get method below.
|
63
|
+
#
|
64
|
+
|
20
65
|
def all(filters = filters)
|
21
66
|
unless filters.is_a?(Hash)
|
22
67
|
Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('volume-id' => []) instead[/] [light_black](#{caller.first})[/]")
|
@@ -31,6 +76,30 @@ module Fog
|
|
31
76
|
self
|
32
77
|
end
|
33
78
|
|
79
|
+
# Used to retreive a volume
|
80
|
+
# volume_id is required to get the associated volume information.
|
81
|
+
#
|
82
|
+
# You can run the following command to get the details:
|
83
|
+
# AWS.volumes.get("vol-1e2028b9")
|
84
|
+
#
|
85
|
+
# ==== Returns
|
86
|
+
#
|
87
|
+
#>> AWS.volumes.get("vol-1e2028b9")
|
88
|
+
# <Fog::AWS::Compute::Volume
|
89
|
+
# id="vol-1e2028b9",
|
90
|
+
# attached_at=nil,
|
91
|
+
# availability_zone="us-east-1a",
|
92
|
+
# created_at=Tue Nov 23 23:30:29 -0500 2010,
|
93
|
+
# delete_on_termination=nil,
|
94
|
+
# device=nil,
|
95
|
+
# server_id=nil,
|
96
|
+
# size="t1.micro",
|
97
|
+
# snapshot_id=nil,
|
98
|
+
# state="available",
|
99
|
+
# tags={}
|
100
|
+
# >
|
101
|
+
#
|
102
|
+
|
34
103
|
def get(volume_id)
|
35
104
|
if volume_id
|
36
105
|
self.class.new(:connection => connection).all('volume-id' => volume_id).first
|
@@ -18,6 +18,7 @@ module Fog
|
|
18
18
|
# * body<~Hash>:
|
19
19
|
# * 'imageId'<~String> - The ID of the created AMI.
|
20
20
|
# * 'requestId'<~String> - Id of request.
|
21
|
+
|
21
22
|
def create_image(instance_id, name, description, no_reboot = false)
|
22
23
|
request(
|
23
24
|
'Action' => 'CreateImage',
|
@@ -31,7 +32,12 @@ module Fog
|
|
31
32
|
end
|
32
33
|
|
33
34
|
class Mock
|
34
|
-
|
35
|
+
|
36
|
+
# Usage
|
37
|
+
#
|
38
|
+
# AWS[:compute].create_image("i-ac65ee8c", "test", "something")
|
39
|
+
#
|
40
|
+
|
35
41
|
def create_image(instance_id, name, description, no_reboot = false)
|
36
42
|
response = Excon::Response.new
|
37
43
|
if instance_id && !name.empty?
|
@@ -31,7 +31,13 @@ module Fog
|
|
31
31
|
end
|
32
32
|
|
33
33
|
class Mock
|
34
|
-
|
34
|
+
|
35
|
+
#
|
36
|
+
# Usage
|
37
|
+
#
|
38
|
+
# AWS[:compute].create_snapshot("vol-f7c23423", "latest snapshot")
|
39
|
+
#
|
40
|
+
|
35
41
|
def create_snapshot(volume_id, description = nil)
|
36
42
|
response = Excon::Response.new
|
37
43
|
if volume = @data[:volumes][volume_id]
|
data/lib/fog/bluebox/compute.rb
CHANGED
@@ -68,7 +68,7 @@ module Fog
|
|
68
68
|
|
69
69
|
begin
|
70
70
|
response = @connection.request(params.merge!({:host => @host}))
|
71
|
-
rescue Excon::Errors::
|
71
|
+
rescue Excon::Errors::HTTPStatusError => error
|
72
72
|
raise case error
|
73
73
|
when Excon::Errors::NotFound
|
74
74
|
Fog::Bluebox::Compute::NotFound.slurp(error)
|
data/lib/fog/go_grid/compute.rb
CHANGED
@@ -81,7 +81,7 @@ module Fog
|
|
81
81
|
response = @connection.request(
|
82
82
|
params.merge!(:path => "#{@path}/#{params[:path]}")
|
83
83
|
)
|
84
|
-
rescue Excon::Errors::
|
84
|
+
rescue Excon::Errors::HTTPStatusError => error
|
85
85
|
raise case error
|
86
86
|
when Excon::Errors::NotFound
|
87
87
|
Fog::GoGrid::Compute::NotFound.slurp(error)
|
@@ -70,7 +70,7 @@ module Fog
|
|
70
70
|
|
71
71
|
begin
|
72
72
|
response = @connection.request(params.merge!({:host => @host}))
|
73
|
-
rescue Excon::Errors::
|
73
|
+
rescue Excon::Errors::HTTPStatusError => error
|
74
74
|
raise case error
|
75
75
|
when Excon::Errors::NotFound
|
76
76
|
Fog::NewServers::Compute::NotFound.slurp(error)
|
data/lib/fog/rackspace/cdn.rb
CHANGED
@@ -61,7 +61,7 @@ module Fog
|
|
61
61
|
:host => @host,
|
62
62
|
:path => "#{@path}/#{params[:path]}",
|
63
63
|
}))
|
64
|
-
rescue Excon::Errors::
|
64
|
+
rescue Excon::Errors::HTTPStatusError => error
|
65
65
|
raise case error
|
66
66
|
when Excon::Errors::NotFound
|
67
67
|
Fog::Rackspace::Storage::NotFound.slurp(error)
|
@@ -13,6 +13,7 @@ module Fog
|
|
13
13
|
collection :servers
|
14
14
|
|
15
15
|
request_path 'fog/rackspace/requests/compute'
|
16
|
+
request :confirm_resized_server
|
16
17
|
request :create_image
|
17
18
|
request :create_server
|
18
19
|
request :delete_image
|
@@ -30,6 +31,9 @@ module Fog
|
|
30
31
|
request :list_servers
|
31
32
|
request :list_servers_detail
|
32
33
|
request :reboot_server
|
34
|
+
request :revert_resized_server
|
35
|
+
request :resize_server
|
36
|
+
request :server_action
|
33
37
|
request :update_server
|
34
38
|
|
35
39
|
class Mock
|
@@ -88,7 +92,7 @@ module Fog
|
|
88
92
|
:host => @host,
|
89
93
|
:path => "#{@path}/#{params[:path]}"
|
90
94
|
}))
|
91
|
-
rescue Excon::Errors::
|
95
|
+
rescue Excon::Errors::HTTPStatusError => error
|
92
96
|
raise case error
|
93
97
|
when Excon::Errors::NotFound
|
94
98
|
Fog::Rackspace::Compute::NotFound.slurp(error)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Fog
|
2
|
+
module Rackspace
|
3
|
+
class Compute
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Confirm resizing
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * server_id<~Integer> - Id of server to confirm
|
10
|
+
#
|
11
|
+
def confirm_resized_server(server_id)
|
12
|
+
body = { 'confirmResize' => nil }
|
13
|
+
server_action(server_id, body, 204)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class Mock
|
19
|
+
|
20
|
+
def confirm_resized_server(server_id)
|
21
|
+
response = Excon::Response.new
|
22
|
+
response.status = 204
|
23
|
+
|
24
|
+
@data[:servers][server_id].delete('old_flavorId')
|
25
|
+
@data[:last_modified][:servers][server_id] = Time.now
|
26
|
+
@data[:servers][server_id]['status'] = 'ACTIVE'
|
27
|
+
|
28
|
+
response
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|