fog 0.0.56 → 0.0.57
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/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/fog.gemspec +4 -4
- data/lib/fog/aws.rb +4 -3
- data/lib/fog/aws/ec2.rb +136 -150
- data/lib/fog/aws/models/ec2/address.rb +3 -1
- data/lib/fog/aws/models/ec2/addresses.rb +20 -6
- data/lib/fog/aws/models/ec2/flavor.rb +3 -1
- data/lib/fog/aws/models/ec2/flavors.rb +14 -3
- data/lib/fog/aws/models/ec2/image.rb +3 -1
- data/lib/fog/aws/models/ec2/images.rb +14 -3
- data/lib/fog/aws/models/ec2/key_pair.rb +3 -1
- data/lib/fog/aws/models/ec2/key_pairs.rb +14 -3
- data/lib/fog/aws/models/ec2/security_group.rb +3 -1
- data/lib/fog/aws/models/ec2/security_groups.rb +14 -3
- data/lib/fog/aws/models/ec2/server.rb +3 -1
- data/lib/fog/aws/models/ec2/servers.rb +14 -3
- data/lib/fog/aws/models/ec2/snapshot.rb +3 -1
- data/lib/fog/aws/models/ec2/snapshots.rb +18 -5
- data/lib/fog/aws/models/ec2/volume.rb +3 -1
- data/lib/fog/aws/models/ec2/volumes.rb +18 -5
- data/lib/fog/aws/models/s3/directories.rb +14 -3
- data/lib/fog/aws/models/s3/directory.rb +4 -1
- data/lib/fog/aws/models/s3/file.rb +3 -1
- data/lib/fog/aws/models/s3/files.rb +4 -1
- data/lib/fog/aws/parsers/simpledb/domain_metadata.rb +2 -0
- data/lib/fog/aws/parsers/simpledb/get_attributes.rb +2 -0
- data/lib/fog/aws/parsers/simpledb/list_domains.rb +2 -0
- data/lib/fog/aws/parsers/simpledb/select.rb +2 -0
- data/lib/fog/aws/requests/ec2/allocate_address.rb +11 -16
- data/lib/fog/aws/requests/ec2/associate_address.rb +14 -19
- data/lib/fog/aws/requests/ec2/attach_volume.rb +16 -21
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +29 -27
- data/lib/fog/aws/requests/ec2/create_key_pair.rb +13 -18
- data/lib/fog/aws/requests/ec2/create_security_group.rb +14 -19
- data/lib/fog/aws/requests/ec2/create_snapshot.rb +13 -18
- data/lib/fog/aws/requests/ec2/create_volume.rb +14 -19
- data/lib/fog/aws/requests/ec2/delete_key_pair.rb +12 -17
- data/lib/fog/aws/requests/ec2/delete_security_group.rb +13 -18
- data/lib/fog/aws/requests/ec2/delete_snapshot.rb +12 -17
- data/lib/fog/aws/requests/ec2/delete_volume.rb +13 -18
- data/lib/fog/aws/requests/ec2/describe_addresses.rb +11 -16
- data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_images.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_instances.rb +17 -22
- data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +11 -16
- data/lib/fog/aws/requests/ec2/describe_regions.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_reserved_instances.rb +9 -14
- data/lib/fog/aws/requests/ec2/describe_security_groups.rb +11 -16
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +12 -17
- data/lib/fog/aws/requests/ec2/describe_volumes.rb +14 -19
- data/lib/fog/aws/requests/ec2/detach_volume.rb +11 -16
- data/lib/fog/aws/requests/ec2/disassociate_address.rb +12 -17
- data/lib/fog/aws/requests/ec2/get_console_output.rb +12 -17
- data/lib/fog/aws/requests/ec2/reboot_instances.rb +11 -16
- data/lib/fog/aws/requests/ec2/release_address.rb +12 -17
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +10 -15
- data/lib/fog/aws/requests/ec2/run_instances.rb +36 -38
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +16 -20
- data/lib/fog/aws/requests/s3/copy_object.rb +9 -15
- data/lib/fog/aws/requests/s3/delete_bucket.rb +9 -16
- data/lib/fog/aws/requests/s3/delete_object.rb +6 -14
- data/lib/fog/aws/requests/s3/get_bucket.rb +9 -14
- data/lib/fog/aws/requests/s3/get_bucket_location.rb +8 -14
- data/lib/fog/aws/requests/s3/get_object.rb +7 -15
- data/lib/fog/aws/requests/s3/get_request_payment.rb +7 -13
- data/lib/fog/aws/requests/s3/get_service.rb +7 -13
- data/lib/fog/aws/requests/s3/head_object.rb +6 -14
- data/lib/fog/aws/requests/s3/put_bucket.rb +13 -21
- data/lib/fog/aws/requests/s3/put_object.rb +8 -16
- data/lib/fog/aws/requests/s3/put_request_payment.rb +7 -16
- data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +14 -21
- data/lib/fog/aws/requests/simpledb/create_domain.rb +11 -18
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +15 -22
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +11 -18
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +14 -19
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +19 -23
- data/lib/fog/aws/requests/simpledb/list_domains.rb +11 -16
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +15 -15
- data/lib/fog/aws/requests/simpledb/select.rb +12 -17
- data/lib/fog/aws/s3.rb +117 -121
- data/lib/fog/aws/simpledb.rb +127 -127
- data/lib/fog/rackspace/models/servers/images.rb +1 -1
- data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +11 -1
- metadata +4 -4
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module EC2
|
4
|
+
class Real
|
2
5
|
|
3
|
-
|
4
|
-
module AWS
|
5
|
-
class EC2
|
6
|
+
require 'fog/aws/parsers/ec2/terminate_instances'
|
6
7
|
|
7
8
|
# Terminate specified instances
|
8
9
|
#
|
@@ -24,32 +25,26 @@ unless Fog.mocking?
|
|
24
25
|
def terminate_instances(instance_id)
|
25
26
|
params = AWS.indexed_param('InstanceId', instance_id)
|
26
27
|
request({
|
27
|
-
'Action' => 'TerminateInstances'
|
28
|
-
|
28
|
+
'Action' => 'TerminateInstances',
|
29
|
+
:parser => Fog::Parsers::AWS::EC2::TerminateInstances.new
|
30
|
+
}.merge!(params))
|
29
31
|
end
|
30
32
|
|
31
33
|
end
|
32
|
-
end
|
33
|
-
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
module Fog
|
38
|
-
module AWS
|
39
|
-
class EC2
|
35
|
+
class Mock
|
40
36
|
|
41
37
|
def terminate_instances(instance_id)
|
42
38
|
response = Excon::Response.new
|
43
39
|
instance_id = [*instance_id]
|
44
|
-
if (
|
40
|
+
if (@data[:instances].keys & instance_id).length == instance_id.length
|
45
41
|
for instance_id in instance_id
|
46
42
|
response.body = {
|
47
43
|
'requestId' => Fog::AWS::Mock.request_id,
|
48
44
|
'instancesSet' => []
|
49
45
|
}
|
50
|
-
instance =
|
51
|
-
|
52
|
-
instance['status'] = 'deleting'
|
46
|
+
instance = @data[:instances][instance_id]
|
47
|
+
@data[:deleted_at][instance_id] = Time.now
|
53
48
|
response.status = 200
|
54
49
|
# TODO: the codes are mostly educated guessing, not certainty
|
55
50
|
code = case instance['state']
|
@@ -64,11 +59,13 @@ else
|
|
64
59
|
when 'rebooting'
|
65
60
|
128
|
66
61
|
end
|
62
|
+
state = { 'name' => 'shutting-down', 'code' => 32}
|
67
63
|
response.body['instancesSet'] << {
|
68
64
|
'instanceId' => instance_id,
|
69
|
-
'previousState' =>
|
70
|
-
'
|
65
|
+
'previousState' => instance['instanceState'],
|
66
|
+
'currentState' => state
|
71
67
|
}
|
68
|
+
instance['instanceState'] = state
|
72
69
|
end
|
73
70
|
else
|
74
71
|
response.status = 400
|
@@ -80,5 +77,4 @@ else
|
|
80
77
|
end
|
81
78
|
end
|
82
79
|
end
|
83
|
-
|
84
80
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
2
5
|
|
3
|
-
|
4
|
-
module AWS
|
5
|
-
class S3
|
6
|
+
require 'fog/aws/parsers/s3/copy_object'
|
6
7
|
|
7
8
|
# Copy an object from one S3 bucket to another
|
8
9
|
#
|
@@ -38,20 +39,14 @@ unless Fog.mocking?
|
|
38
39
|
end
|
39
40
|
|
40
41
|
end
|
41
|
-
end
|
42
|
-
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
module Fog
|
47
|
-
module AWS
|
48
|
-
class S3
|
43
|
+
class Mock
|
49
44
|
|
50
45
|
def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
|
51
46
|
response = Excon::Response.new
|
52
|
-
source_bucket =
|
47
|
+
source_bucket = @data[:buckets][source_bucket_name]
|
53
48
|
source_object = source_bucket && source_bucket[:objects][source_object_name]
|
54
|
-
target_bucket =
|
49
|
+
target_bucket = @data[:buckets][target_bucket_name]
|
55
50
|
|
56
51
|
if source_object && target_bucket
|
57
52
|
response.status = 200
|
@@ -75,5 +70,4 @@ else
|
|
75
70
|
end
|
76
71
|
end
|
77
72
|
end
|
78
|
-
|
79
|
-
end
|
73
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class S3
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
6
5
|
|
7
6
|
# Delete an S3 bucket
|
8
7
|
#
|
@@ -22,32 +21,26 @@ unless Fog.mocking?
|
|
22
21
|
end
|
23
22
|
|
24
23
|
end
|
25
|
-
end
|
26
|
-
end
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
module Fog
|
31
|
-
module AWS
|
32
|
-
class S3
|
25
|
+
class Mock
|
33
26
|
|
34
27
|
def delete_bucket(bucket_name)
|
35
28
|
response = Excon::Response.new
|
36
|
-
if
|
29
|
+
if @data[:buckets][bucket_name].nil?
|
37
30
|
response.status = 404
|
38
31
|
raise(Excon::Errors.status_error({:expects => 204}, response))
|
39
|
-
elsif
|
32
|
+
elsif @data[:buckets][bucket_name] && !@data[:buckets][bucket_name][:objects].empty?
|
40
33
|
response.status = 409
|
41
34
|
raise(Excon::Errors.status_error({:expects => 204}, response))
|
42
35
|
else
|
43
|
-
|
36
|
+
@data[:buckets].delete(bucket_name)
|
44
37
|
response.status = 204
|
45
38
|
end
|
46
39
|
response
|
47
40
|
end
|
48
41
|
|
49
42
|
end
|
43
|
+
|
50
44
|
end
|
51
45
|
end
|
52
|
-
|
53
46
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class S3
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
6
5
|
|
7
6
|
# Delete an object from S3
|
8
7
|
#
|
@@ -25,18 +24,12 @@ unless Fog.mocking?
|
|
25
24
|
end
|
26
25
|
|
27
26
|
end
|
28
|
-
end
|
29
|
-
end
|
30
27
|
|
31
|
-
|
32
|
-
|
33
|
-
module Fog
|
34
|
-
module AWS
|
35
|
-
class S3
|
28
|
+
class Mock
|
36
29
|
|
37
30
|
def delete_object(bucket_name, object_name)
|
38
31
|
response = Excon::Response.new
|
39
|
-
if bucket =
|
32
|
+
if bucket = @data[:buckets][bucket_name]
|
40
33
|
response.status = 204
|
41
34
|
bucket[:objects].delete(object_name)
|
42
35
|
else
|
@@ -49,5 +42,4 @@ else
|
|
49
42
|
end
|
50
43
|
end
|
51
44
|
end
|
52
|
-
|
53
45
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
2
5
|
|
3
|
-
|
4
|
-
module AWS
|
5
|
-
class S3
|
6
|
+
require 'fog/aws/parsers/s3/get_bucket'
|
6
7
|
|
7
8
|
# List information about objects in an S3 bucket
|
8
9
|
#
|
@@ -54,14 +55,8 @@ unless Fog.mocking?
|
|
54
55
|
end
|
55
56
|
|
56
57
|
end
|
57
|
-
end
|
58
|
-
end
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
module Fog
|
63
|
-
module AWS
|
64
|
-
class S3
|
59
|
+
class Mock
|
65
60
|
|
66
61
|
# FIXME: implement delimiter
|
67
62
|
def get_bucket(bucket_name, options = {})
|
@@ -69,16 +64,17 @@ else
|
|
69
64
|
raise ArgumentError.new('bucket_name is required')
|
70
65
|
end
|
71
66
|
response = Excon::Response.new
|
72
|
-
if bucket =
|
67
|
+
if bucket = @data[:buckets][bucket_name]
|
73
68
|
response.status = 200
|
74
69
|
response.body = {
|
75
70
|
'Contents' => bucket[:objects].values.sort {|x,y| x['Key'] <=> y['Key']}.reject do |object|
|
76
71
|
(options['prefix'] && object['Key'][0...options['prefix'].length] != options['prefix']) ||
|
77
72
|
(options['marker'] && object['Key'] <= options['marker'])
|
78
73
|
end.map do |object|
|
79
|
-
data = object.reject {|key, value| !['ETag', 'Key', 'LastModified', '
|
74
|
+
data = object.reject {|key, value| !['ETag', 'Key', 'LastModified', 'Size', 'StorageClass'].include?(key)}
|
80
75
|
data.merge!({
|
81
76
|
'LastModified' => Time.parse(data['LastModified']),
|
77
|
+
'Owner' => bucket['Owner'],
|
82
78
|
'Size' => data['Size'].to_i
|
83
79
|
})
|
84
80
|
data
|
@@ -103,5 +99,4 @@ else
|
|
103
99
|
end
|
104
100
|
end
|
105
101
|
end
|
106
|
-
|
107
102
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
2
5
|
|
3
|
-
|
4
|
-
module AWS
|
5
|
-
class S3
|
6
|
+
require 'fog/aws/parsers/s3/get_bucket_location'
|
6
7
|
|
7
8
|
# Get location constraint for an S3 bucket
|
8
9
|
#
|
@@ -26,18 +27,12 @@ unless Fog.mocking?
|
|
26
27
|
end
|
27
28
|
|
28
29
|
end
|
29
|
-
end
|
30
|
-
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
module Fog
|
35
|
-
module AWS
|
36
|
-
class S3
|
31
|
+
class Mock
|
37
32
|
|
38
33
|
def get_bucket_location(bucket_name)
|
39
34
|
response = Excon::Response.new
|
40
|
-
if bucket =
|
35
|
+
if bucket = @data[:buckets][bucket_name]
|
41
36
|
response.status = 200
|
42
37
|
response.body = {'LocationConstraint' => bucket['LocationConstraint'] }
|
43
38
|
else
|
@@ -50,5 +45,4 @@ else
|
|
50
45
|
end
|
51
46
|
end
|
52
47
|
end
|
53
|
-
|
54
|
-
end
|
48
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class S3
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
6
5
|
|
7
6
|
# Get an object from S3
|
8
7
|
#
|
@@ -56,19 +55,13 @@ unless Fog.mocking?
|
|
56
55
|
:headers => {},
|
57
56
|
:host => "#{bucket_name}.#{@host}",
|
58
57
|
:method => 'GET',
|
59
|
-
:path => object_name
|
58
|
+
:path => CGI.escape(object_name)
|
60
59
|
}, expires)
|
61
60
|
end
|
62
61
|
|
63
62
|
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
else
|
68
63
|
|
69
|
-
|
70
|
-
module AWS
|
71
|
-
class S3
|
64
|
+
class Mock
|
72
65
|
|
73
66
|
def get_object(bucket_name, object_name, options = {}, &block)
|
74
67
|
unless bucket_name
|
@@ -78,7 +71,7 @@ else
|
|
78
71
|
raise ArgumentError.new('object_name is required')
|
79
72
|
end
|
80
73
|
response = Excon::Response.new
|
81
|
-
if (bucket =
|
74
|
+
if (bucket = @data[:buckets][bucket_name]) && (object = bucket[:objects][object_name])
|
82
75
|
if options['If-Match'] && options['If-Match'] != object['ETag']
|
83
76
|
response.status = 412
|
84
77
|
elsif options['If-Modified-Since'] && options['If-Modified-Since'] > Time.parse(object['LastModified'])
|
@@ -121,5 +114,4 @@ else
|
|
121
114
|
end
|
122
115
|
end
|
123
116
|
end
|
124
|
-
|
125
117
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
2
5
|
|
3
|
-
|
4
|
-
module AWS
|
5
|
-
class S3
|
6
|
+
require 'fog/aws/parsers/s3/get_request_payment'
|
6
7
|
|
7
8
|
# Get configured payer for an S3 bucket
|
8
9
|
#
|
@@ -26,18 +27,12 @@ unless Fog.mocking?
|
|
26
27
|
end
|
27
28
|
|
28
29
|
end
|
29
|
-
end
|
30
|
-
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
module Fog
|
35
|
-
module AWS
|
36
|
-
class S3
|
31
|
+
class Mock
|
37
32
|
|
38
33
|
def get_request_payment(bucket_name)
|
39
34
|
response = Excon::Response.new
|
40
|
-
if bucket =
|
35
|
+
if bucket = @data[:buckets][bucket_name]
|
41
36
|
response.status = 200
|
42
37
|
response.body = { 'Payer' => bucket['Payer'] }
|
43
38
|
else
|
@@ -50,5 +45,4 @@ else
|
|
50
45
|
end
|
51
46
|
end
|
52
47
|
end
|
53
|
-
|
54
48
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
2
5
|
|
3
|
-
|
4
|
-
module AWS
|
5
|
-
class S3
|
6
|
+
require 'fog/aws/parsers/s3/get_service'
|
6
7
|
|
7
8
|
# List information about S3 buckets for authorized user
|
8
9
|
#
|
@@ -28,19 +29,13 @@ unless Fog.mocking?
|
|
28
29
|
end
|
29
30
|
|
30
31
|
end
|
31
|
-
end
|
32
|
-
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
module Fog
|
37
|
-
module AWS
|
38
|
-
class S3
|
33
|
+
class Mock
|
39
34
|
|
40
35
|
def get_service
|
41
36
|
response = Excon::Response.new
|
42
37
|
response.headers['Status'] = 200
|
43
|
-
buckets =
|
38
|
+
buckets = @data[:buckets].values.map do |bucket|
|
44
39
|
bucket.reject do |key, value|
|
45
40
|
!['CreationDate', 'Name'].include?(key)
|
46
41
|
end
|
@@ -55,5 +50,4 @@ else
|
|
55
50
|
end
|
56
51
|
end
|
57
52
|
end
|
58
|
-
|
59
53
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class S3
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
module S3
|
4
|
+
class Real
|
6
5
|
|
7
6
|
# Get headers for an object from S3
|
8
7
|
#
|
@@ -39,14 +38,8 @@ unless Fog.mocking?
|
|
39
38
|
end
|
40
39
|
|
41
40
|
end
|
42
|
-
end
|
43
|
-
end
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
module Fog
|
48
|
-
module AWS
|
49
|
-
class S3
|
42
|
+
class Mock
|
50
43
|
|
51
44
|
def head_object(bucket_name, object_name, options = {})
|
52
45
|
response = get_object(bucket_name, object_name, options)
|
@@ -57,5 +50,4 @@ else
|
|
57
50
|
end
|
58
51
|
end
|
59
52
|
end
|
60
|
-
|
61
|
-
end
|
53
|
+
end
|