Updates for IAM changes.

This commit is contained in:
Steve Pulec 2014-12-06 19:37:10 -05:00
parent 7b81a0cb95
commit 20dda251f8

View File

@ -19,13 +19,20 @@ class Role(object):
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
properties = cloudformation_json['Properties']
return iam_backend.create_role(
role = iam_backend.create_role(
role_name=resource_name,
assume_role_policy_document=properties['AssumeRolePolicyDocument'],
path=properties['Path'],
policies=properties.get('Policies', []),
)
policies = properties.get('Policies', [])
for policy in policies:
policy_name = policy['PolicyName']
policy_json = policy['PolicyDocument']
role.put_policy(policy_name, policy_json)
return role
def put_policy(self, policy_name, policy_json):
self.policies[policy_name] = policy_json