fog-aws 0.9.4 → 0.10.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -1
- data/lib/fog/aws/credential_fetcher.rb +9 -1
- data/lib/fog/aws/iam.rb +6 -0
- data/lib/fog/aws/parsers/iam/list_policy_versions.rb +64 -0
- data/lib/fog/aws/parsers/rds/copy_db_snapshot.rb +32 -0
- data/lib/fog/aws/parsers/rds/modify_db_snapshot_attribute.rb +24 -0
- data/lib/fog/aws/rds.rb +2 -0
- data/lib/fog/aws/requests/iam/create_policy_version.rb +63 -0
- data/lib/fog/aws/requests/iam/delete_policy_version.rb +41 -0
- data/lib/fog/aws/requests/iam/list_attached_role_policies.rb +89 -0
- data/lib/fog/aws/requests/iam/list_policy_versions.rb +84 -0
- data/lib/fog/aws/requests/iam/set_default_policy_version.rb +42 -0
- data/lib/fog/aws/requests/iam/update_assume_role_policy.rb +41 -0
- data/lib/fog/aws/requests/rds/copy_db_snapshot.rb +53 -0
- data/lib/fog/aws/requests/rds/modify_db_snapshot_attribute.rb +48 -0
- data/lib/fog/aws/version.rb +1 -1
- data/tests/credentials_tests.rb +3 -0
- data/tests/requests/iam/managed_policy_tests.rb +22 -1
- data/tests/requests/iam/versioned_managed_policy_tests.rb +114 -0
- data/tests/requests/rds/db_snapshot_tests.rb +62 -0
- data/tests/requests/rds/helper.rb +4 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17dd3fd68228d3795c582e27cd773d680077cdac
|
4
|
+
data.tar.gz: dc58a9189e5914e48398e907b381fb71775b78d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a7ebbf3ff34dc65a749d701657278a0f488a27da0049e3afb37e3c6f2dbec5e00cddad2ea7fa8289889db91a9be5fc0b8a3d7d1f0c609d5137d0bb2b6c997f7
|
7
|
+
data.tar.gz: ee0ae5c80c7c3ae9910d2065cf533b918131594b7b429f9f42eb003662afb9800d4418ca9b2be42cf71446e2d7faf7345e2e2964135a681337639f17a40f4369
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,24 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/fog/fog-aws/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.9.
|
5
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.9.4...HEAD)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- How to setup private files with CloudFront? [\#275](https://github.com/fog/fog-aws/issues/275)
|
10
|
+
- Feature: Custom Managed Policies [\#272](https://github.com/fog/fog-aws/issues/272)
|
11
|
+
- Question: which aws-sdk version is used [\#270](https://github.com/fog/fog-aws/issues/270)
|
12
|
+
- Support an IAM list\_attached\_role\_policies method [\#191](https://github.com/fog/fog-aws/issues/191)
|
13
|
+
|
14
|
+
**Merged pull requests:**
|
15
|
+
|
16
|
+
- RDS test fixes [\#276](https://github.com/fog/fog-aws/pull/276) ([MrPrimate](https://github.com/MrPrimate))
|
17
|
+
- Expanding IAM support [\#274](https://github.com/fog/fog-aws/pull/274) ([MrPrimate](https://github.com/MrPrimate))
|
18
|
+
- Rds snapshot improvements [\#269](https://github.com/fog/fog-aws/pull/269) ([tekken](https://github.com/tekken))
|
19
|
+
- add default region to use\_iam\_profile [\#268](https://github.com/fog/fog-aws/pull/268) ([shaiguitar](https://github.com/shaiguitar))
|
20
|
+
|
21
|
+
## [v0.9.4](https://github.com/fog/fog-aws/tree/v0.9.4) (2016-06-28)
|
22
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v0.9.3...v0.9.4)
|
6
23
|
|
7
24
|
**Closed issues:**
|
8
25
|
|
@@ -1,8 +1,11 @@
|
|
1
1
|
module Fog
|
2
2
|
module AWS
|
3
3
|
module CredentialFetcher
|
4
|
+
|
4
5
|
INSTANCE_METADATA_HOST = "http://169.254.169.254"
|
5
6
|
INSTANCE_METADATA_PATH = "/latest/meta-data/iam/security-credentials/"
|
7
|
+
INSTANCE_METADATA_AZ = "/latest/meta-data/placement/availability-zone/"
|
8
|
+
|
6
9
|
module ServiceMethods
|
7
10
|
def fetch_credentials(options)
|
8
11
|
if options[:use_iam_profile] && Fog.mocking?
|
@@ -13,6 +16,8 @@ module Fog
|
|
13
16
|
connection = options[:connection] || Excon.new(INSTANCE_METADATA_HOST)
|
14
17
|
role_name = connection.get(:path => INSTANCE_METADATA_PATH, :expects => 200).body
|
15
18
|
role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :expects => 200).body
|
19
|
+
az_data = connection.get(:path => INSTANCE_METADATA_AZ, :expects => 200).body
|
20
|
+
region = az_data[0..-2] # get region from az
|
16
21
|
|
17
22
|
session = Fog::JSON.decode(role_data)
|
18
23
|
credentials = {}
|
@@ -20,9 +25,12 @@ module Fog
|
|
20
25
|
credentials[:aws_secret_access_key] = session['SecretAccessKey']
|
21
26
|
credentials[:aws_session_token] = session['Token']
|
22
27
|
credentials[:aws_credentials_expire_at] = Time.xmlschema session['Expiration']
|
28
|
+
|
29
|
+
# set region by default to the one the instance is in.
|
30
|
+
credentials[:region] = region
|
23
31
|
#these indicate the metadata service is unavailable or has no profile setup
|
24
32
|
credentials
|
25
|
-
rescue Excon::
|
33
|
+
rescue Excon::Error => e
|
26
34
|
Fog::Logger.warning("Unable to fetch credentials: #{e.message}")
|
27
35
|
super
|
28
36
|
end
|
data/lib/fog/aws/iam.rb
CHANGED
@@ -24,6 +24,7 @@ module Fog
|
|
24
24
|
request :create_instance_profile
|
25
25
|
request :create_login_profile
|
26
26
|
request :create_policy
|
27
|
+
request :create_policy_version
|
27
28
|
request :create_role
|
28
29
|
request :create_user
|
29
30
|
request :delete_access_key
|
@@ -34,6 +35,7 @@ module Fog
|
|
34
35
|
request :delete_instance_profile
|
35
36
|
request :delete_login_profile
|
36
37
|
request :delete_policy
|
38
|
+
request :delete_policy_version
|
37
39
|
request :delete_role
|
38
40
|
request :delete_role_policy
|
39
41
|
request :delete_server_certificate
|
@@ -59,6 +61,7 @@ module Fog
|
|
59
61
|
request :list_access_keys
|
60
62
|
request :list_account_aliases
|
61
63
|
request :list_attached_group_policies
|
64
|
+
request :list_attached_role_policies
|
62
65
|
request :list_attached_user_policies
|
63
66
|
request :list_group_policies
|
64
67
|
request :list_groups
|
@@ -67,6 +70,7 @@ module Fog
|
|
67
70
|
request :list_instance_profiles_for_role
|
68
71
|
request :list_mfa_devices
|
69
72
|
request :list_policies
|
73
|
+
request :list_policy_versions
|
70
74
|
request :list_role_policies
|
71
75
|
request :list_roles
|
72
76
|
request :list_server_certificates
|
@@ -78,10 +82,12 @@ module Fog
|
|
78
82
|
request :put_user_policy
|
79
83
|
request :remove_role_from_instance_profile
|
80
84
|
request :remove_user_from_group
|
85
|
+
request :set_default_policy_version
|
81
86
|
request :update_access_key
|
82
87
|
request :update_group
|
83
88
|
request :update_login_profile
|
84
89
|
request :update_account_password_policy
|
90
|
+
request :update_assume_role_policy
|
85
91
|
request :update_server_certificate
|
86
92
|
request :update_signing_certificate
|
87
93
|
request :update_user
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module IAM
|
5
|
+
class ListPolicyVersions < Fog::Parsers::Base
|
6
|
+
def reset
|
7
|
+
super
|
8
|
+
@stack = []
|
9
|
+
@response = { 'Versions' => [], 'Marker' => '', 'IsTruncated' => false }
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_element(name,attrs = [])
|
13
|
+
case name
|
14
|
+
when 'Versions'
|
15
|
+
@stack << name
|
16
|
+
when 'member'
|
17
|
+
if @stack.last == 'Versions'
|
18
|
+
@version = {}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def end_element(name)
|
25
|
+
case name
|
26
|
+
when 'member'
|
27
|
+
@response['Versions'] << @version
|
28
|
+
@version = {}
|
29
|
+
when 'IsTruncated'
|
30
|
+
response[name] = (value == 'true')
|
31
|
+
when 'Marker', 'RequestId'
|
32
|
+
@response[name] = value
|
33
|
+
end
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
def end_element(name)
|
38
|
+
case name
|
39
|
+
when 'VersionId'
|
40
|
+
@version[name] = value
|
41
|
+
when 'CreateDate'
|
42
|
+
@version[name] = Time.parse(value)
|
43
|
+
when 'IsDefaultVersion'
|
44
|
+
@version[name] = (value == 'true')
|
45
|
+
when 'Versions'
|
46
|
+
if @stack.last == 'Versions'
|
47
|
+
@stack.pop
|
48
|
+
end
|
49
|
+
when 'member'
|
50
|
+
if @stack.last == 'Versions'
|
51
|
+
finished_version(@version)
|
52
|
+
@version = nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def finished_version(version)
|
58
|
+
@response['Versions'] << version
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module RDS
|
5
|
+
require 'fog/aws/parsers/rds/snapshot_parser'
|
6
|
+
|
7
|
+
class CopyDBSnapshot < Fog::Parsers::AWS::RDS::SnapshotParser
|
8
|
+
def reset
|
9
|
+
@response = { 'CopyDBSnapshotResult' => {}, 'ResponseMetadata' => {} }
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_element(name, attrs = [])
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def end_element(name)
|
18
|
+
case name
|
19
|
+
when 'DBSnapshot' then
|
20
|
+
@response['CopyDBSnapshotResult']['DBSnapshot'] = @db_snapshot
|
21
|
+
@db_snapshot = fresh_snapshot
|
22
|
+
when 'RequestId'
|
23
|
+
@response['ResponseMetadata'][name] = value
|
24
|
+
else
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module RDS
|
5
|
+
class ModifyDbSnapshotAttribute < Fog::Parsers::Base
|
6
|
+
def reset
|
7
|
+
@response = { 'ModifyDbSnapshotAttributeResult' => {}, 'ResponseMetadata' => {} }
|
8
|
+
end
|
9
|
+
|
10
|
+
def start_element(name, attrs = [])
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def end_element(name)
|
15
|
+
case name
|
16
|
+
when 'RequestId'
|
17
|
+
@response['ResponseMetadata'][name] = value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/fog/aws/rds.rb
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/iam/policy_version'
|
6
|
+
|
7
|
+
# Creates a managed policy
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * policy_arn<~String>: arn of the policy
|
11
|
+
# * policy_document<~Hash>: policy document, see: http://docs.amazonwebservices.com/IAM/latest/UserGuide/PoliciesOverview.html
|
12
|
+
# * set_as_default<~Boolean>: sets policy to default version
|
13
|
+
#
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response>:
|
16
|
+
# * body<~Hash>:
|
17
|
+
# * 'RequestId'<~String> - Id of the request
|
18
|
+
# * 'PolicyVersion'<~Array>:
|
19
|
+
# * CreateDate<~DateTime> The date and time, in ISO 8601 date-time format, when the policy version was created.
|
20
|
+
# * Document<~String> The policy document. Pattern: [\u0009\u000A\u000D\u0020-\u00FF]+
|
21
|
+
# * IsDefaultVersion<~String> Specifies whether the policy version is set as the policy's default version.
|
22
|
+
# * VersionId<~String> The identifier for the policy version.
|
23
|
+
# ==== See Also
|
24
|
+
# http://docs.aws.amazon.com/IAM/latest/APIReference/API_CreatePolicyVersion.html
|
25
|
+
#
|
26
|
+
def create_policy_version(policy_arn, policy_document, set_as_default=true)
|
27
|
+
request({
|
28
|
+
'Action' => 'CreatePolicyVersion',
|
29
|
+
'PolicyArn' => policy_arn,
|
30
|
+
'PolicyDocument' => Fog::JSON.encode(policy_document),
|
31
|
+
'SetAsDefault' => set_as_default,
|
32
|
+
:parser => Fog::Parsers::AWS::IAM::PolicyVersion.new
|
33
|
+
}.reject {|_, value| value.nil?})
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Mock
|
38
|
+
def create_policy_version(policy_arn, policy_document, set_as_default=true)
|
39
|
+
managed_policy_versions = self.data[:managed_policy_versions][policy_arn]
|
40
|
+
|
41
|
+
unless managed_policy_versions
|
42
|
+
raise Fog::AWS::IAM::NotFound, "Policy #{policy_arn} version #{version_id} does not exist."
|
43
|
+
end
|
44
|
+
|
45
|
+
version = managed_policy_versions[version_id]
|
46
|
+
|
47
|
+
unless version
|
48
|
+
raise Fog::AWS::IAM::NotFound, "Policy #{policy_arn} version #{version_id} does not exist."
|
49
|
+
end
|
50
|
+
|
51
|
+
Excon::Response.new.tap do |response|
|
52
|
+
response.body = {
|
53
|
+
'PolicyVersion' => version,
|
54
|
+
'RequestId' => Fog::AWS::Mock.request_id
|
55
|
+
}
|
56
|
+
response.status = 200
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/iam/basic'
|
6
|
+
|
7
|
+
# Deletes a manged policy
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * policy_arn<~String>: arn of the policy
|
11
|
+
# * version_id<~String>: version of policy to delete
|
12
|
+
#
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response>:
|
15
|
+
# * body<~Hash>:
|
16
|
+
# * 'RequestId'<~String> - Id of the request
|
17
|
+
#
|
18
|
+
# ==== See Also
|
19
|
+
# http://docs.aws.amazon.com/IAM/latest/APIReference/API_DeletePolicyVersion.html
|
20
|
+
#
|
21
|
+
def delete_policy_version(policy_arn, version_id)
|
22
|
+
request(
|
23
|
+
'Action' => 'DeletePolicyVersion',
|
24
|
+
'PolicyArn' => policy_arn,
|
25
|
+
'VersionId' => version_id,
|
26
|
+
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
class Mock
|
31
|
+
def delete_policy_version(policy_arn, version_id)
|
32
|
+
Excon::Response.new.tap do |response|
|
33
|
+
response.body = { 'RequestId' => Fog::AWS::Mock.request_id }
|
34
|
+
response.status = 200
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/iam/list_managed_policies'
|
6
|
+
|
7
|
+
# Lists managed role policies
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * role_name<~String>: name of the role
|
11
|
+
#
|
12
|
+
# ==== Returns
|
13
|
+
# * response<~Excon::Response>:
|
14
|
+
# * body<~Hash>:
|
15
|
+
# * 'RequestId'<~String> - Id of the request
|
16
|
+
# * AttachedPolicies
|
17
|
+
# * 'PolicyArn'<~String> - The Amazon Resource Name (ARN). ARNs are unique identifiers for AWS resources.
|
18
|
+
# * 'PolicName'<~String> - The friendly name of the attached policy.
|
19
|
+
#
|
20
|
+
# ==== See Also
|
21
|
+
# https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListAttachedRolePolicies.html
|
22
|
+
#
|
23
|
+
def list_attached_role_policies(role_name, options={})
|
24
|
+
request({
|
25
|
+
'Action' => 'ListAttachedRolePolicies',
|
26
|
+
'RoleName' => role_name,
|
27
|
+
:parser => Fog::Parsers::AWS::IAM::ListManagedPolicies.new
|
28
|
+
}.merge(options))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Mock
|
33
|
+
def list_attached_role_policies(role_name, options={})
|
34
|
+
unless self.data[:roles].key?(role_name)
|
35
|
+
raise Fog::AWS::IAM::NotFound.new("The role with name #{role_name} cannot be found.")
|
36
|
+
end
|
37
|
+
|
38
|
+
limit = options['MaxItems']
|
39
|
+
marker = options['Marker']
|
40
|
+
role = self.data[:roles][role_name]
|
41
|
+
|
42
|
+
if limit
|
43
|
+
if limit > 1_000
|
44
|
+
raise Fog::AWS::IAM::Error.new(
|
45
|
+
"ValidationError => 1 validation error detected: Value '#{limit}' at 'limit' failed to satisfy constraint: Member must have value less than or equal to 1000"
|
46
|
+
)
|
47
|
+
elsif limit < 1
|
48
|
+
raise Fog::AWS::IAM::Error.new(
|
49
|
+
"ValidationError => 1 validation error detected: Value '#{limit}' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1"
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
data_set = if marker
|
55
|
+
self.data[:markers][marker] || []
|
56
|
+
else
|
57
|
+
role[:attached_policies].map { |arn|
|
58
|
+
self.data[:managed_policies].fetch(arn)
|
59
|
+
}.map { |mp|
|
60
|
+
{ "PolicyName" => mp.fetch("PolicyName"), "PolicyArn" => mp.fetch("Arn") }
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
data = data_set.slice!(0, limit || 100)
|
65
|
+
truncated = data_set.size > 0
|
66
|
+
marker = truncated && Base64.encode64("metadata/l/#{account_id}/#{UUID.uuid}")
|
67
|
+
|
68
|
+
response = Excon::Response.new
|
69
|
+
|
70
|
+
body = {
|
71
|
+
'Policies' => data,
|
72
|
+
'IsTruncated' => truncated,
|
73
|
+
'RequestId' => Fog::AWS::Mock.request_id
|
74
|
+
}
|
75
|
+
|
76
|
+
if marker
|
77
|
+
self.data[:markers][marker] = data_set
|
78
|
+
body.merge!('Marker' => marker)
|
79
|
+
end
|
80
|
+
|
81
|
+
response.body = body
|
82
|
+
response.status = 200
|
83
|
+
|
84
|
+
response
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/iam/list_policy_versions'
|
6
|
+
|
7
|
+
# Lists policy versions
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * options <~Hash>: options that filter the result set
|
11
|
+
# * Marker <~String>
|
12
|
+
# * MaxItems <~Integer>
|
13
|
+
# * PolicyArn <~String>
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response>:
|
16
|
+
# * body<~Hash>:
|
17
|
+
# * 'RequestId'<~String> - Id of the request
|
18
|
+
# * 'IsTruncated'<~Boolean>
|
19
|
+
# * 'Marker'<~String>
|
20
|
+
# * 'Versions'<~Array>:
|
21
|
+
# * CreateDate
|
22
|
+
# * IsDefaultVersion
|
23
|
+
# * VersionId
|
24
|
+
# ==== See Also
|
25
|
+
# http://docs.aws.amazon.com/IAM/latest/APIReference/API_ListPolicyVersions.html
|
26
|
+
#
|
27
|
+
def list_policy_versions(policy_arn, options={})
|
28
|
+
request({
|
29
|
+
'Action' => 'ListPolicyVersions',
|
30
|
+
'PolicyArn' => policy_arn,
|
31
|
+
:parser => Fog::Parsers::AWS::IAM::ListPolicyVersions.new
|
32
|
+
}.merge(options))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Mock
|
37
|
+
def list_policy_versions(policy_arn, options={})
|
38
|
+
limit = options['MaxItems']
|
39
|
+
marker = options['Marker']
|
40
|
+
|
41
|
+
if limit
|
42
|
+
if limit > 1_000
|
43
|
+
raise Fog::AWS::IAM::Error.new(
|
44
|
+
"ValidationError => 1 validation error detected: Value '#{limit}' at 'limit' failed to satisfy constraint: Member must have value less than or equal to 1000"
|
45
|
+
)
|
46
|
+
elsif limit < 1
|
47
|
+
raise Fog::AWS::IAM::Error.new(
|
48
|
+
"ValidationError => 1 validation error detected: Value '#{limit}' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1"
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
data_set = if marker
|
54
|
+
self.data[:markers][marker] || []
|
55
|
+
else
|
56
|
+
self.data[:policy_versions].values
|
57
|
+
end
|
58
|
+
|
59
|
+
data = data_set.slice!(0, limit || 100)
|
60
|
+
truncated = data_set.size > 0
|
61
|
+
marker = truncated && Base64.encode64("metadata/l/#{account_id}/#{UUID.uuid}")
|
62
|
+
|
63
|
+
response = Excon::Response.new
|
64
|
+
|
65
|
+
body = {
|
66
|
+
'Versions' => data,
|
67
|
+
'IsTruncated' => truncated,
|
68
|
+
'RequestId' => Fog::AWS::Mock.request_id
|
69
|
+
}
|
70
|
+
|
71
|
+
if marker
|
72
|
+
self.data[:markers][marker] = data_set
|
73
|
+
body.merge!('Marker' => marker)
|
74
|
+
end
|
75
|
+
|
76
|
+
response.body = body
|
77
|
+
response.status = 200
|
78
|
+
|
79
|
+
response
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/iam/basic'
|
6
|
+
|
7
|
+
# Remove a user from a group
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * policy_arn<~String>: arn of the policy
|
11
|
+
# * version_id<~String>: version of policy to delete
|
12
|
+
#
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response>:
|
15
|
+
# * body<~Hash>:
|
16
|
+
# * 'RequestId'<~String> - Id of the request
|
17
|
+
#
|
18
|
+
# ==== See Also
|
19
|
+
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_SetDefaultPolicyVersion.html
|
20
|
+
#
|
21
|
+
def set_default_policy_version(policy_arn, version_id)
|
22
|
+
request(
|
23
|
+
'Action' => 'SetDefaultPolicyVersion',
|
24
|
+
'PolicyArn' => policy_arn,
|
25
|
+
'VersionId' => version_id,
|
26
|
+
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def set_default_policy_version(policy_arn, version_id)
|
33
|
+
Excon::Response.new.tap do |response|
|
34
|
+
response.body = { 'RequestId' => Fog::AWS::Mock.request_id }
|
35
|
+
response.status = 200
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/iam/basic'
|
6
|
+
|
7
|
+
# Creates a managed policy
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * policy_document<~Hash>: policy document, see: http://docs.amazonwebservices.com/IAM/latest/UserGuide/PoliciesOverview.html
|
11
|
+
# * role_name<~String>: name of role to update
|
12
|
+
#
|
13
|
+
# ==== Returns
|
14
|
+
# * response<~Excon::Response>:
|
15
|
+
# * body<~Hash>:
|
16
|
+
# * 'RequestId'<~String> - Id of the request
|
17
|
+
#
|
18
|
+
# ==== See Also
|
19
|
+
# http://docs.aws.amazon.com/IAM/latest/APIReference/API_UpdateAssumeRolePolicy.html
|
20
|
+
#
|
21
|
+
def update_assume_role_policy(policy_document, role_name)
|
22
|
+
request({
|
23
|
+
'Action' => 'UpdateAssumeRolePolicy',
|
24
|
+
'PolicyDocument' => Fog::JSON.encode(policy_document),
|
25
|
+
'RoleName' => role_name,
|
26
|
+
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
27
|
+
}.reject {|_, value| value.nil?})
|
28
|
+
end
|
29
|
+
|
30
|
+
class Mock
|
31
|
+
def update_assume_role_policy(policy_document, role_name)
|
32
|
+
Excon::Response.new.tap do |response|
|
33
|
+
response.body = { 'RequestId' => Fog::AWS::Mock.request_id }
|
34
|
+
response.status = 200
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class RDS
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/rds/copy_db_snapshot'
|
6
|
+
|
7
|
+
# Copy a db snapshot
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * source_db_snapshot_identifier<~String> - Id of db snapshot
|
11
|
+
# * target_db_snapshot_identifier<~String> - Desired Id of the db snapshot copy
|
12
|
+
# * 'copy_tags'<~Boolean> - true to copy all tags from the source DB snapshot to the target DB snapshot; otherwise false.
|
13
|
+
#
|
14
|
+
# ==== Returns
|
15
|
+
# * response<~Excon::Response>:
|
16
|
+
# * body<~Hash>:
|
17
|
+
#
|
18
|
+
# {Amazon API Reference}[http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CopyDBSnapshot.html]
|
19
|
+
def copy_db_snapshot(source_db_snapshot_identifier, target_db_snapshot_identifier, copy_tags = false)
|
20
|
+
request(
|
21
|
+
'Action' => 'CopyDBSnapshot',
|
22
|
+
'SourceDBSnapshotIdentifier' => source_db_snapshot_identifier,
|
23
|
+
'TargetDBSnapshotIdentifier' => target_db_snapshot_identifier,
|
24
|
+
'CopyTags' => copy_tags,
|
25
|
+
:parser => Fog::Parsers::AWS::RDS::CopyDBSnapshot.new
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class Mock
|
31
|
+
#
|
32
|
+
# Usage
|
33
|
+
#
|
34
|
+
# Fog::AWS[:rds].copy_db_snapshot("snap-original-id", "snap-backup-id", true)
|
35
|
+
#
|
36
|
+
|
37
|
+
def copy_db_snapshot(source_db_snapshot_identifier, target_db_snapshot_identifier, copy_tags = false)
|
38
|
+
response = Excon::Response.new
|
39
|
+
response.status = 200
|
40
|
+
snapshot_id = Fog::AWS::Mock.snapshot_id
|
41
|
+
data = self.data[:snapshots]["#{source_db_snapshot_identifier}"]
|
42
|
+
data['DBSnapshotIdentifier'] = snapshot_id
|
43
|
+
self.data[:snapshots][snapshot_id] = data
|
44
|
+
response.body = {
|
45
|
+
'requestId' => Fog::AWS::Mock.request_id,
|
46
|
+
'CopyDBSnapshotResult' => {'DBSnapshot' => data.dup}
|
47
|
+
}
|
48
|
+
response
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class RDS
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/rds/modify_db_snapshot_attribute'
|
6
|
+
|
7
|
+
# Modify db snapshot attributes
|
8
|
+
#
|
9
|
+
# ==== Parameters
|
10
|
+
# * db_snapshot_identifier<~String> - Id of snapshot to modify
|
11
|
+
# * attributes<~Hash>:
|
12
|
+
# * 'Add.MemberId'<~Array> - One or more account ids to grant rds create permission to
|
13
|
+
# * 'Remove.MemberId'<~Array> - One or more account ids to revoke rds create permission from
|
14
|
+
#
|
15
|
+
# {Amazon API Reference}[http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBSnapshotAttribute.html]
|
16
|
+
#
|
17
|
+
def modify_db_snapshot_attribute(db_snapshot_identifier, attributes)
|
18
|
+
params = {}
|
19
|
+
params.merge!(Fog::AWS.indexed_param('ValuesToAdd.member.%d', attributes['Add.MemberId'] || []))
|
20
|
+
params.merge!(Fog::AWS.indexed_param('ValuesToRemove.member.%d', attributes['Remove.MemberId'] || []))
|
21
|
+
request({
|
22
|
+
'Action' => 'ModifyDBSnapshotAttribute',
|
23
|
+
'DBSnapshotIdentifier' => db_snapshot_identifier,
|
24
|
+
:idempotent => true,
|
25
|
+
'AttributeName' => "restore",
|
26
|
+
:parser => Fog::Parsers::AWS::RDS::ModifyDbSnapshotAttribute.new
|
27
|
+
}.merge!(params))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
class Mock
|
31
|
+
#
|
32
|
+
# Usage
|
33
|
+
#
|
34
|
+
# Fog::AWS[:rds].modify_db_snapshot_attribute("snap-identifier", {"Add.MemberId"=>"389480430104"})
|
35
|
+
#
|
36
|
+
|
37
|
+
def modify_db_snapshot_attribute(db_snapshot_identifier, attributes)
|
38
|
+
response = Excon::Response.new
|
39
|
+
response.status = 200
|
40
|
+
response.body = {
|
41
|
+
'requestId' => Fog::AWS::Mock.request_id
|
42
|
+
}.merge!(data)
|
43
|
+
response
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/fog/aws/version.rb
CHANGED
data/tests/credentials_tests.rb
CHANGED
@@ -7,6 +7,7 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
7
7
|
Excon.defaults[:mock] = true
|
8
8
|
default_credentials = Fog::Compute::AWS.fetch_credentials({})
|
9
9
|
Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/"}, {:status => 200, :body => 'arole'})
|
10
|
+
Excon.stub({:method => :get, :path => "/latest/meta-data/placement/availability-zone/"}, {:status => 200, :body => 'us-west-1a'})
|
10
11
|
|
11
12
|
expires_at = Time.at(Time.now.to_i + 500)
|
12
13
|
credentials = {
|
@@ -23,6 +24,7 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
23
24
|
returns({:aws_access_key_id => 'dummykey',
|
24
25
|
:aws_secret_access_key => 'dummysecret',
|
25
26
|
:aws_session_token => 'dummytoken',
|
27
|
+
:region => "us-west-1",
|
26
28
|
:aws_credentials_expire_at => expires_at}) { Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true) }
|
27
29
|
end
|
28
30
|
|
@@ -47,6 +49,7 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
47
49
|
|
48
50
|
tests("#fetch_credentials when the url 404s") do
|
49
51
|
Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/"}, {:status => 404, :body => 'not bound'})
|
52
|
+
Excon.stub({:method => :get, :path => "/latest/meta-data/placement/availability-zone/"}, {:status => 400, :body => 'not found'})
|
50
53
|
returns(default_credentials) {Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true)}
|
51
54
|
end
|
52
55
|
|
@@ -32,6 +32,16 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
32
32
|
'IsTruncated' => Fog::Boolean
|
33
33
|
}
|
34
34
|
|
35
|
+
attached_policy_format = {
|
36
|
+
'PolicyArn' => String,
|
37
|
+
'PolicyName' => String
|
38
|
+
}
|
39
|
+
|
40
|
+
list_managed_policies_format = {
|
41
|
+
'RequestId' => String,
|
42
|
+
'AttachedPolicies' => [attached_policy_format]
|
43
|
+
}
|
44
|
+
|
35
45
|
tests("#create_policy('fog_policy')").formats(create_policy_format) do
|
36
46
|
body = Fog::AWS[:iam].create_policy('fog_policy', @policy, '/fog/').body
|
37
47
|
puts body.inspect
|
@@ -52,15 +62,22 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
52
62
|
Fog::AWS[:iam].attach_user_policy('fog_policy_test_user', @policy_arn).body
|
53
63
|
end
|
54
64
|
|
65
|
+
tests("#list_attach_user_policies()").formats(list_managed_policies_format) do
|
66
|
+
Fog::AWS[:iam].list_attached_user_policies('fog_policy_test_user').body
|
67
|
+
end
|
68
|
+
|
55
69
|
tests("#detach_user_policy()").formats(AWS::IAM::Formats::BASIC) do
|
56
70
|
Fog::AWS[:iam].detach_user_policy('fog_policy_test_user', @policy_arn).body
|
57
71
|
end
|
58
72
|
|
59
|
-
|
60
73
|
tests("#attach_group_policy()").formats(AWS::IAM::Formats::BASIC) do
|
61
74
|
Fog::AWS[:iam].attach_group_policy('fog_policy_test_group', @policy_arn).body
|
62
75
|
end
|
63
76
|
|
77
|
+
tests("#list_attach_group_policies()").formats(fog_policy_test_group) do
|
78
|
+
Fog::AWS[:iam].list_attached_group_policies('fog_policy_test_group').body
|
79
|
+
end
|
80
|
+
|
64
81
|
tests("#detach_group_policy()").formats(AWS::IAM::Formats::BASIC) do
|
65
82
|
Fog::AWS[:iam].detach_group_policy('fog_policy_test_group', @policy_arn).body
|
66
83
|
end
|
@@ -69,6 +86,10 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
69
86
|
Fog::AWS[:iam].attach_role_policy('fog_policy_test_role', @policy_arn).body
|
70
87
|
end
|
71
88
|
|
89
|
+
tests("#list_attach_role_policies()").formats(fog_policy_test_group) do
|
90
|
+
Fog::AWS[:iam].attach_role_policies('fog_policy_test_role').body
|
91
|
+
end
|
92
|
+
|
72
93
|
tests("#detach_role_policy()").formats(AWS::IAM::Formats::BASIC) do
|
73
94
|
Fog::AWS[:iam].detach_role_policy('fog_policy_test_role', @policy_arn).body
|
74
95
|
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
Shindo.tests('AWS::IAM | versioned managed policy requests', ['aws']) do
|
2
|
+
|
3
|
+
pending if Fog.mocking?
|
4
|
+
|
5
|
+
tests('success') do
|
6
|
+
@policy = {'Version' => '2012-10-17', "Statement" => [{"Effect" => "Deny", "Action" => "*", "Resource" => "*"}]}
|
7
|
+
@policy_v2 = {'Version' => '2012-10-17', "Statement" => [{"Effect" => "Allow", "Action" => "*", "Resource" => "*"}]}
|
8
|
+
|
9
|
+
@policy_format = {
|
10
|
+
'Arn' => String,
|
11
|
+
'AttachmentCount' => Integer,
|
12
|
+
'Description' => String,
|
13
|
+
'DefaultVersionId' => String,
|
14
|
+
'IsAttachable' => Fog::Boolean,
|
15
|
+
'Path' => String,
|
16
|
+
'PolicyId' => String,
|
17
|
+
'PolicyName' => String,
|
18
|
+
'CreateDate' => Time,
|
19
|
+
'UpdateDate' => Time
|
20
|
+
}
|
21
|
+
|
22
|
+
create_policy_format = {
|
23
|
+
'RequestId' => String,
|
24
|
+
'Policy' => @policy_format
|
25
|
+
}
|
26
|
+
|
27
|
+
list_policies_format = {
|
28
|
+
'RequestId' => String,
|
29
|
+
'Policies' => [@policy_format],
|
30
|
+
'Marker' => String,
|
31
|
+
'IsTruncated' => Fog::Boolean
|
32
|
+
}
|
33
|
+
|
34
|
+
versioned_policy_format = {
|
35
|
+
'CreateDate' => Time,
|
36
|
+
'Document' => Hash,
|
37
|
+
'IsDefaultVersion' => Fog::Boolean,
|
38
|
+
'Description' => String
|
39
|
+
}
|
40
|
+
|
41
|
+
create_versioned_policy_format = {
|
42
|
+
'RequestId' => String,
|
43
|
+
'PolicyVersion' => [versioned_policy_format]
|
44
|
+
}
|
45
|
+
|
46
|
+
policy_verions_format = {
|
47
|
+
'CreateDate' => Time,
|
48
|
+
'IsDefaultVersion' => Fog::Boolean,
|
49
|
+
'VersionId' => String
|
50
|
+
}
|
51
|
+
|
52
|
+
list_policy_versions_format = {
|
53
|
+
'RequestId' => String,
|
54
|
+
'Versions' => [policy_verions_format],
|
55
|
+
'Marker' => String,
|
56
|
+
'IsTruncated' => Fog::Boolean
|
57
|
+
}
|
58
|
+
|
59
|
+
tests("#create_policy('fog_policy')").formats(create_policy_format) do
|
60
|
+
body = Fog::AWS[:iam].create_policy('fog_policy', @policy, '/fog/').body
|
61
|
+
puts body.inspect
|
62
|
+
@policy_arn = body['Policy']['Arn']
|
63
|
+
body
|
64
|
+
end
|
65
|
+
|
66
|
+
tests("#list_policies('fog_policy')").formats(list_policies_format) do
|
67
|
+
body = Fog::AWS[:iam].list_policies('PathPrefix' => '/fog/').body
|
68
|
+
tests('length 1').returns(1) do
|
69
|
+
body['Policies'].length
|
70
|
+
end
|
71
|
+
body
|
72
|
+
end
|
73
|
+
|
74
|
+
tests("#create_versioned_policy('fog_policy')").formats(create_versioned_policy_format) do
|
75
|
+
body = Fog::AWS[:iam].create_versioned_policy(@policy_arn, @policy_v2, true).body
|
76
|
+
puts body.inspect
|
77
|
+
@policy_version_document = body['PolicyVersion']['Document']
|
78
|
+
body
|
79
|
+
end
|
80
|
+
|
81
|
+
tests("#list_policy_versions('fog_policy')").formats(list_policy_versions_format) do
|
82
|
+
body = Fog::AWS[:iam].list_policy_versions(@policy_arn).body
|
83
|
+
tests('length 2').returns(2) do
|
84
|
+
body['Versions'].length
|
85
|
+
end
|
86
|
+
body
|
87
|
+
end
|
88
|
+
|
89
|
+
tests("#set_default_policy_version('fog_policy')").formats(AWS::IAM::Formats::BASIC) do
|
90
|
+
body = Fog::AWS[:iam].set_default_policy_version(@policy_arn, 'v1').body
|
91
|
+
tests('length 2').returns(2) do
|
92
|
+
body['Versions'].length
|
93
|
+
end
|
94
|
+
body
|
95
|
+
end
|
96
|
+
|
97
|
+
tests("#delete_versioned_policy('fog_policy')").formats(AWS::IAM::Formats::BASIC) do
|
98
|
+
body = Fog::AWS[:iam].delete_policy(@policy_arn, 'v2').body
|
99
|
+
puts body.inspect
|
100
|
+
@policy_version_document = body['PolicyVersion']['Document']
|
101
|
+
body
|
102
|
+
end
|
103
|
+
|
104
|
+
tests("#delete_policy('fog_policy')").formats(AWS::IAM::Formats::BASIC) do
|
105
|
+
Fog::AWS[:iam].delete_policy(@policy_arn).body
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
tests('failure') do
|
111
|
+
test('failing conditions')
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
Shindo.tests('Fog::Rds[:aws] | db snapshot requests', ['aws']) do
|
2
|
+
|
3
|
+
@snapshot_format = {
|
4
|
+
'AllocatedStorage' => Integer,
|
5
|
+
'AvailabilityZone' => Fog::Nullable::String,
|
6
|
+
'Engine' => String,
|
7
|
+
'EngineVersion' => String,
|
8
|
+
'InstanceCreateTime' => Time,
|
9
|
+
'DBInstanceIdentifier' => String,
|
10
|
+
'DBSnapshotIdentifier' => String,
|
11
|
+
'Iops' => Fog::Nullable::Integer,
|
12
|
+
'MasterUsername' => String,
|
13
|
+
'Port' => Fog::Nullable::Integer,
|
14
|
+
'Status' => String,
|
15
|
+
'StorageType' => String,
|
16
|
+
'SnapshotType' => String,
|
17
|
+
'SnapshotCreateTime' => Fog::Nullable::Time,
|
18
|
+
}
|
19
|
+
|
20
|
+
@snapshots_format = {
|
21
|
+
'requestId' => String
|
22
|
+
}
|
23
|
+
|
24
|
+
@rds_identity = "test_rds"
|
25
|
+
|
26
|
+
Fog::AWS[:rds].create_db_instance(@rds_identity,{
|
27
|
+
"DBInstanceClass"=>"db.m3.xlarge",
|
28
|
+
"Engine"=>"PostgreSQL",
|
29
|
+
"AllocatedStorage"=>100,
|
30
|
+
"MasterUserPassword"=>"password",
|
31
|
+
"MasterUsername"=>"username"
|
32
|
+
})
|
33
|
+
|
34
|
+
@rds = Fog::AWS[:rds].servers.get(@rds_identity)
|
35
|
+
|
36
|
+
tests('success') do
|
37
|
+
@snapshot_id = "testRdsSnapshot"
|
38
|
+
tests("#create_snapshot(#{@rds.identity})").formats(@snapshot_format) do
|
39
|
+
Fog::AWS[:rds].create_db_snapshot(@rds.identity,@snapshot_id).body["CreateDBSnapshotResult"]["DBSnapshot"]
|
40
|
+
end
|
41
|
+
|
42
|
+
Fog.wait_for { Fog::AWS[:rds].snapshots.get(@snapshot_id) }
|
43
|
+
Fog::AWS[:rds].snapshots.get(@snapshot_id).wait_for { ready? }
|
44
|
+
|
45
|
+
tests("#modify_db_snapshot_attribute").formats(@snapshots_format) do
|
46
|
+
Fog::AWS[:rds].modify_db_snapshot_attribute(@snapshot_id, {"Add.MemberId"=>["389480430104"]}).body
|
47
|
+
end
|
48
|
+
|
49
|
+
tests("#copy_db_snapshot (#{@snapshot_id}, target_snapshot_id)").formats(@snapshot_format) do
|
50
|
+
Fog::AWS[:rds].copy_db_snapshot(@snapshot_id, "target_snapshot_id").body["CopyDBSnapshotResult"]["DBSnapshot"]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
tests('failure') do
|
55
|
+
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::RDS::NotFound) do
|
56
|
+
Fog::AWS[:rds].delete_db_snapshot(@rds.identity)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
@rds.destroy
|
61
|
+
|
62
|
+
end
|
@@ -138,7 +138,7 @@ class AWS
|
|
138
138
|
|
139
139
|
SNAPSHOT = {
|
140
140
|
'AllocatedStorage' => Integer,
|
141
|
-
'AvailabilityZone' => String,
|
141
|
+
'AvailabilityZone' => Fog::Nullable::String,
|
142
142
|
'DBInstanceIdentifier' => String,
|
143
143
|
'DBSnapshotIdentifier' => String,
|
144
144
|
'EngineVersion' => String,
|
@@ -146,10 +146,11 @@ class AWS
|
|
146
146
|
'InstanceCreateTime' => Time,
|
147
147
|
'Iops' => Fog::Nullable::Integer,
|
148
148
|
'MasterUsername' => String,
|
149
|
-
'Port' => Integer,
|
149
|
+
'Port' => Fog::Nullable::Integer,
|
150
150
|
'SnapshotCreateTime' => Fog::Nullable::Time,
|
151
151
|
'Status' => String,
|
152
|
-
'SnapshotType' => String
|
152
|
+
'SnapshotType' => String,
|
153
|
+
'StorageType' => String,
|
153
154
|
}
|
154
155
|
|
155
156
|
INSTANCE = {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lane
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -558,6 +558,7 @@ files:
|
|
558
558
|
- lib/fog/aws/parsers/iam/list_managed_policies.rb
|
559
559
|
- lib/fog/aws/parsers/iam/list_mfa_devices.rb
|
560
560
|
- lib/fog/aws/parsers/iam/list_policies.rb
|
561
|
+
- lib/fog/aws/parsers/iam/list_policy_versions.rb
|
561
562
|
- lib/fog/aws/parsers/iam/list_roles.rb
|
562
563
|
- lib/fog/aws/parsers/iam/list_server_certificates.rb
|
563
564
|
- lib/fog/aws/parsers/iam/list_signing_certificates.rb
|
@@ -577,6 +578,7 @@ files:
|
|
577
578
|
- lib/fog/aws/parsers/lambda/base.rb
|
578
579
|
- lib/fog/aws/parsers/rds/authorize_db_security_group_ingress.rb
|
579
580
|
- lib/fog/aws/parsers/rds/base.rb
|
581
|
+
- lib/fog/aws/parsers/rds/copy_db_snapshot.rb
|
580
582
|
- lib/fog/aws/parsers/rds/create_db_cluster.rb
|
581
583
|
- lib/fog/aws/parsers/rds/create_db_cluster_snapshot.rb
|
582
584
|
- lib/fog/aws/parsers/rds/create_db_instance.rb
|
@@ -618,6 +620,7 @@ files:
|
|
618
620
|
- lib/fog/aws/parsers/rds/event_subscription_parser.rb
|
619
621
|
- lib/fog/aws/parsers/rds/modify_db_instance.rb
|
620
622
|
- lib/fog/aws/parsers/rds/modify_db_parameter_group.rb
|
623
|
+
- lib/fog/aws/parsers/rds/modify_db_snapshot_attribute.rb
|
621
624
|
- lib/fog/aws/parsers/rds/promote_read_replica.rb
|
622
625
|
- lib/fog/aws/parsers/rds/reboot_db_instance.rb
|
623
626
|
- lib/fog/aws/parsers/rds/restore_db_instance_from_db_snapshot.rb
|
@@ -1063,6 +1066,7 @@ files:
|
|
1063
1066
|
- lib/fog/aws/requests/iam/create_instance_profile.rb
|
1064
1067
|
- lib/fog/aws/requests/iam/create_login_profile.rb
|
1065
1068
|
- lib/fog/aws/requests/iam/create_policy.rb
|
1069
|
+
- lib/fog/aws/requests/iam/create_policy_version.rb
|
1066
1070
|
- lib/fog/aws/requests/iam/create_role.rb
|
1067
1071
|
- lib/fog/aws/requests/iam/create_user.rb
|
1068
1072
|
- lib/fog/aws/requests/iam/delete_access_key.rb
|
@@ -1073,6 +1077,7 @@ files:
|
|
1073
1077
|
- lib/fog/aws/requests/iam/delete_instance_profile.rb
|
1074
1078
|
- lib/fog/aws/requests/iam/delete_login_profile.rb
|
1075
1079
|
- lib/fog/aws/requests/iam/delete_policy.rb
|
1080
|
+
- lib/fog/aws/requests/iam/delete_policy_version.rb
|
1076
1081
|
- lib/fog/aws/requests/iam/delete_role.rb
|
1077
1082
|
- lib/fog/aws/requests/iam/delete_role_policy.rb
|
1078
1083
|
- lib/fog/aws/requests/iam/delete_server_certificate.rb
|
@@ -1098,6 +1103,7 @@ files:
|
|
1098
1103
|
- lib/fog/aws/requests/iam/list_access_keys.rb
|
1099
1104
|
- lib/fog/aws/requests/iam/list_account_aliases.rb
|
1100
1105
|
- lib/fog/aws/requests/iam/list_attached_group_policies.rb
|
1106
|
+
- lib/fog/aws/requests/iam/list_attached_role_policies.rb
|
1101
1107
|
- lib/fog/aws/requests/iam/list_attached_user_policies.rb
|
1102
1108
|
- lib/fog/aws/requests/iam/list_group_policies.rb
|
1103
1109
|
- lib/fog/aws/requests/iam/list_groups.rb
|
@@ -1106,6 +1112,7 @@ files:
|
|
1106
1112
|
- lib/fog/aws/requests/iam/list_instance_profiles_for_role.rb
|
1107
1113
|
- lib/fog/aws/requests/iam/list_mfa_devices.rb
|
1108
1114
|
- lib/fog/aws/requests/iam/list_policies.rb
|
1115
|
+
- lib/fog/aws/requests/iam/list_policy_versions.rb
|
1109
1116
|
- lib/fog/aws/requests/iam/list_role_policies.rb
|
1110
1117
|
- lib/fog/aws/requests/iam/list_roles.rb
|
1111
1118
|
- lib/fog/aws/requests/iam/list_server_certificates.rb
|
@@ -1117,8 +1124,10 @@ files:
|
|
1117
1124
|
- lib/fog/aws/requests/iam/put_user_policy.rb
|
1118
1125
|
- lib/fog/aws/requests/iam/remove_role_from_instance_profile.rb
|
1119
1126
|
- lib/fog/aws/requests/iam/remove_user_from_group.rb
|
1127
|
+
- lib/fog/aws/requests/iam/set_default_policy_version.rb
|
1120
1128
|
- lib/fog/aws/requests/iam/update_access_key.rb
|
1121
1129
|
- lib/fog/aws/requests/iam/update_account_password_policy.rb
|
1130
|
+
- lib/fog/aws/requests/iam/update_assume_role_policy.rb
|
1122
1131
|
- lib/fog/aws/requests/iam/update_group.rb
|
1123
1132
|
- lib/fog/aws/requests/iam/update_login_profile.rb
|
1124
1133
|
- lib/fog/aws/requests/iam/update_server_certificate.rb
|
@@ -1160,6 +1169,7 @@ files:
|
|
1160
1169
|
- lib/fog/aws/requests/lambda/update_function_configuration.rb
|
1161
1170
|
- lib/fog/aws/requests/rds/add_tags_to_resource.rb
|
1162
1171
|
- lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb
|
1172
|
+
- lib/fog/aws/requests/rds/copy_db_snapshot.rb
|
1163
1173
|
- lib/fog/aws/requests/rds/create_db_cluster.rb
|
1164
1174
|
- lib/fog/aws/requests/rds/create_db_cluster_snapshot.rb
|
1165
1175
|
- lib/fog/aws/requests/rds/create_db_instance.rb
|
@@ -1196,6 +1206,7 @@ files:
|
|
1196
1206
|
- lib/fog/aws/requests/rds/list_tags_for_resource.rb
|
1197
1207
|
- lib/fog/aws/requests/rds/modify_db_instance.rb
|
1198
1208
|
- lib/fog/aws/requests/rds/modify_db_parameter_group.rb
|
1209
|
+
- lib/fog/aws/requests/rds/modify_db_snapshot_attribute.rb
|
1199
1210
|
- lib/fog/aws/requests/rds/promote_read_replica.rb
|
1200
1211
|
- lib/fog/aws/requests/rds/reboot_db_instance.rb
|
1201
1212
|
- lib/fog/aws/requests/rds/remove_tags_from_resource.rb
|
@@ -1537,6 +1548,7 @@ files:
|
|
1537
1548
|
- tests/requests/iam/server_certificate_tests.rb
|
1538
1549
|
- tests/requests/iam/user_policy_tests.rb
|
1539
1550
|
- tests/requests/iam/user_tests.rb
|
1551
|
+
- tests/requests/iam/versioned_managed_policy_tests.rb
|
1540
1552
|
- tests/requests/kinesis/helper.rb
|
1541
1553
|
- tests/requests/kinesis/stream_tests.rb
|
1542
1554
|
- tests/requests/kms/helper.rb
|
@@ -1548,6 +1560,7 @@ files:
|
|
1548
1560
|
- tests/requests/rds/cluster_snapshot_tests.rb
|
1549
1561
|
- tests/requests/rds/cluster_tests.rb
|
1550
1562
|
- tests/requests/rds/db_engine_versions.rb
|
1563
|
+
- tests/requests/rds/db_snapshot_tests.rb
|
1551
1564
|
- tests/requests/rds/describe_events.rb
|
1552
1565
|
- tests/requests/rds/event_subscription_tests.rb
|
1553
1566
|
- tests/requests/rds/helper.rb
|
@@ -1615,3 +1628,4 @@ signing_key:
|
|
1615
1628
|
specification_version: 4
|
1616
1629
|
summary: Module for the 'fog' gem to support Amazon Web Services.
|
1617
1630
|
test_files: []
|
1631
|
+
has_rdoc:
|