fog 1.12.1 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/Gemfile +5 -0
- data/Rakefile +14 -4
- data/bin/fog +22 -0
- data/changelog.txt +262 -0
- data/fog.gemspec +8 -4
- data/lib/fog/aws.rb +11 -0
- data/lib/fog/aws/auto_scaling.rb +15 -18
- data/lib/fog/aws/beanstalk.rb +8 -10
- data/lib/fog/aws/cloud_formation.rb +9 -12
- data/lib/fog/aws/compute.rb +8 -10
- data/lib/fog/aws/credential_fetcher.rb +6 -6
- data/lib/fog/aws/elasticache.rb +13 -17
- data/lib/fog/aws/elb.rb +29 -31
- data/lib/fog/aws/iam.rb +10 -13
- data/lib/fog/aws/models/auto_scaling/group.rb +6 -3
- data/lib/fog/aws/models/compute/spot_request.rb +1 -11
- data/lib/fog/aws/models/rds/log_file.rb +26 -0
- data/lib/fog/aws/models/rds/log_files.rb +50 -0
- data/lib/fog/aws/models/rds/server.rb +3 -1
- data/lib/fog/aws/models/rds/snapshot.rb +1 -0
- data/lib/fog/aws/models/rds/snapshots.rb +20 -13
- data/lib/fog/aws/parsers/rds/db_parser.rb +1 -1
- data/lib/fog/aws/parsers/rds/describe_db_log_files.rb +44 -0
- data/lib/fog/aws/parsers/rds/download_db_logfile_portion.rb +26 -0
- data/lib/fog/aws/parsers/ses/verify_domain_identity.rb +26 -0
- data/lib/fog/aws/parsers/storage/complete_multipart_upload.rb +1 -1
- data/lib/fog/aws/parsers/sts/assume_role.rb +30 -0
- data/lib/fog/aws/rds.rb +27 -14
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +8 -0
- data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +8 -1
- data/lib/fog/aws/requests/compute/create_volume.rb +3 -3
- data/lib/fog/aws/requests/rds/create_db_instance.rb +3 -1
- data/lib/fog/aws/requests/rds/describe_db_log_files.rb +67 -0
- data/lib/fog/aws/requests/rds/download_db_logfile_portion.rb +63 -0
- data/lib/fog/aws/requests/ses/send_raw_email.rb +1 -1
- data/lib/fog/aws/requests/ses/verify_domain_identity.rb +30 -0
- data/lib/fog/aws/requests/storage/complete_multipart_upload.rb +6 -2
- data/lib/fog/aws/requests/storage/get_object.rb +1 -1
- data/lib/fog/aws/requests/sts/assume_role.rb +46 -0
- data/lib/fog/aws/ses.rb +26 -9
- data/lib/fog/aws/storage.rb +2 -1
- data/lib/fog/aws/sts.rb +31 -21
- data/lib/fog/bin.rb +0 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/brightbox/compute.rb +20 -212
- data/lib/fog/brightbox/compute/shared.rb +232 -0
- data/lib/fog/brightbox/models/compute/collaboration.rb +43 -0
- data/lib/fog/brightbox/models/compute/collaborations.rb +23 -0
- data/lib/fog/brightbox/models/compute/user_collaboration.rb +29 -0
- data/lib/fog/brightbox/models/compute/user_collaborations.rb +23 -0
- data/lib/fog/brightbox/requests/compute/accept_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/create_collaboration.rb +23 -0
- data/lib/fog/brightbox/requests/compute/delete_collaboration.rb +28 -0
- data/lib/fog/brightbox/requests/compute/delete_user_collaboration.rb +28 -0
- data/lib/fog/brightbox/requests/compute/destroy_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/get_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/get_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/list_collaborations.rb +19 -0
- data/lib/fog/brightbox/requests/compute/list_user_collaborations.rb +19 -0
- data/lib/fog/brightbox/requests/compute/reject_user_collaboration.rb +21 -0
- data/lib/fog/brightbox/requests/compute/resend_collaboration.rb +21 -0
- data/lib/fog/cloudsigma/docs/getting_started.md +59 -0
- data/lib/fog/core.rb +7 -2
- data/lib/fog/core/connection.rb +62 -29
- data/lib/fog/core/deprecated/connection.rb +24 -0
- data/lib/fog/core/parser.rb +1 -1
- data/lib/fog/digitalocean/examples/getting_started.md +1 -1
- data/lib/fog/digitalocean/models/compute/server.rb +2 -2
- data/lib/fog/google/compute.rb +31 -7
- data/lib/fog/google/models/compute/disk.rb +80 -0
- data/lib/fog/google/models/compute/disks.rb +28 -0
- data/lib/fog/google/models/compute/image.rb +36 -0
- data/lib/fog/google/models/compute/server.rb +46 -33
- data/lib/fog/google/models/compute/servers.rb +15 -8
- data/lib/fog/google/requests/compute/delete_server.rb +5 -2
- data/lib/fog/google/requests/compute/get_disk.rb +3 -0
- data/lib/fog/google/requests/compute/get_server.rb +7 -1
- data/lib/fog/google/requests/compute/insert_disk.rb +8 -2
- data/lib/fog/google/requests/compute/insert_server.rb +51 -22
- data/lib/fog/google/requests/compute/list_machine_types.rb +3 -2
- data/lib/fog/google/requests/storage/get_object.rb +1 -1
- data/lib/fog/hp/requests/storage/get_object.rb +1 -1
- data/lib/fog/hp/storage.rb +26 -9
- data/lib/fog/ibm/requests/compute/create_instance.rb +20 -15
- data/lib/fog/internet_archive/requests/storage/get_object.rb +1 -1
- data/lib/fog/{core/json.rb → json.rb} +13 -2
- data/lib/fog/metering.rb +25 -0
- data/lib/fog/openstack.rb +1 -0
- data/lib/fog/openstack/metering.rb +215 -0
- data/lib/fog/openstack/models/compute/flavors.rb +2 -2
- data/lib/fog/openstack/models/compute/metadata.rb +1 -1
- data/lib/fog/openstack/models/compute/server.rb +5 -2
- data/lib/fog/openstack/models/image/images.rb +1 -1
- data/lib/fog/openstack/models/metering/meter.rb +0 -0
- data/lib/fog/openstack/models/metering/meters.rb +0 -0
- data/lib/fog/openstack/models/metering/resource.rb +24 -0
- data/lib/fog/openstack/models/metering/resources.rb +25 -0
- data/lib/fog/openstack/models/volume/volume.rb +3 -1
- data/lib/fog/openstack/models/volume/volumes.rb +2 -1
- data/lib/fog/openstack/network.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
- data/lib/fog/openstack/requests/compute/create_server.rb +19 -1
- data/lib/fog/openstack/requests/compute/detach_volume.rb +2 -1
- data/lib/fog/openstack/requests/compute/list_flavors_detail.rb +4 -3
- data/lib/fog/openstack/requests/compute/list_security_groups.rb +1 -1
- data/lib/fog/openstack/requests/identity/create_tenant.rb +2 -2
- data/lib/fog/openstack/requests/metering/get_resource.rb +32 -0
- data/lib/fog/openstack/requests/metering/get_samples.rb +55 -0
- data/lib/fog/openstack/requests/metering/get_statistics.rb +56 -0
- data/lib/fog/openstack/requests/metering/list_meters.rb +50 -0
- data/lib/fog/openstack/requests/metering/list_resources.rb +32 -0
- data/lib/fog/openstack/requests/volume/create_volume.rb +4 -2
- data/lib/fog/rackspace.rb +16 -1
- data/lib/fog/rackspace/block_storage.rb +13 -28
- data/lib/fog/rackspace/cdn.rb +10 -24
- data/lib/fog/rackspace/compute.rb +17 -45
- data/lib/fog/rackspace/compute_v2.rb +13 -33
- data/lib/fog/rackspace/databases.rb +13 -29
- data/lib/fog/rackspace/dns.rb +27 -23
- data/lib/fog/rackspace/identity.rb +10 -26
- data/lib/fog/rackspace/load_balancers.rb +13 -29
- data/lib/fog/rackspace/mock_data.rb +3 -3
- data/lib/fog/rackspace/models/compute/server.rb +1 -1
- data/lib/fog/rackspace/models/dns/zones.rb +34 -21
- data/lib/fog/rackspace/models/identity/users.rb +2 -2
- data/lib/fog/rackspace/models/storage/file.rb +1 -0
- data/lib/fog/rackspace/requests/dns/list_domains.rb +2 -2
- data/lib/fog/rackspace/requests/storage/delete_multiple_objects.rb +75 -0
- data/lib/fog/rackspace/requests/storage/delete_static_large_object.rb +50 -0
- data/lib/fog/rackspace/requests/storage/get_object.rb +3 -1
- data/lib/fog/rackspace/requests/storage/put_dynamic_obj_manifest.rb +44 -0
- data/lib/fog/rackspace/requests/storage/put_object_manifest.rb +3 -30
- data/lib/fog/rackspace/requests/storage/put_static_obj_manifest.rb +60 -0
- data/lib/fog/rackspace/service.rb +43 -1
- data/lib/fog/rackspace/storage.rb +25 -43
- data/lib/fog/riakcs/provisioning.rb +2 -1
- data/lib/fog/riakcs/usage.rb +2 -1
- data/lib/fog/vcloud/requests/compute/configure_vm_cpus.rb +1 -1
- data/lib/fog/vcloud/requests/compute/configure_vm_memory.rb +1 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_folder.rb +1 -1
- data/lib/fog/xenserver/compute.rb +2 -0
- data/lib/fog/xenserver/models/compute/server.rb +9 -7
- data/lib/fog/xenserver/requests/compute/snapshot_revert.rb +22 -0
- data/lib/fog/xenserver/requests/compute/snapshot_server.rb +22 -0
- data/lib/fog/xml.rb +21 -0
- data/lib/fog/xml/sax_parser_connection.rb +43 -0
- data/lib/tasks/changelog_task.rb +1 -0
- data/tests/aws/models/auto_scaling/groups_test.rb +22 -0
- data/tests/aws/requests/compute/volume_tests.rb +3 -3
- data/tests/aws/requests/rds/helper.rb +14 -0
- data/tests/aws/requests/rds/log_file_tests.rb +19 -0
- data/tests/aws/requests/ses/verified_domain_identity_tests.rb +16 -0
- data/tests/aws/requests/sts/assume_role_tests.rb +19 -0
- data/tests/brightbox/requests/compute/collaboration_tests.rb +41 -0
- data/tests/brightbox/requests/compute/helper.rb +46 -2
- data/tests/brightbox/requests/compute/user_collaboration_tests.rb +67 -0
- data/tests/core/connection_tests.rb +26 -0
- data/tests/helper.rb +13 -0
- data/tests/openstack/requests/metering/meter_tests.rb +52 -0
- data/tests/openstack/requests/metering/resource_tests.rb +19 -0
- data/tests/openvz/helper.rb +14 -8
- data/tests/rackspace/block_storage_tests.rb +9 -0
- data/tests/rackspace/compute_tests.rb +9 -0
- data/tests/rackspace/compute_v2_tests.rb +9 -0
- data/tests/rackspace/databases_tests.rb +9 -0
- data/tests/rackspace/dns_tests.rb +20 -0
- data/tests/rackspace/helper.rb +12 -1
- data/tests/rackspace/identity_tests.rb +25 -0
- data/tests/rackspace/load_balancer_tests.rb +10 -0
- data/tests/rackspace/models/block_storage/volume_tests.rb +2 -2
- data/tests/rackspace/models/compute_v2/metadata_tests.rb +2 -2
- data/tests/rackspace/models/compute_v2/server_tests.rb +22 -21
- data/tests/rackspace/models/dns/zones_tests.rb +19 -5
- data/tests/rackspace/models/storage/file_tests.rb +22 -6
- data/tests/rackspace/rackspace_tests.rb +35 -0
- data/tests/rackspace/requests/block_storage/snapshot_tests.rb +2 -3
- data/tests/rackspace/requests/block_storage/volume_type_tests.rb +4 -11
- data/tests/rackspace/requests/compute_v2/address_tests.rb +1 -1
- data/tests/rackspace/requests/compute_v2/attachment_tests.rb +8 -9
- data/tests/rackspace/requests/compute_v2/flavor_tests.rb +1 -1
- data/tests/rackspace/requests/compute_v2/metadata_tests.rb +4 -4
- data/tests/rackspace/requests/databases/database_tests.rb +23 -20
- data/tests/rackspace/requests/databases/user_tests.rb +6 -6
- data/tests/rackspace/requests/identity/user_tests.rb +4 -1
- data/tests/rackspace/requests/load_balancers/usage_tests.rb +4 -2
- data/tests/rackspace/requests/storage/large_object_tests.rb +303 -59
- data/tests/rackspace/requests/storage/object_tests.rb +73 -18
- data/tests/rackspace/service_tests.rb +83 -0
- data/tests/rackspace/storage_tests.rb +9 -0
- data/tests/xenserver/models/compute/server_tests.rb +11 -1
- metadata +89 -19
- data/tests/core/user_agent_tests.rb +0 -6
data/lib/fog/aws/beanstalk.rb
CHANGED
@@ -131,16 +131,14 @@ module Fog
|
|
131
131
|
:parser => parser
|
132
132
|
})
|
133
133
|
rescue Excon::Errors::HTTPStatusError => error
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
raise error
|
143
|
-
end
|
134
|
+
match = Fog::AWS::Errors.match_error(error)
|
135
|
+
raise if match.empty?
|
136
|
+
raise case match[:code]
|
137
|
+
when 'InvalidParameterValue'
|
138
|
+
Fog::AWS::ElasticBeanstalk::InvalidParameterError.slurp(error, match[:message])
|
139
|
+
else
|
140
|
+
Fog::AWS::ElasticBeanstalk::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
141
|
+
end
|
144
142
|
end
|
145
143
|
|
146
144
|
end
|
@@ -98,7 +98,7 @@ module Fog
|
|
98
98
|
)
|
99
99
|
|
100
100
|
begin
|
101
|
-
|
101
|
+
@connection.request({
|
102
102
|
:body => body,
|
103
103
|
:expects => 200,
|
104
104
|
:idempotent => idempotent,
|
@@ -108,19 +108,16 @@ module Fog
|
|
108
108
|
:parser => parser
|
109
109
|
})
|
110
110
|
rescue Excon::Errors::HTTPStatusError => error
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
raise error
|
120
|
-
end
|
111
|
+
match = Fog::AWS::Errors.match_error(error)
|
112
|
+
raise if match.empty?
|
113
|
+
raise case match[:code]
|
114
|
+
when 'NotFound', 'ValidationError'
|
115
|
+
Fog::AWS::CloudFormation::NotFound.slurp(error, match[:message])
|
116
|
+
else
|
117
|
+
Fog::AWS::CloudFormation::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
118
|
+
end
|
121
119
|
end
|
122
120
|
|
123
|
-
response
|
124
121
|
end
|
125
122
|
|
126
123
|
end
|
data/lib/fog/aws/compute.rb
CHANGED
@@ -392,16 +392,14 @@ module Fog
|
|
392
392
|
:parser => parser
|
393
393
|
})
|
394
394
|
rescue Excon::Errors::HTTPStatusError => error
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
raise error
|
404
|
-
end
|
395
|
+
match = Fog::AWS::Errors.match_error(error)
|
396
|
+
raise if match.empty?
|
397
|
+
raise case match[:code]
|
398
|
+
when 'NotFound', 'Unknown'
|
399
|
+
Fog::Compute::AWS::NotFound.slurp(error, match[:message])
|
400
|
+
else
|
401
|
+
Fog::Compute::AWS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
402
|
+
end
|
405
403
|
end
|
406
404
|
|
407
405
|
end
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require "fog/json"
|
2
|
+
|
2
3
|
module Fog
|
3
4
|
module AWS
|
4
5
|
module CredentialFetcher
|
@@ -14,7 +15,7 @@ module Fog
|
|
14
15
|
|
15
16
|
session = Fog::JSON.decode(role_data)
|
16
17
|
credentials = {}
|
17
|
-
credentials[:aws_access_key_id] = session['AccessKeyId']
|
18
|
+
credentials[:aws_access_key_id] = session['AccessKeyId']
|
18
19
|
credentials[:aws_secret_access_key] = session['SecretAccessKey']
|
19
20
|
credentials[:aws_session_token] = session['Token']
|
20
21
|
credentials[:aws_credentials_expire_at] = Time.xmlschema session['Expiration']
|
@@ -31,7 +32,7 @@ module Fog
|
|
31
32
|
end
|
32
33
|
|
33
34
|
module ConnectionMethods
|
34
|
-
|
35
|
+
|
35
36
|
def refresh_credentials_if_expired
|
36
37
|
refresh_credentials if credentials_expired?
|
37
38
|
end
|
@@ -39,8 +40,8 @@ module Fog
|
|
39
40
|
private
|
40
41
|
|
41
42
|
def credentials_expired?
|
42
|
-
@use_iam_profile &&
|
43
|
-
(!@aws_credentials_expire_at ||
|
43
|
+
@use_iam_profile &&
|
44
|
+
(!@aws_credentials_expire_at ||
|
44
45
|
(@aws_credentials_expire_at && Fog::Time.now > @aws_credentials_expire_at - 15)) #new credentials become available from around 5 minutes before expiration time
|
45
46
|
end
|
46
47
|
|
@@ -61,4 +62,3 @@ module Fog
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
64
|
-
|
data/lib/fog/aws/elasticache.rb
CHANGED
@@ -94,7 +94,7 @@ module Fog
|
|
94
94
|
)
|
95
95
|
|
96
96
|
begin
|
97
|
-
|
97
|
+
@connection.request({
|
98
98
|
:body => body,
|
99
99
|
:expects => 200,
|
100
100
|
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
@@ -104,24 +104,20 @@ module Fog
|
|
104
104
|
:parser => parser
|
105
105
|
})
|
106
106
|
rescue Excon::Errors::HTTPStatusError => error
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
else
|
120
|
-
raise
|
121
|
-
end
|
107
|
+
match = Fog::AWS::Errors.match_error(error)
|
108
|
+
raise if match.empty?
|
109
|
+
raise case match[:code]
|
110
|
+
when 'CacheSecurityGroupNotFound', 'CacheParameterGroupNotFound', 'CacheClusterNotFound'
|
111
|
+
Fog::AWS::Elasticache::NotFound.slurp(error, match[:message])
|
112
|
+
when 'CacheSecurityGroupAlreadyExists'
|
113
|
+
Fog::AWS::Elasticache::IdentifierTaken.slurp(error, match[:message])
|
114
|
+
when 'InvalidParameterValue'
|
115
|
+
Fog::AWS::Elasticache::InvalidInstance.slurp(error, match[:message])
|
116
|
+
else
|
117
|
+
Fog::AWS::Elasticache::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
118
|
+
end
|
122
119
|
end
|
123
120
|
|
124
|
-
response
|
125
121
|
end
|
126
122
|
|
127
123
|
end
|
data/lib/fog/aws/elb.rb
CHANGED
@@ -191,37 +191,35 @@ module Fog
|
|
191
191
|
:parser => parser
|
192
192
|
})
|
193
193
|
rescue Excon::Errors::HTTPStatusError => error
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
raise
|
224
|
-
end
|
194
|
+
match = Fog::AWS::Errors.match_error(error)
|
195
|
+
raise if match.empty?
|
196
|
+
raise case match[:code]
|
197
|
+
when 'CertificateNotFound'
|
198
|
+
Fog::AWS::IAM::NotFound.slurp(error, match[:message])
|
199
|
+
when 'DuplicateLoadBalancerName'
|
200
|
+
Fog::AWS::ELB::IdentifierTaken.slurp(error, match[:message])
|
201
|
+
when 'DuplicatePolicyName'
|
202
|
+
Fog::AWS::ELB::DuplicatePolicyName.slurp(error, match[:message])
|
203
|
+
when 'InvalidInstance'
|
204
|
+
Fog::AWS::ELB::InvalidInstance.slurp(error, match[:message])
|
205
|
+
when 'InvalidConfigurationRequest'
|
206
|
+
# when do they fucking use this shit?
|
207
|
+
Fog::AWS::ELB::InvalidConfigurationRequest.slurp(error, match[:message])
|
208
|
+
when 'LoadBalancerNotFound'
|
209
|
+
Fog::AWS::ELB::NotFound.slurp(error, match[:message])
|
210
|
+
when 'PolicyNotFound'
|
211
|
+
Fog::AWS::ELB::PolicyNotFound.slurp(error, match[:message])
|
212
|
+
when 'PolicyTypeNotFound'
|
213
|
+
Fog::AWS::ELB::PolicyTypeNotFound.slurp(error, match[:message])
|
214
|
+
when 'Throttling'
|
215
|
+
Fog::AWS::ELB::Throttled.slurp(error, match[:message])
|
216
|
+
when 'TooManyPolicies'
|
217
|
+
Fog::AWS::ELB::TooManyPolicies.slurp(error, match[:message])
|
218
|
+
when 'ValidationError'
|
219
|
+
Fog::AWS::ELB::ValidationError.slurp(error, match[:message])
|
220
|
+
else
|
221
|
+
Fog::AWS::ELB::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
222
|
+
end
|
225
223
|
end
|
226
224
|
end
|
227
225
|
end
|
data/lib/fog/aws/iam.rb
CHANGED
@@ -208,19 +208,16 @@ module Fog
|
|
208
208
|
:parser => parser
|
209
209
|
})
|
210
210
|
rescue Excon::Errors::HTTPStatusError => error
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
else
|
222
|
-
raise
|
223
|
-
end
|
211
|
+
match = Fog::AWS::Errors.match_error(error)
|
212
|
+
raise if match.empty?
|
213
|
+
raise case match[:code]
|
214
|
+
when 'CertificateNotFound', 'NoSuchEntity'
|
215
|
+
Fog::AWS::IAM::NotFound.slurp(error, match[:message])
|
216
|
+
when 'EntityAlreadyExists', 'KeyPairMismatch', 'LimitExceeded', 'MalformedCertificate', 'ValidationError'
|
217
|
+
Fog::AWS::IAM.const_get(match[:code]).slurp(error, match[:message])
|
218
|
+
else
|
219
|
+
Fog::AWS::IAM::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
220
|
+
end
|
224
221
|
end
|
225
222
|
|
226
223
|
end
|
@@ -111,8 +111,7 @@ module Fog
|
|
111
111
|
requires :launch_configuration_name
|
112
112
|
requires :max_size
|
113
113
|
requires :min_size
|
114
|
-
|
115
|
-
service.create_auto_scaling_group(id, availability_zones, launch_configuration_name, max_size, min_size, options)
|
114
|
+
service.create_auto_scaling_group(id, availability_zones, launch_configuration_name, max_size, min_size, filtered_options(:create_auto_scaling_group))
|
116
115
|
reload
|
117
116
|
end
|
118
117
|
|
@@ -132,10 +131,14 @@ module Fog
|
|
132
131
|
|
133
132
|
def update
|
134
133
|
requires :id
|
135
|
-
service.update_auto_scaling_group(id,
|
134
|
+
service.update_auto_scaling_group(id, filtered_options(:update_auto_scaling_group) )
|
136
135
|
reload
|
137
136
|
end
|
138
137
|
|
138
|
+
def filtered_options(method)
|
139
|
+
Hash[options.select{|k,_| ExpectedOptions[method].include?(k)}]
|
140
|
+
end
|
141
|
+
|
139
142
|
def options
|
140
143
|
ret = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]
|
141
144
|
ret.delete_if { |key, value| value.nil? }
|
@@ -95,7 +95,7 @@ module Fog
|
|
95
95
|
'LaunchSpecification.KeyName' => key_name,
|
96
96
|
'LaunchSpecification.Monitoring.Enabled' => monitoring,
|
97
97
|
'LaunchSpecification.Placement.AvailabilityZone' => availability_zone,
|
98
|
-
'LaunchSpecification.
|
98
|
+
'LaunchSpecification.SecurityGroupId' => groups,
|
99
99
|
'LaunchSpecification.EbsOptimized' => ebs_optimized,
|
100
100
|
'LaunchSpecification.UserData' => user_data,
|
101
101
|
'LaunchSpecification.SubnetId' => subnet_id,
|
@@ -106,16 +106,6 @@ module Fog
|
|
106
106
|
'ValidUntil' => valid_until }
|
107
107
|
options.delete_if {|key, value| value.nil?}
|
108
108
|
|
109
|
-
# If subnet is defined then this is a Virtual Private Cloud.
|
110
|
-
# subnet & security group cannot co-exist. Attempting to specify
|
111
|
-
# both subnet and groups will cause an error. Instead please make
|
112
|
-
# use of Security Group Ids when working in a VPC.
|
113
|
-
if subnet_id
|
114
|
-
options.delete('LaunchSpecification.SecurityGroup')
|
115
|
-
else
|
116
|
-
options.delete('LaunchSpecification.SubnetId')
|
117
|
-
end
|
118
|
-
|
119
109
|
data = service.request_spot_instances(image_id, flavor_id, price, options).body
|
120
110
|
spot_instance_request = data['spotInstanceRequestSet'].first
|
121
111
|
spot_instance_request['launchSpecification'].each do |name,value|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class RDS
|
6
|
+
|
7
|
+
class LogFile < Fog::Model
|
8
|
+
|
9
|
+
attribute :rds_id, :aliases => 'DBInstanceIdentifier'
|
10
|
+
attribute :name, :aliases => 'LogFileName'
|
11
|
+
attribute :size, :aliases => 'Size', :type => :integer
|
12
|
+
attribute :last_written, :aliases => 'LastWritten', :type => :time
|
13
|
+
attribute :content, :aliases => 'LogFileData'
|
14
|
+
attribute :marker, :aliases => 'Marker'
|
15
|
+
attribute :more_content_available, :aliases => 'AdditionalDataPending', :type => :boolean
|
16
|
+
|
17
|
+
def content_excerpt(marker=nil)
|
18
|
+
result = service.download_db_logfile_portion(self.rds_id, self.name, {:marker => marker})
|
19
|
+
merge_attributes(result.body['DownloadDBLogFilePortionResult'])
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/aws/models/rds/log_file'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module AWS
|
6
|
+
class RDS
|
7
|
+
|
8
|
+
class LogFiles < Fog::Collection
|
9
|
+
attribute :filters
|
10
|
+
attribute :rds_id
|
11
|
+
model Fog::AWS::RDS::LogFile
|
12
|
+
|
13
|
+
def initialize(attributes)
|
14
|
+
self.filters ||= {}
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# This method deliberately returns only a single page of results
|
19
|
+
def all(filters=filters)
|
20
|
+
self.filters.merge!(filters)
|
21
|
+
|
22
|
+
result = service.describe_db_log_files(rds_id, self.filters).body['DescribeDBLogFilesResult']
|
23
|
+
self.filters[:marker] = result['Marker']
|
24
|
+
load(result['DBLogFiles'])
|
25
|
+
end
|
26
|
+
|
27
|
+
def each(filters=filters)
|
28
|
+
if block_given?
|
29
|
+
begin
|
30
|
+
page = self.all(filters)
|
31
|
+
# We need to explicitly use the base 'each' method here on the page, otherwise we get infinite recursion
|
32
|
+
base_each = Fog::Collection.instance_method(:each)
|
33
|
+
base_each.bind(page).call { |log_file| yield log_file }
|
34
|
+
end while self.filters[:marker]
|
35
|
+
end
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
def get(file_name=nil)
|
40
|
+
if file_name
|
41
|
+
matches = self.select {|log_file| log_file.name.upcase == file_name.upcase}
|
42
|
+
return matches.first unless matches.empty?
|
43
|
+
end
|
44
|
+
rescue Fog::AWS::RDS::NotFound
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -30,6 +30,7 @@ module Fog
|
|
30
30
|
attribute :backup_retention_period, :aliases => 'BackupRetentionPeriod', :type => :integer
|
31
31
|
attribute :license_model, :aliases => 'LicenseModel'
|
32
32
|
attribute :db_subnet_group_name, :aliases => 'DBSubnetGroupName'
|
33
|
+
attribute :publicly_accessible, :aliases => 'PubliclyAccessible'
|
33
34
|
|
34
35
|
attr_accessor :password, :parameter_group_name, :security_group_names, :port
|
35
36
|
|
@@ -120,7 +121,8 @@ module Fog
|
|
120
121
|
'PreferredBackupWindow' => preferred_backup_window,
|
121
122
|
'MultiAZ' => multi_az,
|
122
123
|
'LicenseModel' => license_model,
|
123
|
-
'DBSubnetGroupName' => db_subnet_group_name
|
124
|
+
'DBSubnetGroupName' => db_subnet_group_name,
|
125
|
+
'PubliclyAccessible' => publicly_accessible
|
124
126
|
}
|
125
127
|
|
126
128
|
options.delete_if {|key, value| value.nil?}
|
@@ -18,6 +18,7 @@ module Fog
|
|
18
18
|
attribute :allocated_storage, :aliases => 'AllocatedStorage', :type => :integer
|
19
19
|
attribute :availability_zone, :aliases => 'AvailabilityZone'
|
20
20
|
attribute :type, :aliases => 'SnapshotType'
|
21
|
+
attribute :publicly_accessible, :aliases => 'PubliclyAccessible'
|
21
22
|
|
22
23
|
def ready?
|
23
24
|
state == 'available'
|
@@ -21,26 +21,33 @@ module Fog
|
|
21
21
|
super
|
22
22
|
end
|
23
23
|
|
24
|
-
# This
|
25
|
-
#
|
26
|
-
#
|
24
|
+
# This method does NOT return all snapshots. Its implementation deliberately returns a single page
|
25
|
+
# of results for any one call. It will return a single page based on the current or provided filters,
|
26
|
+
# updating the filters with the marker for the next page. Calling this repeatedly will iterate
|
27
|
+
# through pages. See the implementation of each for an example of such iteration.
|
28
|
+
#
|
29
|
+
# It is arguably incorrect for the method not to return all snapshots, particularly considering the
|
30
|
+
# implementation in the corresponding 'elb' files. But this implementation has been released, and
|
31
|
+
# backwards-compatibility requires leaving it as implemented.
|
27
32
|
def all(filters = filters)
|
28
33
|
self.filters.merge!(filters)
|
29
34
|
|
30
|
-
|
31
|
-
self.filters[:marker] =
|
32
|
-
|
33
|
-
load(data)
|
35
|
+
page = service.describe_db_snapshots(self.filters).body['DescribeDBSnapshotsResult']
|
36
|
+
self.filters[:marker] = page['Marker']
|
37
|
+
load(page['DBSnapshots'])
|
34
38
|
end
|
35
39
|
|
36
40
|
# This will execute a block for each snapshot, fetching new pages of snapshots as required.
|
37
41
|
def each(filters = filters)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
if block_given?
|
43
|
+
begin
|
44
|
+
page = self.all(filters)
|
45
|
+
# We need to explicitly use the base 'each' method here on the page, otherwise we get infinite recursion
|
46
|
+
base_each = Fog::Collection.instance_method(:each)
|
47
|
+
base_each.bind(page).call { |snapshot| yield snapshot }
|
48
|
+
end while self.filters[:marker]
|
49
|
+
end
|
50
|
+
self
|
44
51
|
end
|
45
52
|
|
46
53
|
def get(identity)
|