fog-aws 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +15 -1
- data/gemfiles/Gemfile-ruby-1.9 +1 -0
- data/gemfiles/Gemfile-ruby-2.0 +7 -0
- data/lib/fog/aws/auto_scaling.rb +1 -1
- data/lib/fog/aws/iam.rb +3 -0
- data/lib/fog/aws/iam/default_policy_versions.json +1 -0
- data/lib/fog/aws/models/iam/instance_profile.rb +40 -0
- data/lib/fog/aws/models/iam/instance_profiles.rb +24 -0
- data/lib/fog/aws/models/iam/managed_policies.rb +12 -0
- data/lib/fog/aws/models/iam/managed_policy.rb +20 -0
- data/lib/fog/aws/models/iam/role.rb +35 -0
- data/lib/fog/aws/parsers/compute/describe_reserved_instances.rb +17 -6
- data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +2 -4
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +5 -1
- data/lib/fog/aws/requests/iam/add_role_to_instance_profile.rb +19 -0
- data/lib/fog/aws/requests/iam/attach_group_policy.rb +1 -0
- data/lib/fog/aws/requests/iam/attach_role_policy.rb +30 -4
- data/lib/fog/aws/requests/iam/attach_user_policy.rb +1 -0
- data/lib/fog/aws/requests/iam/create_instance_profile.rb +20 -0
- data/lib/fog/aws/requests/iam/create_policy.rb +26 -2
- data/lib/fog/aws/requests/iam/delete_instance_profile.rb +15 -0
- data/lib/fog/aws/requests/iam/delete_policy.rb +15 -0
- data/lib/fog/aws/requests/iam/detach_group_policy.rb +1 -0
- data/lib/fog/aws/requests/iam/detach_role_policy.rb +27 -0
- data/lib/fog/aws/requests/iam/detach_user_policy.rb +1 -0
- data/lib/fog/aws/requests/iam/get_instance_profile.rb +17 -0
- data/lib/fog/aws/requests/iam/list_attached_user_policies.rb +2 -1
- data/lib/fog/aws/requests/iam/list_instance_profiles.rb +9 -0
- data/lib/fog/aws/requests/iam/list_instance_profiles_for_role.rb +10 -0
- data/lib/fog/aws/requests/iam/list_policies.rb +4 -0
- data/lib/fog/aws/requests/iam/remove_role_from_instance_profile.rb +19 -0
- data/lib/fog/aws/version.rb +1 -1
- data/tests/models/iam/instance_profile_tests.rb +18 -0
- data/tests/models/iam/managed_policies_tests.rb +23 -1
- data/tests/requests/auto_scaling/auto_scaling_tests.rb +20 -18
- data/tests/requests/auto_scaling/model_tests.rb +3 -1
- data/tests/requests/auto_scaling/tag_tests.rb +2 -2
- data/tests/requests/iam/helper.rb +18 -0
- data/tests/requests/iam/instance_profile_tests.rb +44 -0
- data/tests/requests/iam/managed_policy_tests.rb +17 -18
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a19f2beb9ccbc769e67d13f1439379dbe37d345
|
4
|
+
data.tar.gz: d2c335bd1b9b390d49ecfc3ca651611801e1b063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 292f539571c0e60a9cb39b999b2d3082c22dc49d664ef06aabab0adde68d6f40c8caf4a198ce1fc97ab47e77a82a564f65330c2fe7cb9525ab2134160a9fc225
|
7
|
+
data.tar.gz: 124b4a4d8ea72f661e3d98cf9c215871d56b377fb7d614973a5bab32384dcdd64a8ace0a5fee6fbdcb354a6b8473d2c49c9b1052aedb8d8f8bf324cda0a69e1d
|
data/.travis.yml
CHANGED
@@ -12,7 +12,7 @@ matrix:
|
|
12
12
|
- rvm: 1.9.3
|
13
13
|
gemfile: gemfiles/Gemfile-ruby-1.9
|
14
14
|
- rvm: 2.0.0
|
15
|
-
gemfile: Gemfile
|
15
|
+
gemfile: gemfiles/Gemfile-ruby-2.0
|
16
16
|
- rvm: 2.1.0
|
17
17
|
gemfile: Gemfile
|
18
18
|
- rvm: 2.1.1
|
@@ -51,4 +51,4 @@ env:
|
|
51
51
|
global:
|
52
52
|
secure: LlDKdKSRo3sEjQ55XesbOXhKZ3RrOtqoD1ZL8Wx39K3iVzeEV3Kc8HjDfEvo7R4pOc3BMTNJcputklVEPN0FkWGN7Py+OEtbHj3IZl0MX+KEWNk0gU+4+sgPrL1eXUQyMUSkCrBsKg08rPel4KMYUOXbtnLyUU9PDbBwm4LJYOc=
|
53
53
|
after_success:
|
54
|
-
- bundle exec codeclimate-test-reporter
|
54
|
+
- bundle exec codeclimate-test-reporter
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,21 @@
|
|
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/v1.
|
5
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v1.1.0...HEAD)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Support for AWS Application Load Balancer \(ALB\) [\#335](https://github.com/fog/fog-aws/issues/335)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Better iam policies [\#339](https://github.com/fog/fog-aws/pull/339) ([ehowe](https://github.com/ehowe))
|
14
|
+
- Pin nokogiri gem for Ruby 1.9 and Ruby 2.0 [\#337](https://github.com/fog/fog-aws/pull/337) ([sodabrew](https://github.com/sodabrew))
|
15
|
+
- Fix parsing of the Reserved Instance 'recurringCharge' field and add 'scope' field [\#336](https://github.com/fog/fog-aws/pull/336) ([sodabrew](https://github.com/sodabrew))
|
16
|
+
- Fixes / improvements for AutoScaling [\#334](https://github.com/fog/fog-aws/pull/334) ([lanej](https://github.com/lanej))
|
17
|
+
|
18
|
+
## [v1.1.0](https://github.com/fog/fog-aws/tree/v1.1.0) (2016-12-16)
|
19
|
+
[Full Changelog](https://github.com/fog/fog-aws/compare/v1.0.0...v1.1.0)
|
6
20
|
|
7
21
|
**Closed issues:**
|
8
22
|
|
data/gemfiles/Gemfile-ruby-1.9
CHANGED
data/lib/fog/aws/auto_scaling.rb
CHANGED
@@ -164,7 +164,7 @@ module Fog
|
|
164
164
|
when 'ResourceInUse'
|
165
165
|
Fog::AWS::AutoScaling::ResourceInUse.slurp(error, match[:message])
|
166
166
|
when 'ValidationError'
|
167
|
-
Fog::AWS::AutoScaling::ValidationError.slurp(error, match[:message])
|
167
|
+
Fog::AWS::AutoScaling::ValidationError.slurp(error, CGI.unescapeHTML(match[:message]))
|
168
168
|
else
|
169
169
|
Fog::AWS::AutoScaling::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
170
170
|
end
|
data/lib/fog/aws/iam.rb
CHANGED
@@ -99,6 +99,8 @@ module Fog
|
|
99
99
|
collection :access_keys
|
100
100
|
model :group
|
101
101
|
collection :groups
|
102
|
+
model :instance_profile
|
103
|
+
collection :instance_profiles
|
102
104
|
model :managed_policy
|
103
105
|
collection :managed_policies
|
104
106
|
model :policy
|
@@ -117,6 +119,7 @@ module Fog
|
|
117
119
|
|
118
120
|
hash[key] = {
|
119
121
|
:owner_id => owner_id,
|
122
|
+
:instance_profiles => {},
|
120
123
|
:server_certificates => {},
|
121
124
|
:access_keys => [{
|
122
125
|
"Status" => "Active",
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class InstanceProfile < Fog::Model
|
5
|
+
identity :name, :aliases => 'InstanceProfileName'
|
6
|
+
|
7
|
+
attribute :id, :aliases => 'InstanceProfileId'
|
8
|
+
attribute :roles, :aliases => 'Roles', :type => :array
|
9
|
+
attribute :arn, :aliases => 'Arn'
|
10
|
+
attribute :path, :aliases => 'Path'
|
11
|
+
attribute :create_date, :aliases => 'CreateDate', :type => :time
|
12
|
+
|
13
|
+
def add_role(role_name)
|
14
|
+
requires :identity
|
15
|
+
service.add_role_to_instance_profile(role_name, self.name)
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove_role(role_name)
|
20
|
+
requires :identity
|
21
|
+
service.remove_role_from_instance_profile(role_name, self.name)
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy
|
26
|
+
requires :identity
|
27
|
+
service.delete_instance_profile(self.identity)
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def save
|
32
|
+
requires :identity
|
33
|
+
|
34
|
+
data = service.create_instance_profile(self.name, self.path).body['InstanceProfile']
|
35
|
+
merge_attributes(data)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'fog/aws/models/iam/instance_profile'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class IAM
|
6
|
+
class InstanceProfiles < Fog::AWS::IAM::PagedCollection
|
7
|
+
model Fog::AWS::IAM::InstanceProfile
|
8
|
+
|
9
|
+
def all(options={})
|
10
|
+
body = service.list_instance_profiles(page_params(options)).body
|
11
|
+
|
12
|
+
merge_attributes(body)
|
13
|
+
load(body["InstanceProfiles"])
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(identity)
|
17
|
+
new(service.get_instance_profile(identity).body["Role"])
|
18
|
+
rescue Excon::Errors::NotFound, Fog::AWS::IAM::NotFound
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -8,6 +8,7 @@ module Fog
|
|
8
8
|
|
9
9
|
attribute :username
|
10
10
|
attribute :group_name
|
11
|
+
attribute :role_name
|
11
12
|
|
12
13
|
model Fog::AWS::IAM::ManagedPolicy
|
13
14
|
|
@@ -16,6 +17,8 @@ module Fog
|
|
16
17
|
all_by_user(self.username, options)
|
17
18
|
elsif self.group_name
|
18
19
|
all_by_group(self.group_name, options)
|
20
|
+
elsif self.role_name
|
21
|
+
all_by_role(self.role_name, options)
|
19
22
|
else
|
20
23
|
all_policies(options)
|
21
24
|
end
|
@@ -51,6 +54,15 @@ module Fog
|
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
57
|
+
def all_by_role(role_name, options={})
|
58
|
+
body = service.list_attached_role_policies(role_name, page_params(options)).body
|
59
|
+
merge_attributes(body)
|
60
|
+
|
61
|
+
body['Policies'].map do |policy|
|
62
|
+
service.get_policy(policy['PolicyArn']).body['Policy']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
54
66
|
def all_policies(options={})
|
55
67
|
body = service.list_policies(page_params(options)).body
|
56
68
|
merge_attributes(body)
|
@@ -14,6 +14,8 @@ module Fog
|
|
14
14
|
attribute :path, :aliases => 'Path'
|
15
15
|
attribute :updated_at, :aliases => 'UpdateDate', :type => :time
|
16
16
|
|
17
|
+
attr_accessor :policy_document
|
18
|
+
|
17
19
|
def attach(user_or_username)
|
18
20
|
requires :arn
|
19
21
|
|
@@ -32,6 +34,24 @@ module Fog
|
|
32
34
|
service.get_policy_version(self.arn, self.default_version).
|
33
35
|
body['PolicyVersion']['Document']
|
34
36
|
end
|
37
|
+
|
38
|
+
def reload
|
39
|
+
service.managed_policies.get(self.arn)
|
40
|
+
end
|
41
|
+
|
42
|
+
def save
|
43
|
+
requires :name, :policy_document
|
44
|
+
|
45
|
+
merge_attributes(service.create_policy(self.name, self.policy_document, self.path, self.description).body["Policy"])
|
46
|
+
end
|
47
|
+
|
48
|
+
def destroy
|
49
|
+
requires :arn
|
50
|
+
|
51
|
+
service.delete_policy(self.arn)
|
52
|
+
|
53
|
+
true
|
54
|
+
end
|
35
55
|
end
|
36
56
|
end
|
37
57
|
end
|
@@ -20,6 +20,41 @@ module Fog
|
|
20
20
|
true
|
21
21
|
end
|
22
22
|
|
23
|
+
def attach(policy_or_arn)
|
24
|
+
requires :rolename
|
25
|
+
|
26
|
+
arn = if policy_or_arn.respond_to?(:arn)
|
27
|
+
policy_or_arn.arn
|
28
|
+
else
|
29
|
+
policy_or_arn
|
30
|
+
end
|
31
|
+
|
32
|
+
service.attach_role_policy(self.rolename, arn)
|
33
|
+
end
|
34
|
+
|
35
|
+
def detach(policy_or_arn)
|
36
|
+
requires :rolename
|
37
|
+
|
38
|
+
arn = if policy_or_arn.respond_to?(:arn)
|
39
|
+
policy_or_arn.arn
|
40
|
+
else
|
41
|
+
policy_or_arn
|
42
|
+
end
|
43
|
+
|
44
|
+
service.detach_role_policy(self.rolename, arn)
|
45
|
+
end
|
46
|
+
|
47
|
+
def attached_policies
|
48
|
+
requires :rolename
|
49
|
+
|
50
|
+
service.managed_policies(:role_name => self.rolename)
|
51
|
+
end
|
52
|
+
|
53
|
+
def instance_profiles
|
54
|
+
requires :rolename
|
55
|
+
service.instance_profiles.load(service.list_instance_profiles_for_role(self.rolename).body["InstanceProfiles"])
|
56
|
+
end
|
57
|
+
|
23
58
|
def destroy
|
24
59
|
requires :rolename
|
25
60
|
|
@@ -4,16 +4,15 @@ module Fog
|
|
4
4
|
module AWS
|
5
5
|
class DescribeReservedInstances < Fog::Parsers::Base
|
6
6
|
def get_default_item
|
7
|
-
{'tagSet' => {}, 'recurringCharges' =>
|
7
|
+
{'tagSet' => {}, 'recurringCharges' => []}
|
8
8
|
end
|
9
9
|
|
10
10
|
def reset
|
11
11
|
@context = []
|
12
|
-
|
13
|
-
# it currently being flatted
|
14
|
-
@contexts = ['reservedInstancesSet', 'tagSet']
|
12
|
+
@contexts = ['reservedInstancesSet', 'recurringCharges', 'tagSet']
|
15
13
|
@reserved_instance = get_default_item
|
16
14
|
@response = { 'reservedInstancesSet' => [] }
|
15
|
+
@charge = {}
|
17
16
|
@tag = {}
|
18
17
|
end
|
19
18
|
|
@@ -26,11 +25,11 @@ module Fog
|
|
26
25
|
|
27
26
|
def end_element(name)
|
28
27
|
case name
|
29
|
-
when 'availabilityZone', 'instanceType', '
|
28
|
+
when 'availabilityZone', 'instanceTenancy', 'instanceType', 'offeringType', 'productDescription', 'reservedInstancesId', 'scope', 'state'
|
30
29
|
@reserved_instance[name] = value
|
31
30
|
when 'duration', 'instanceCount'
|
32
31
|
@reserved_instance[name] = value.to_i
|
33
|
-
when 'fixedPrice', '
|
32
|
+
when 'fixedPrice', 'usagePrice'
|
34
33
|
@reserved_instance[name] = value.to_f
|
35
34
|
when *@contexts
|
36
35
|
@context.pop
|
@@ -39,10 +38,22 @@ module Fog
|
|
39
38
|
when 'reservedInstancesSet'
|
40
39
|
@response['reservedInstancesSet'] << @reserved_instance
|
41
40
|
@reserved_instance = get_default_item
|
41
|
+
when 'recurringCharges'
|
42
|
+
@reserved_instance['recurringCharges'] << { 'frequency' => @charge['frequency'], 'amount' => @charge['amount'] }
|
43
|
+
@charge = {}
|
42
44
|
when 'tagSet'
|
43
45
|
@reserved_instance['tagSet'][@tag['key']] = @tag['value']
|
44
46
|
@tag = {}
|
45
47
|
end
|
48
|
+
when 'amount'
|
49
|
+
case @context.last
|
50
|
+
when 'reservedInstancesSet'
|
51
|
+
@reserved_instance[name] = value.to_f
|
52
|
+
when 'recurringCharges'
|
53
|
+
@charge[name] = value.to_f
|
54
|
+
end
|
55
|
+
when 'frequency'
|
56
|
+
@charge[name] = value
|
46
57
|
when 'key', 'value'
|
47
58
|
@tag[name] = value
|
48
59
|
when 'requestId'
|
@@ -72,11 +72,9 @@ module Fog
|
|
72
72
|
end
|
73
73
|
|
74
74
|
if tags = options.delete('Tags')
|
75
|
-
|
76
|
-
options["Tags.member.#{i+1}.Key"] = key.to_s # turns symbol into string
|
77
|
-
options["Tags.member.#{i+1}.Value"] = value
|
78
|
-
end
|
75
|
+
options.merge!(AWS.indexed_param("Tags.member.%d", [*tags]))
|
79
76
|
end
|
77
|
+
|
80
78
|
if termination_policies = options.delete('TerminationPolicies')
|
81
79
|
options.merge!(AWS.indexed_param('TerminationPolicies.member.%d', [*termination_policies]))
|
82
80
|
end
|
@@ -20,11 +20,15 @@ module Fog
|
|
20
20
|
# * 'instanceType'<~String> - type of instance
|
21
21
|
# * 'instanceCount'<~Integer> - number of reserved instances
|
22
22
|
# * 'productDescription'<~String> - reserved instance description
|
23
|
+
# * 'recurringCharges'<~Array>:
|
24
|
+
# * 'frequency'<~String> - frequency of a recurring charge while the reservation is active (only Hourly at this time)
|
25
|
+
# * 'amount'<~Float> - recurring charge amount
|
23
26
|
# * 'reservedInstancesId'<~String> - id of the instance
|
27
|
+
# * 'scope'<~String> - scope of the reservation (i.e. 'Availability Zone' or 'Region' - as of version 2016/11/15)
|
24
28
|
# * 'start'<~Time> - start time for reservation
|
25
29
|
# * 'state'<~String> - state of reserved instance purchase, in .[pending-payment, active, payment-failed, retired]
|
26
30
|
# * 'usagePrice"<~Float> - usage price of reserved instances, per hour
|
27
|
-
# * 'end' - time reservation stopped being applied (i.e sold or canceled - as of version 2013/10/01)
|
31
|
+
# * 'end'<~Time> - time reservation stopped being applied (i.e. sold or canceled - as of version 2013/10/01)
|
28
32
|
#
|
29
33
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstances.html]
|
30
34
|
def describe_reserved_instances(filters = {})
|
@@ -27,6 +27,25 @@ module Fog
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def add_role_to_instance_profile(role_name, instance_profile_name)
|
33
|
+
response = Excon::Response.new
|
34
|
+
|
35
|
+
unless profile = self.data[:instance_profiles][instance_profile_name]
|
36
|
+
raise Fog::AWS::IAM::NotFound.new("Instance Profile #{instance_profile_name} cannot be found.")
|
37
|
+
end
|
38
|
+
|
39
|
+
unless role = self.data[:roles][role_name]
|
40
|
+
raise Fog::AWS::IAM::NotFound.new("Role #{role_name} cannot be found.")
|
41
|
+
end
|
42
|
+
|
43
|
+
profile["Roles"] << role_name
|
44
|
+
|
45
|
+
response.body = {"RequestId" => Fog::AWS::Mock.request_id}
|
46
|
+
response
|
47
|
+
end
|
48
|
+
end
|
30
49
|
end
|
31
50
|
end
|
32
51
|
end
|
@@ -20,13 +20,39 @@ module Fog
|
|
20
20
|
#
|
21
21
|
def attach_role_policy(role_name, policy_arn)
|
22
22
|
request(
|
23
|
-
'Action'
|
24
|
-
'RoleName'
|
25
|
-
'PolicyArn'
|
26
|
-
:parser
|
23
|
+
'Action' => 'AttachRolePolicy',
|
24
|
+
'RoleName' => role_name,
|
25
|
+
'PolicyArn' => policy_arn,
|
26
|
+
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
27
27
|
)
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def attach_role_policy(role_name, policy_arn)
|
33
|
+
response = Excon::Response.new
|
34
|
+
if policy_arn.nil?
|
35
|
+
raise Fog::AWS::IAM::ValidationError, "1 validation error detected: Value null at 'policyArn' failed to satisfy constraint: Member must not be null"
|
36
|
+
end
|
37
|
+
|
38
|
+
managed_policy = self.data[:managed_policies][policy_arn]
|
39
|
+
|
40
|
+
unless managed_policy
|
41
|
+
raise Fog::AWS::IAM::NotFound, "Policy #{policy_arn} does not exist."
|
42
|
+
end
|
43
|
+
|
44
|
+
unless self.data[:roles][role_name]
|
45
|
+
raise Fog::AWS::IAM::NotFound.new("The role with name #{role_name} cannot be found.")
|
46
|
+
end
|
47
|
+
|
48
|
+
role = self.data[:roles][role_name]
|
49
|
+
role[:attached_policies] ||= []
|
50
|
+
role[:attached_policies] << managed_policy['Arn']
|
51
|
+
managed_policy['AttachmentCount'] += 1
|
52
|
+
response.body = {"RequestId" => Fog::AWS::Mock.request_id}
|
53
|
+
response
|
54
|
+
end
|
55
|
+
end
|
30
56
|
end
|
31
57
|
end
|
32
58
|
end
|
@@ -40,6 +40,26 @@ module Fog
|
|
40
40
|
}.merge!(options))
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
class Mock
|
45
|
+
def create_instance_profile(instance_profile_name, path='/', options={})
|
46
|
+
response = Excon::Response.new
|
47
|
+
|
48
|
+
profile = {
|
49
|
+
"Arn" => "arn:aws:iam::#{Fog::AWS::Mock.owner_id}:instance-profile#{path}#{instance_profile_name}",
|
50
|
+
"CreateDate" => Time.now.utc,
|
51
|
+
"InstanceProfileId" => Fog::Mock.random_hex(21),
|
52
|
+
"InstanceProfileName" => instance_profile_name,
|
53
|
+
"Path" => path,
|
54
|
+
"Roles" => [],
|
55
|
+
}
|
56
|
+
|
57
|
+
self.data[:instance_profiles][instance_profile_name] = profile
|
58
|
+
|
59
|
+
response.body = {"InstanceProfile" => profile, "RequestId" => Fog::AWS::Mock.request_id}
|
60
|
+
response
|
61
|
+
end
|
62
|
+
end
|
43
63
|
end
|
44
64
|
end
|
45
65
|
end
|
@@ -35,13 +35,37 @@ module Fog
|
|
35
35
|
'PolicyName' => policy_name,
|
36
36
|
'PolicyDocument' => Fog::JSON.encode(policy_document),
|
37
37
|
'Path' => path,
|
38
|
-
'Description' => description,
|
38
|
+
'Description' => description,
|
39
39
|
:parser => Fog::Parsers::AWS::IAM::SinglePolicy.new
|
40
40
|
}.reject {|_, value| value.nil?})
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
class Mock
|
45
|
+
def create_policy(policy_name, policy_document, path="/", description=nil)
|
46
|
+
response = Excon::Response.new
|
47
|
+
|
48
|
+
arn = "arn:aws:iam:#{Fog::AWS::Mock.owner_id}:policy/#{policy_name}"
|
49
|
+
|
50
|
+
policy = {
|
51
|
+
"Arn" => arn,
|
52
|
+
"AttachmentCount" => 0,
|
53
|
+
"CreateDate" => Time.now.utc,
|
54
|
+
"DefaultVersionId" => "v1",
|
55
|
+
"Description" => description,
|
56
|
+
"IsAttachable" => true,
|
57
|
+
"Path" => path,
|
58
|
+
"PolicyId" => Fog::Mock.random_hex(21),
|
59
|
+
"PolicyName" => policy_name,
|
60
|
+
"UpdateDate" => Time.now.utc,
|
61
|
+
}
|
62
|
+
|
63
|
+
self.data[:managed_policies][arn] = policy
|
64
|
+
|
65
|
+
response.body = {"RequestId" => Fog::AWS::Mock.request_id, "Policy" => policy}
|
66
|
+
response
|
67
|
+
end
|
68
|
+
end
|
45
69
|
end
|
46
70
|
end
|
47
71
|
end
|
@@ -25,6 +25,21 @@ module Fog
|
|
25
25
|
)
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
class Mock
|
30
|
+
def delete_instance_profile(instance_profile_name)
|
31
|
+
response = Excon::Response.new
|
32
|
+
|
33
|
+
unless profile = self.data[:instance_profiles][instance_profile_name]
|
34
|
+
raise Fog::AWS::IAM::NotFound.new("Instance Profile #{instance_profile_name} cannot be found.")
|
35
|
+
end
|
36
|
+
|
37
|
+
self.data[:instance_profiles].delete(instance_profile_name)
|
38
|
+
|
39
|
+
response.body = {"RequestId" => Fog::AWS::Mock.request_id}
|
40
|
+
response
|
41
|
+
end
|
42
|
+
end
|
28
43
|
end
|
29
44
|
end
|
30
45
|
end
|
@@ -25,6 +25,21 @@ module Fog
|
|
25
25
|
)
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
class Mock
|
30
|
+
def delete_policy(policy_arn)
|
31
|
+
response = Excon::Response.new
|
32
|
+
policy = self.data[:managed_policies][policy_arn]
|
33
|
+
|
34
|
+
if policy.nil?
|
35
|
+
raise Fog::AWS::IAM::NotFound.new("Policy #{policy_arn} does not exist or is not attachable.")
|
36
|
+
end
|
37
|
+
|
38
|
+
self.data[:managed_policies].delete(policy_arn)
|
39
|
+
response.body = {"RequestId" => Fog::AWS::Mock.request_id}
|
40
|
+
response
|
41
|
+
end
|
42
|
+
end
|
28
43
|
end
|
29
44
|
end
|
30
45
|
end
|
@@ -27,6 +27,33 @@ module Fog
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def detach_role_policy(role_name, policy_arn)
|
33
|
+
response = Excon::Response.new
|
34
|
+
|
35
|
+
if policy_arn.nil?
|
36
|
+
raise Fog::AWS::IAM::ValidationError, "1 validation error detected: Value null at 'policyArn' failed to satisfy constraint: Member must not be null"
|
37
|
+
end
|
38
|
+
|
39
|
+
managed_policy = self.data[:managed_policies][policy_arn]
|
40
|
+
|
41
|
+
unless managed_policy
|
42
|
+
raise Fog::AWS::IAM::NotFound, "Policy #{policy_arn} does not exist."
|
43
|
+
end
|
44
|
+
|
45
|
+
unless self.data[:roles].key?(role_name)
|
46
|
+
raise Fog::AWS::IAM::NotFound.new("The role with name #{role_name} cannot be found.")
|
47
|
+
end
|
48
|
+
|
49
|
+
role = self.data[:roles][role_name]
|
50
|
+
role[:attached_policies].delete(policy_arn)
|
51
|
+
managed_policy["AttachmentCount"] -= 1
|
52
|
+
|
53
|
+
response.body = {"RequestId" => Fog::AWS::Mock.request_id}
|
54
|
+
response
|
55
|
+
end
|
56
|
+
end
|
30
57
|
end
|
31
58
|
end
|
32
59
|
end
|
@@ -35,6 +35,23 @@ module Fog
|
|
35
35
|
})
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
class Mock
|
40
|
+
def get_instance_profile(instance_profile_name)
|
41
|
+
response = Excon::Response.new
|
42
|
+
|
43
|
+
instance_profile = self.data[:instance_profiles][instance_profile_name]
|
44
|
+
unless instance_profile
|
45
|
+
raise Fog::AWS::IAM::NotFound.new("Instance Profile #{instance_profile_name} cannot be found.")
|
46
|
+
end
|
47
|
+
|
48
|
+
instance_profile = instance_profile.dup
|
49
|
+
instance_profile["Roles"].map! { |r| self.data[:roles][r] }
|
50
|
+
|
51
|
+
response.body = {"InstanceProfile" => instance_profile, "RequestId" => Fog::AWS::Mock.request_id}
|
52
|
+
response
|
53
|
+
end
|
54
|
+
end
|
38
55
|
end
|
39
56
|
end
|
40
57
|
end
|
@@ -43,6 +43,15 @@ module Fog
|
|
43
43
|
}.merge!(options))
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
class Mock
|
48
|
+
def list_instance_profiles(options={})
|
49
|
+
response = Excon::Response.new
|
50
|
+
profiles = self.data[:instance_profiles].values
|
51
|
+
response.body = { "InstanceProfiles" => profiles, "IsTruncated" => false, "RequestId" => Fog::AWS::Mock.request_id }
|
52
|
+
response
|
53
|
+
end
|
54
|
+
end
|
46
55
|
end
|
47
56
|
end
|
48
57
|
end
|
@@ -44,6 +44,16 @@ module Fog
|
|
44
44
|
}.merge!(options))
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
class Mock
|
49
|
+
def list_instance_profiles_for_role(role_name, options={})
|
50
|
+
response = Excon::Response.new
|
51
|
+
|
52
|
+
profiles = self.data[:instance_profiles].values.select { |p| p["Roles"].include?(role_name) }
|
53
|
+
response.body = { "InstanceProfiles" => profiles, "IsTruncated" => false, "RequestId" => Fog::AWS::Mock.request_id }
|
54
|
+
response
|
55
|
+
end
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
49
59
|
end
|
@@ -64,6 +64,10 @@ module Fog
|
|
64
64
|
self.data[:managed_policies].values
|
65
65
|
end
|
66
66
|
|
67
|
+
if options["PathPrefix"]
|
68
|
+
data_set = data_set.select { |p| p["Path"].match(/^#{options["PathPrefix"]}/) }
|
69
|
+
end
|
70
|
+
|
67
71
|
data = data_set.slice!(0, limit || 100)
|
68
72
|
truncated = data_set.size > 0
|
69
73
|
marker = truncated && Base64.encode64("metadata/l/#{account_id}/#{UUID.uuid}")
|
@@ -28,6 +28,25 @@ module Fog
|
|
28
28
|
)
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
class Mock
|
33
|
+
def remove_role_from_instance_profile(role_name, instance_profile_name)
|
34
|
+
response = Excon::Response.new
|
35
|
+
|
36
|
+
unless profile = self.data[:instance_profiles][instance_profile_name]
|
37
|
+
raise Fog::AWS::IAM::NotFound.new("Instance Profile #{instance_profile_name} cannot be found.")
|
38
|
+
end
|
39
|
+
|
40
|
+
unless role = self.data[:roles][role_name]
|
41
|
+
raise Fog::AWS::IAM::NotFound.new("Role #{role_name} cannot be found.")
|
42
|
+
end
|
43
|
+
|
44
|
+
profile["Roles"].delete(role_name)
|
45
|
+
|
46
|
+
response.body = {"RequestId" => Fog::AWS::Mock.request_id}
|
47
|
+
response
|
48
|
+
end
|
49
|
+
end
|
31
50
|
end
|
32
51
|
end
|
33
52
|
end
|
data/lib/fog/aws/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
Shindo.tests("Fog::AWS[:iam] | instance_profiles", ['aws', 'iam']) do
|
2
|
+
model_tests(Fog::AWS[:iam].instance_profiles, {:name => uniq_id('fog-instance-profile')}) do
|
3
|
+
@role = Fog::AWS[:iam].roles.create(:rolename => uniq_id('fog-role'))
|
4
|
+
|
5
|
+
tests("#add_role('#{@role.rolename}')") do
|
6
|
+
returns(true) { @instance.add_role(@role.rolename) }
|
7
|
+
end
|
8
|
+
|
9
|
+
returns(1) { @role.instance_profiles.count }
|
10
|
+
returns(@instance) { @role.instance_profiles.first }
|
11
|
+
|
12
|
+
tests("#remove_role('#{@role.rolename}')") do
|
13
|
+
returns(true) { @instance.remove_role(@role.rolename) }
|
14
|
+
end
|
15
|
+
|
16
|
+
@role.destroy
|
17
|
+
end
|
18
|
+
end
|
@@ -22,7 +22,7 @@ Shindo.tests("Fog::Compute[:iam] | managed_policies", ['aws','iam']) do
|
|
22
22
|
"Statement" => [
|
23
23
|
{
|
24
24
|
"Effect" => "Allow",
|
25
|
-
"Action" => [ "iam:GenerateCredentialReport", "iam:Get*", "iam:List*" ],
|
25
|
+
"Action" => [ "iam:GenerateCredentialReport", "iam:GenerateServiceLastAccessedDetails", "iam:Get*", "iam:List*" ],
|
26
26
|
"Resource" => "*"
|
27
27
|
}
|
28
28
|
]
|
@@ -38,6 +38,8 @@ Shindo.tests("Fog::Compute[:iam] | managed_policies", ['aws','iam']) do
|
|
38
38
|
user.attached_policies.map(&:identity) == [policy.identity]
|
39
39
|
end
|
40
40
|
|
41
|
+
returns(1) { policy.reload.attachments}
|
42
|
+
|
41
43
|
tests("#detach").succeeds do
|
42
44
|
user.detach(policy)
|
43
45
|
|
@@ -56,6 +58,8 @@ Shindo.tests("Fog::Compute[:iam] | managed_policies", ['aws','iam']) do
|
|
56
58
|
group.attached_policies.map(&:identity) == [policy.identity]
|
57
59
|
end
|
58
60
|
|
61
|
+
returns(1) { policy.reload.attachments}
|
62
|
+
|
59
63
|
tests("#detach").succeeds do
|
60
64
|
group.detach(policy)
|
61
65
|
|
@@ -64,4 +68,22 @@ Shindo.tests("Fog::Compute[:iam] | managed_policies", ['aws','iam']) do
|
|
64
68
|
|
65
69
|
group.destroy
|
66
70
|
end
|
71
|
+
|
72
|
+
tests("roles") do
|
73
|
+
role = iam.roles.create(:rolename => uniq_id("fog-test-role"))
|
74
|
+
|
75
|
+
tests("#attach").succeeds do
|
76
|
+
role.attach(policy)
|
77
|
+
role.attached_policies.map(&:identity) == [policy.identity]
|
78
|
+
end
|
79
|
+
|
80
|
+
returns(1) { policy.reload.attachments}
|
81
|
+
|
82
|
+
tests("#detach").succeeds do
|
83
|
+
role.detach(policy)
|
84
|
+
role.attached_policies.map(&:identity) == []
|
85
|
+
end
|
86
|
+
|
87
|
+
role.destroy
|
88
|
+
end
|
67
89
|
end
|
@@ -27,31 +27,33 @@ Shindo.tests('AWS::AutoScaling | auto_scaling_tests', ['aws', 'auto_scaling']) d
|
|
27
27
|
Fog::AWS[:auto_scaling].create_auto_scaling_group(@asg_name, zones, @lc_name, max_size, min_size).body
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
if Fog.mocking?
|
31
|
+
tests("#attach_load_balancers").formats(AWS::AutoScaling::Formats::BASIC) do
|
32
|
+
Fog::AWS[:auto_scaling].attach_load_balancers(@asg_name, 'LoadBalancerNames' => 'elb-test-fog').body
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
tests("#detach_load_balancers").formats(AWS::AutoScaling::Formats::BASIC) do
|
36
|
+
Fog::AWS[:auto_scaling].detach_load_balancers(@asg_name, 'LoadBalancerNames' => 'elb-test-fog').body
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
tests("#attach_load_balancer_target_groups").formats(AWS::AutoScaling::Formats::BASIC) do
|
40
|
+
Fog::AWS[:auto_scaling].attach_load_balancer_target_groups(@asg_name, 'TargetGroupARNs' => 'elb-test-fog').body
|
41
|
+
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
tests("#detach_load_balancer_target_groups").formats(AWS::AutoScaling::Formats::BASIC) do
|
44
|
+
Fog::AWS[:auto_scaling].detach_load_balancer_target_groups(@asg_name, 'TargetGroupARNs' => 'elb-test-fog').body
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
tests("#detach_instances").formats(AWS::AutoScaling::Formats::BASIC) do
|
48
|
+
Fog::AWS[:auto_scaling].detach_instances(@asg_name, 'InstanceIds' => 'i-deadbeef').body
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
tests("#attach_instances").formats(AWS::AutoScaling::Formats::BASIC) do
|
52
|
+
Fog::AWS[:auto_scaling].attach_instances(@asg_name, 'InstanceIds' => 'i-deadbeef').body
|
53
|
+
end
|
52
54
|
end
|
53
55
|
|
54
|
-
|
56
|
+
tests("#describe_auto_scaling_groups").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do
|
55
57
|
Fog::AWS[:auto_scaling].describe_auto_scaling_groups().body
|
56
58
|
end
|
57
59
|
tests("#describe_auto_scaling_groups").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do
|
@@ -60,7 +60,9 @@ Shindo.tests('AWS::AutoScaling | model_tests', ['aws', 'auto_scaling']) do
|
|
60
60
|
|
61
61
|
tests('suspend processes') do
|
62
62
|
asg.suspend_processes()
|
63
|
-
|
63
|
+
if Fog.mocking?
|
64
|
+
tests('processes suspended').returns([]) { asg.suspended_processes }
|
65
|
+
end
|
64
66
|
end
|
65
67
|
|
66
68
|
tests('resume processes') do
|
@@ -23,8 +23,8 @@ Shindo.tests('AWS::AutoScaling | tag requests', ['aws', 'auto_scaling']) do
|
|
23
23
|
'Value' => asg_name
|
24
24
|
}
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
Fog::AWS[:auto_scaling].create_launch_configuration(image_id[Fog::AWS[:auto_scaling].region], 't1.micro', lc_name)
|
27
|
+
Fog::AWS[:auto_scaling].create_auto_scaling_group(asg_name, "#{Fog::AWS[:auto_scaling].region}a", lc_name, 0, 0, 'Tags' => [asg_tag])
|
28
28
|
|
29
29
|
tests('raises') do
|
30
30
|
tests("#create_or_update_tags(empty)").raises(Fog::AWS::AutoScaling::ValidationError) do
|
@@ -131,6 +131,24 @@ Xb9WSr07saxZQbxBPQyTlb0Q9Tu2djAq2/o/nYD1/50/fXUTuWMB
|
|
131
131
|
}],
|
132
132
|
'IsTruncated' => Fog::Boolean
|
133
133
|
)
|
134
|
+
|
135
|
+
INSTANCE_PROFILE = {
|
136
|
+
'Arn' => String,
|
137
|
+
'CreateDate' => Time,
|
138
|
+
'InstanceProfileId' => String,
|
139
|
+
'InstanceProfileName' => String,
|
140
|
+
'Path' => String,
|
141
|
+
'Roles' => Array
|
142
|
+
}
|
143
|
+
|
144
|
+
INSTANCE_PROFILE_RESULT = BASIC.merge(
|
145
|
+
'InstanceProfile' => INSTANCE_PROFILE
|
146
|
+
)
|
147
|
+
|
148
|
+
LIST_INSTANCE_PROFILE_RESULT = BASIC.merge(
|
149
|
+
"IsTruncated" => Fog::Boolean,
|
150
|
+
"InstanceProfiles" => [INSTANCE_PROFILE]
|
151
|
+
)
|
134
152
|
end
|
135
153
|
end
|
136
154
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
include AWS::IAM::Formats
|
2
|
+
|
3
|
+
Shindo.tests("AWS::IAM | instance profile requests", ['aws']) do
|
4
|
+
tests('success') do
|
5
|
+
profile_name = uniq_id('fog-instance-profile')
|
6
|
+
@instance_profile_count = Fog::AWS[:iam].list_instance_profiles.body["InstanceProfiles"].count
|
7
|
+
|
8
|
+
tests("#create_instance_profile('#{profile_name}')").formats(INSTANCE_PROFILE_RESULT) do
|
9
|
+
Fog::AWS[:iam].create_instance_profile(profile_name).body
|
10
|
+
end
|
11
|
+
|
12
|
+
tests("#list_instance_profiles").formats(LIST_INSTANCE_PROFILE_RESULT) do
|
13
|
+
body = Fog::AWS[:iam].list_instance_profiles.body
|
14
|
+
returns(@instance_profile_count + 1) { body["InstanceProfiles"].count }
|
15
|
+
body
|
16
|
+
end
|
17
|
+
|
18
|
+
tests("#get_instance_profile('#{profile_name}')").formats(INSTANCE_PROFILE_RESULT) do
|
19
|
+
Fog::AWS[:iam].get_instance_profile(profile_name).body
|
20
|
+
end
|
21
|
+
|
22
|
+
@role = Fog::AWS[:iam].roles.create(:rolename => uniq_id('instance-profile-role'))
|
23
|
+
|
24
|
+
tests("#add_role_to_instance_profile('#{@role.rolename}', '#{profile_name}')").formats(BASIC) do
|
25
|
+
Fog::AWS[:iam].add_role_to_instance_profile(@role.rolename, profile_name).body
|
26
|
+
end
|
27
|
+
|
28
|
+
tests("#list_instance_profiles_for_role('#{@role.rolename}')").formats(LIST_INSTANCE_PROFILE_RESULT) do
|
29
|
+
body = Fog::AWS[:iam].list_instance_profiles_for_role(@role.rolename).body
|
30
|
+
returns(1) { body["InstanceProfiles"].count }
|
31
|
+
body
|
32
|
+
end
|
33
|
+
|
34
|
+
tests("#remove_role_from_instance_profile('#{@role.rolename}', '#{profile_name}')").formats(BASIC) do
|
35
|
+
Fog::AWS[:iam].remove_role_from_instance_profile(@role.rolename, profile_name).body
|
36
|
+
end
|
37
|
+
|
38
|
+
@role.destroy
|
39
|
+
|
40
|
+
tests("#delete_instance_profile('#{profile_name}')").formats(BASIC) do
|
41
|
+
Fog::AWS[:iam].delete_instance_profile(profile_name).body
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
2
2
|
|
3
|
-
pending if Fog.mocking?
|
4
3
|
Fog::AWS[:iam].create_group('fog_policy_test_group')
|
5
4
|
Fog::AWS[:iam].create_user('fog_policy_test_user')
|
6
5
|
Fog::AWS[:iam].create_role('fog_policy_test_role', Fog::AWS::IAM::EC2_ASSUME_ROLE_POLICY)
|
@@ -8,16 +7,16 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
8
7
|
tests('success') do
|
9
8
|
@policy = {'Version' => '2012-10-17', "Statement" => [{"Effect" => "Deny", "Action" => "*", "Resource" => "*"}]}
|
10
9
|
@policy_format = {
|
11
|
-
'Arn'
|
12
|
-
'AttachmentCount'
|
13
|
-
'Description'
|
10
|
+
'Arn' => String,
|
11
|
+
'AttachmentCount' => Integer,
|
12
|
+
'Description' => Fog::Nullable::String,
|
14
13
|
'DefaultVersionId' => String,
|
15
|
-
'IsAttachable'
|
16
|
-
'Path'
|
17
|
-
'PolicyId'
|
18
|
-
'PolicyName'
|
19
|
-
'CreateDate'
|
20
|
-
'UpdateDate'
|
14
|
+
'IsAttachable' => Fog::Boolean,
|
15
|
+
'Path' => String,
|
16
|
+
'PolicyId' => String,
|
17
|
+
'PolicyName' => String,
|
18
|
+
'CreateDate' => Time,
|
19
|
+
'UpdateDate' => Time
|
21
20
|
}
|
22
21
|
|
23
22
|
create_policy_format = {
|
@@ -28,8 +27,8 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
28
27
|
list_policies_format = {
|
29
28
|
'RequestId' => String,
|
30
29
|
'Policies' => [@policy_format],
|
31
|
-
'Marker' => String,
|
32
|
-
'IsTruncated' => Fog::Boolean
|
30
|
+
'Marker' => Fog::Nullable::String,
|
31
|
+
'IsTruncated' => Fog::Boolean
|
33
32
|
}
|
34
33
|
|
35
34
|
attached_policy_format = {
|
@@ -39,7 +38,7 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
39
38
|
|
40
39
|
list_managed_policies_format = {
|
41
40
|
'RequestId' => String,
|
42
|
-
'
|
41
|
+
'Policies' => [attached_policy_format]
|
43
42
|
}
|
44
43
|
|
45
44
|
tests("#create_policy('fog_policy')").formats(create_policy_format) do
|
@@ -74,7 +73,7 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
74
73
|
Fog::AWS[:iam].attach_group_policy('fog_policy_test_group', @policy_arn).body
|
75
74
|
end
|
76
75
|
|
77
|
-
tests("#list_attach_group_policies()").formats(
|
76
|
+
tests("#list_attach_group_policies()").formats(list_managed_policies_format) do
|
78
77
|
Fog::AWS[:iam].list_attached_group_policies('fog_policy_test_group').body
|
79
78
|
end
|
80
79
|
|
@@ -83,11 +82,11 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
83
82
|
end
|
84
83
|
|
85
84
|
tests("#attach_role_policy()").formats(AWS::IAM::Formats::BASIC) do
|
86
|
-
Fog::AWS[:iam].attach_role_policy('fog_policy_test_role', @policy_arn).body
|
85
|
+
body = Fog::AWS[:iam].attach_role_policy('fog_policy_test_role', @policy_arn).body
|
87
86
|
end
|
88
87
|
|
89
|
-
tests("#
|
90
|
-
Fog::AWS[:iam].
|
88
|
+
tests("#list_attached_role_policies()").formats(list_managed_policies_format) do
|
89
|
+
Fog::AWS[:iam].list_attached_role_policies('fog_policy_test_role').body
|
91
90
|
end
|
92
91
|
|
93
92
|
tests("#detach_role_policy()").formats(AWS::IAM::Formats::BASIC) do
|
@@ -97,7 +96,7 @@ Shindo.tests('AWS::IAM | managed policy requests', ['aws']) do
|
|
97
96
|
tests("#delete_policy()").formats(AWS::IAM::Formats::BASIC) do
|
98
97
|
Fog::AWS[:iam].delete_policy(@policy_arn).body
|
99
98
|
end
|
100
|
-
|
99
|
+
|
101
100
|
end
|
102
101
|
|
103
102
|
tests('failure') do
|
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: 1.
|
4
|
+
version: 1.2.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:
|
12
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- gemfiles/Gemfile-edge
|
147
147
|
- gemfiles/Gemfile-ruby-1.8.7
|
148
148
|
- gemfiles/Gemfile-ruby-1.9
|
149
|
+
- gemfiles/Gemfile-ruby-2.0
|
149
150
|
- lib/fog/aws.rb
|
150
151
|
- lib/fog/aws/auto_scaling.rb
|
151
152
|
- lib/fog/aws/beanstalk.rb
|
@@ -283,6 +284,8 @@ files:
|
|
283
284
|
- lib/fog/aws/models/iam/access_keys.rb
|
284
285
|
- lib/fog/aws/models/iam/group.rb
|
285
286
|
- lib/fog/aws/models/iam/groups.rb
|
287
|
+
- lib/fog/aws/models/iam/instance_profile.rb
|
288
|
+
- lib/fog/aws/models/iam/instance_profiles.rb
|
286
289
|
- lib/fog/aws/models/iam/managed_policies.rb
|
287
290
|
- lib/fog/aws/models/iam/managed_policy.rb
|
288
291
|
- lib/fog/aws/models/iam/policies.rb
|
@@ -1488,6 +1491,7 @@ files:
|
|
1488
1491
|
- tests/models/glacier/model_tests.rb
|
1489
1492
|
- tests/models/iam/access_keys_tests.rb
|
1490
1493
|
- tests/models/iam/groups_tests.rb
|
1494
|
+
- tests/models/iam/instance_profile_tests.rb
|
1491
1495
|
- tests/models/iam/managed_policies_tests.rb
|
1492
1496
|
- tests/models/iam/policies_tests.rb
|
1493
1497
|
- tests/models/iam/roles_tests.rb
|
@@ -1597,6 +1601,7 @@ files:
|
|
1597
1601
|
- tests/requests/iam/group_policy_tests.rb
|
1598
1602
|
- tests/requests/iam/group_tests.rb
|
1599
1603
|
- tests/requests/iam/helper.rb
|
1604
|
+
- tests/requests/iam/instance_profile_tests.rb
|
1600
1605
|
- tests/requests/iam/login_profile_tests.rb
|
1601
1606
|
- tests/requests/iam/managed_policy_tests.rb
|
1602
1607
|
- tests/requests/iam/mfa_tests.rb
|