CodeStarNotifications / Client / create_notification_rule

create_notification_rule#

CodeStarNotifications.Client.create_notification_rule(**kwargs)#

Creates a notification rule for a resource. The rule specifies the events you want notifications about and the targets (such as Chatbot topics or Chatbot clients configured for Slack) where you want to receive them.

See also: AWS API Documentation

Request Syntax

response = client.create_notification_rule(
    Name='string',
    EventTypeIds=[
        'string',
    ],
    Resource='string',
    Targets=[
        {
            'TargetType': 'string',
            'TargetAddress': 'string'
        },
    ],
    DetailType='BASIC'|'FULL',
    ClientRequestToken='string',
    Tags={
        'string': 'string'
    },
    Status='ENABLED'|'DISABLED'
)
Parameters:
  • Name (string) –

    [REQUIRED]

    The name for the notification rule. Notification rule names must be unique in your Amazon Web Services account.

  • EventTypeIds (list) –

    [REQUIRED]

    A list of event types associated with this notification rule. For a list of allowed events, see EventTypeSummary.

    • (string) –

  • Resource (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the resource to associate with the notification rule. Supported resources include pipelines in CodePipeline, repositories in CodeCommit, and build projects in CodeBuild.

  • Targets (list) –

    [REQUIRED]

    A list of Amazon Resource Names (ARNs) of Amazon Simple Notification Service topics and Chatbot clients to associate with the notification rule.

    • (dict) –

      Information about the Chatbot topics or Chatbot clients associated with a notification rule.

      • TargetType (string) –

        The target type. Can be an Chatbot topic or Chatbot client.

        • Chatbot topics are specified as SNS.

        • Chatbot clients are specified as AWSChatbotSlack.

      • TargetAddress (string) –

        The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.

  • DetailType (string) –

    [REQUIRED]

    The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in Amazon CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.

  • ClientRequestToken (string) –

    A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be repeated with a changed parameter. If a request with the same parameters is received and a token is included, the request returns information about the initial request that used that token.

    Note

    The Amazon Web Services SDKs prepopulate client request tokens. If you are using an Amazon Web Services SDK, an idempotency token is created for you.

    This field is autopopulated if not provided.

  • Tags (dict) –

    A list of tags to apply to this notification rule. Key names cannot start with “ aws”.

    • (string) –

      • (string) –

  • Status (string) – The status of the notification rule. The default value is ENABLED. If the status is set to DISABLED, notifications aren’t sent for the notification rule.

Return type:

dict

Returns:

Response Syntax

{
    'Arn': 'string'
}

Response Structure

  • (dict) –

    • Arn (string) –

      The Amazon Resource Name (ARN) of the notification rule.

Exceptions

  • CodeStarNotifications.Client.exceptions.ResourceAlreadyExistsException

  • CodeStarNotifications.Client.exceptions.ValidationException

  • CodeStarNotifications.Client.exceptions.LimitExceededException

  • CodeStarNotifications.Client.exceptions.ConfigurationException

  • CodeStarNotifications.Client.exceptions.ConcurrentModificationException

  • CodeStarNotifications.Client.exceptions.AccessDeniedException