:doc:`SSMContacts <../../ssm-contacts>` / Client / put_contact_policy

******************
put_contact_policy
******************



.. py:method:: 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 <https://docs.aws.amazon.com/incident-manager/latest/userguide/xa.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ssm-contacts-2021-05-03/PutContactPolicy>`_  


  **Request Syntax**
  ::

    response = client.put_contact_policy(
        ContactArn='string',
        Policy='string'
    )
    
  :type ContactArn: string
  :param ContactArn: **[REQUIRED]** 

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

    

  
  :type Policy: string
  :param Policy: **[REQUIRED]** 

    Details of the resource policy.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 
  
  **Exceptions**
  
  *   :py:class:`SSMContacts.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`SSMContacts.Client.exceptions.ConflictException`

  
  *   :py:class:`SSMContacts.Client.exceptions.ValidationException`

  
  *   :py:class:`SSMContacts.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`SSMContacts.Client.exceptions.ThrottlingException`

  
  *   :py:class:`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': {
            '...': '...',
        },
    }

  