SSMContacts / Client / put_contact_policy

put_contact_policy#

SSMContacts.Client.put_contact_policy(**kwargs)#

Adds a resource policy to the specified contact or escalation plan. The resource policy is used to share the contact or escalation plan using Resource Access Manager (RAM). For more information about cross-account sharing, see Setting up cross-account functionality.

See also: AWS API Documentation

Request Syntax

response = client.put_contact_policy(
    ContactArn='string',
    Policy='string'
)
Parameters:
  • ContactArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the contact or escalation plan.

  • Policy (string) –

    [REQUIRED]

    Details of the resource policy.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • SSMContacts.Client.exceptions.AccessDeniedException

  • SSMContacts.Client.exceptions.ConflictException

  • SSMContacts.Client.exceptions.ValidationException

  • SSMContacts.Client.exceptions.ResourceNotFoundException

  • SSMContacts.Client.exceptions.ThrottlingException

  • SSMContacts.Client.exceptions.InternalServerException

Examples

The following put-contact-policy example adds a resource policy to the contact Akua that shares the contact and related engagements with the principal.

response = client.put_contact_policy(
    ContactArn='arn:aws:ssm-contacts:us-east-1:111122223333:contact/akuam',
    Policy='{"Version":"2012-10-17","Statement":[{"Sid":"ExampleResourcePolicy","Action":["ssm-contacts:GetContact","ssm-contacts:StartEngagement","ssm-contacts:DescribeEngagement","ssm-contacts:ListPagesByEngagement","ssm-contacts:StopEngagement"],"Principal":{"AWS":"222233334444"},"Effect":"Allow","Resource":["arn:aws:ssm-contacts:*:111122223333:contact/akuam","arn:aws:ssm-contacts:*:111122223333:engagement/akuam/*"]}]}',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}