Add get_policy IAM action
This commit is contained in:
parent
ba9e795394
commit
9e667d6b25
3 changed files with 45 additions and 17 deletions
|
|
@ -58,6 +58,12 @@ class IamResponse(BaseResponse):
|
|||
template = self.response_template(CREATE_POLICY_TEMPLATE)
|
||||
return template.render(policy=policy)
|
||||
|
||||
def get_policy(self):
|
||||
policy_arn = self._get_param('PolicyArn')
|
||||
policy = iam_backend.get_policy(policy_arn)
|
||||
template = self.response_template(GET_POLICY_TEMPLATE)
|
||||
return template.render(policy=policy)
|
||||
|
||||
def list_attached_role_policies(self):
|
||||
marker = self._get_param('Marker')
|
||||
max_items = self._get_int_param('MaxItems', 100)
|
||||
|
|
@ -601,6 +607,25 @@ CREATE_POLICY_TEMPLATE = """<CreatePolicyResponse>
|
|||
</ResponseMetadata>
|
||||
</CreatePolicyResponse>"""
|
||||
|
||||
GET_POLICY_TEMPLATE = """<GetPolicyResponse>
|
||||
<GetPolicyResult>
|
||||
<Policy>
|
||||
<PolicyName>{{ policy.name }}</PolicyName>
|
||||
<Description>{{ policy.description }}</Description>
|
||||
<DefaultVersionId>{{ policy.default_version_id }}</DefaultVersionId>
|
||||
<PolicyId>{{ policy.id }}</PolicyId>
|
||||
<Path>{{ policy.path }}</Path>
|
||||
<Arn>{{ policy.arn }}</Arn>
|
||||
<AttachmentCount>{{ policy.attachment_count }}</AttachmentCount>
|
||||
<CreateDate>{{ policy.create_datetime.isoformat() }}</CreateDate>
|
||||
<UpdateDate>{{ policy.update_datetime.isoformat() }}</UpdateDate>
|
||||
</Policy>
|
||||
</GetPolicyResult>
|
||||
<ResponseMetadata>
|
||||
<RequestId>684f0917-3d22-11e4-a4a0-cffb9EXAMPLE</RequestId>
|
||||
</ResponseMetadata>
|
||||
</GetPolicyResponse>"""
|
||||
|
||||
LIST_ATTACHED_ROLE_POLICIES_TEMPLATE = """<ListAttachedRolePoliciesResponse>
|
||||
<ListAttachedRolePoliciesResult>
|
||||
{% if marker is none %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue