Table of Contents
CodeStarNotifications.
Client
¶A low-level client representing AWS CodeStar Notifications
This AWS CodeStar Notifications API Reference provides descriptions and usage examples of the operations and data types for the AWS CodeStar Notifications API. You can use the AWS CodeStar Notifications API to work with the following objects:
Notification rules, by calling the following:
Targets, by calling the following:
Events, by calling the following:
Tags, by calling the following:
For information about how to use AWS CodeStar Notifications, see the Amazon Web Services Developer Tools Console User Guide.
import boto3
client = boto3.client('codestar-notifications')
These are the available methods:
can_paginate()
close()
create_notification_rule()
delete_notification_rule()
delete_target()
describe_notification_rule()
get_paginator()
get_waiter()
list_event_types()
list_notification_rules()
list_tags_for_resource()
list_targets()
subscribe()
tag_resource()
unsubscribe()
untag_resource()
update_notification_rule()
can_paginate
(operation_name)¶Check if an operation can be paginated.
create_foo
, and you'd normally invoke the
operation as client.create_foo(**kwargs)
, if the
create_foo
operation can be paginated, you can use the
call client.get_paginator("create_foo")
.True
if the operation can be paginated,
False
otherwise.close
()¶Closes underlying endpoint connections.
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'
)
[REQUIRED]
The name for the notification rule. Notification rule names must be unique in your Amazon Web Services account.
[REQUIRED]
A list of event types associated with this notification rule. For a list of allowed events, see EventTypeSummary.
[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.
[REQUIRED]
A list of Amazon Resource Names (ARNs) of Amazon Simple Notification Service topics and Chatbot clients to associate with the notification rule.
Information about the Chatbot topics or Chatbot clients associated with a notification rule.
The target type. Can be an Chatbot topic or Chatbot client.
SNS
.AWSChatbotSlack
.The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
[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.
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.
A list of tags to apply to this notification rule. Key names cannot start with " aws
".
ENABLED
. If the status is set to DISABLED
, notifications aren't sent for the notification rule.dict
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
delete_notification_rule
(**kwargs)¶Deletes a notification rule for a resource.
See also: AWS API Documentation
Request Syntax
response = client.delete_notification_rule(
Arn='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) of the notification rule you want to delete.
{
'Arn': 'string'
}
Response Structure
The Amazon Resource Name (ARN) of the deleted notification rule.
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.LimitExceededException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
delete_target
(**kwargs)¶Deletes a specified target for notifications.
See also: AWS API Documentation
Request Syntax
response = client.delete_target(
TargetAddress='string',
ForceUnsubscribeAll=True|False
)
[REQUIRED]
The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client to delete.
dict
Response Syntax
{}
Response Structure
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
describe_notification_rule
(**kwargs)¶Returns information about a specified notification rule.
See also: AWS API Documentation
Request Syntax
response = client.describe_notification_rule(
Arn='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) of the notification rule.
{
'Arn': 'string',
'Name': 'string',
'EventTypes': [
{
'EventTypeId': 'string',
'ServiceName': 'string',
'EventTypeName': 'string',
'ResourceType': 'string'
},
],
'Resource': 'string',
'Targets': [
{
'TargetAddress': 'string',
'TargetType': 'string',
'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED'
},
],
'DetailType': 'BASIC'|'FULL',
'CreatedBy': 'string',
'Status': 'ENABLED'|'DISABLED',
'CreatedTimestamp': datetime(2015, 1, 1),
'LastModifiedTimestamp': datetime(2015, 1, 1),
'Tags': {
'string': 'string'
}
}
Response Structure
The Amazon Resource Name (ARN) of the notification rule.
The name of the notification rule.
A list of the event types associated with the notification rule.
Returns information about an event that has triggered a notification rule.
The system-generated ID of the event. For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide .
The name of the service for which the event applies.
The name of the event.
The resource type of the event.
The Amazon Resource Name (ARN) of the resource associated with the notification rule.
A list of the Chatbot topics and Chatbot clients associated with the notification rule.
Information about the targets specified for a notification rule.
The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
The type of the target (for example, SNS
).
SNS
.AWSChatbotSlack
.The status of the target.
The level of detail included 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.
The name or email alias of the person who created the notification rule.
The status of the notification rule. Valid statuses are on (sending notifications) or off (not sending notifications).
The date and time the notification rule was created, in timestamp format.
The date and time the notification rule was most recently updated, in timestamp format.
The tags associated with the notification rule.
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
get_paginator
(operation_name)¶Create a paginator for an operation.
create_foo
, and you'd normally invoke the
operation as client.create_foo(**kwargs)
, if the
create_foo
operation can be paginated, you can use the
call client.get_paginator("create_foo")
.client.can_paginate
method to
check if an operation is pageable.get_waiter
(waiter_name)¶Returns an object that can wait for some condition.
list_event_types
(**kwargs)¶Returns information about the event types available for configuring notifications.
See also: AWS API Documentation
Request Syntax
response = client.list_event_types(
Filters=[
{
'Name': 'RESOURCE_TYPE'|'SERVICE_NAME',
'Value': 'string'
},
],
NextToken='string',
MaxResults=123
)
The filters to use to return information by service or resource type.
Information about a filter to apply to the list of returned event types. You can filter by resource type or service name.
The system-generated name of the filter type you want to filter by.
The name of the resource type (for example, pipeline) or service name (for example, CodePipeline) that you want to filter by.
dict
Response Syntax
{
'EventTypes': [
{
'EventTypeId': 'string',
'ServiceName': 'string',
'EventTypeName': 'string',
'ResourceType': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
EventTypes (list) --
Information about each event, including service name, resource type, event ID, and event name.
(dict) --
Returns information about an event that has triggered a notification rule.
EventTypeId (string) --
The system-generated ID of the event. For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide .
ServiceName (string) --
The name of the service for which the event applies.
EventTypeName (string) --
The name of the event.
ResourceType (string) --
The resource type of the event.
NextToken (string) --
An enumeration token that can be used in a request to return the next batch of the results.
Exceptions
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
list_notification_rules
(**kwargs)¶Returns a list of the notification rules for an Amazon Web Services account.
See also: AWS API Documentation
Request Syntax
response = client.list_notification_rules(
Filters=[
{
'Name': 'EVENT_TYPE_ID'|'CREATED_BY'|'RESOURCE'|'TARGET_ADDRESS',
'Value': 'string'
},
],
NextToken='string',
MaxResults=123
)
The filters to use to return information by service or resource type. For valid values, see ListNotificationRulesFilter.
Note
A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.
Information about a filter to apply to the list of returned notification rules. You can filter by event type, owner, resource, or target.
The name of the attribute you want to use to filter the returned notification rules.
The value of the attribute you want to use to filter the returned notification rules. For example, if you specify filtering by RESOURCE in Name, you might specify the ARN of a pipeline in CodePipeline for the value.
dict
Response Syntax
{
'NextToken': 'string',
'NotificationRules': [
{
'Id': 'string',
'Arn': 'string'
},
]
}
Response Structure
(dict) --
NextToken (string) --
An enumeration token that can be used in a request to return the next batch of the results.
NotificationRules (list) --
The list of notification rules for the Amazon Web Services account, by Amazon Resource Name (ARN) and ID.
(dict) --
Information about a specified notification rule.
Id (string) --
The unique ID of the notification rule.
Arn (string) --
The Amazon Resource Name (ARN) of the notification rule.
Exceptions
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
Returns a list of the tags associated with a notification rule.
See also: AWS API Documentation
Request Syntax
response = client.list_tags_for_resource(
Arn='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) for the notification rule.
{
'Tags': {
'string': 'string'
}
}
Response Structure
The tags associated with the notification rule.
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
list_targets
(**kwargs)¶Returns a list of the notification rule targets for an Amazon Web Services account.
See also: AWS API Documentation
Request Syntax
response = client.list_targets(
Filters=[
{
'Name': 'TARGET_TYPE'|'TARGET_ADDRESS'|'TARGET_STATUS',
'Value': 'string'
},
],
NextToken='string',
MaxResults=123
)
The filters to use to return information by service or resource type. Valid filters include target type, target address, and target status.
Note
A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.
Information about a filter to apply to the list of returned targets. You can filter by target type, address, or status. For example, to filter results to notification rules that have active Chatbot topics as targets, you could specify a ListTargetsFilter Name as TargetType
and a Value of SNS
, and a Name of TARGET_STATUS
and a Value of ACTIVE
.
The name of the attribute you want to use to filter the returned targets.
The value of the attribute you want to use to filter the returned targets. For example, if you specify SNS
for the Target type, you could specify an Amazon Resource Name (ARN) for a topic as the value.
dict
Response Syntax
{
'Targets': [
{
'TargetAddress': 'string',
'TargetType': 'string',
'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Targets (list) --
The list of notification rule targets.
(dict) --
Information about the targets specified for a notification rule.
TargetAddress (string) --
The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
TargetType (string) --
The type of the target (for example, SNS
).
SNS
.AWSChatbotSlack
.TargetStatus (string) --
The status of the target.
NextToken (string) --
An enumeration token that can be used in a request to return the next batch of results.
Exceptions
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
subscribe
(**kwargs)¶Creates an association between a notification rule and an Chatbot topic or Chatbot client so that the associated target can receive notifications when the events described in the rule are triggered.
See also: AWS API Documentation
Request Syntax
response = client.subscribe(
Arn='string',
Target={
'TargetType': 'string',
'TargetAddress': 'string'
},
ClientRequestToken='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) of the notification rule for which you want to create the association.
[REQUIRED]
Information about the Chatbot topics or Chatbot clients associated with a notification rule.
The target type. Can be an Chatbot topic or Chatbot client.
SNS
.AWSChatbotSlack
.The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
dict
Response Syntax
{
'Arn': 'string'
}
Response Structure
(dict) --
Arn (string) --
The Amazon Resource Name (ARN) of the notification rule for which you have created assocations.
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ConfigurationException
tag_resource
(**kwargs)¶Associates a set of provided tags with a notification rule.
See also: AWS API Documentation
Request Syntax
response = client.tag_resource(
Arn='string',
Tags={
'string': 'string'
}
)
[REQUIRED]
The Amazon Resource Name (ARN) of the notification rule to tag.
[REQUIRED]
The list of tags to associate with the resource. Tag key names cannot start with " aws
".
dict
Response Syntax
{
'Tags': {
'string': 'string'
}
}
Response Structure
(dict) --
Tags (dict) --
The list of tags associated with the resource.
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.LimitExceededException
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
unsubscribe
(**kwargs)¶Removes an association between a notification rule and an Chatbot topic so that subscribers to that topic stop receiving notifications when the events described in the rule are triggered.
See also: AWS API Documentation
Request Syntax
response = client.unsubscribe(
Arn='string',
TargetAddress='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) of the notification rule.
[REQUIRED]
The ARN of the Chatbot topic to unsubscribe from the notification rule.
dict
Response Syntax
{
'Arn': 'string'
}
Response Structure
(dict) --
Arn (string) --
The Amazon Resource Name (ARN) of the the notification rule from which you have removed a subscription.
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
untag_resource
(**kwargs)¶Removes the association between one or more provided tags and a notification rule.
See also: AWS API Documentation
Request Syntax
response = client.untag_resource(
Arn='string',
TagKeys=[
'string',
]
)
[REQUIRED]
The Amazon Resource Name (ARN) of the notification rule from which to remove the tags.
[REQUIRED]
The key names of the tags to remove.
dict
Response Syntax
{}
Response Structure
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.LimitExceededException
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
update_notification_rule
(**kwargs)¶Updates a notification rule for a resource. You can change the events that trigger the notification rule, the status of the rule, and the targets that receive the notifications.
Note
To add or remove tags for a notification rule, you must use TagResource and UntagResource.
See also: AWS API Documentation
Request Syntax
response = client.update_notification_rule(
Arn='string',
Name='string',
Status='ENABLED'|'DISABLED',
EventTypeIds=[
'string',
],
Targets=[
{
'TargetType': 'string',
'TargetAddress': 'string'
},
],
DetailType='BASIC'|'FULL'
)
[REQUIRED]
The Amazon Resource Name (ARN) of the notification rule.
A list of event types associated with this notification rule. For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide .
The address and type of the targets to receive notifications from this notification rule.
Information about the Chatbot topics or Chatbot clients associated with a notification rule.
The target type. Can be an Chatbot topic or Chatbot client.
SNS
.AWSChatbotSlack
.The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
dict
Response Syntax
{}
Response Structure
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ConfigurationException
The available paginators are:
CodeStarNotifications.Paginator.ListEventTypes
CodeStarNotifications.Paginator.ListNotificationRules
CodeStarNotifications.Paginator.ListTargets
CodeStarNotifications.Paginator.
ListEventTypes
¶paginator = client.get_paginator('list_event_types')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from CodeStarNotifications.Client.list_event_types()
.
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
Filters=[
{
'Name': 'RESOURCE_TYPE'|'SERVICE_NAME',
'Value': 'string'
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
The filters to use to return information by service or resource type.
Information about a filter to apply to the list of returned event types. You can filter by resource type or service name.
The system-generated name of the filter type you want to filter by.
The name of the resource type (for example, pipeline) or service name (for example, CodePipeline) that you want to filter by.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken
will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken
from a previous response.
dict
Response Syntax
{
'EventTypes': [
{
'EventTypeId': 'string',
'ServiceName': 'string',
'EventTypeName': 'string',
'ResourceType': 'string'
},
],
}
Response Structure
(dict) --
EventTypes (list) --
Information about each event, including service name, resource type, event ID, and event name.
(dict) --
Returns information about an event that has triggered a notification rule.
EventTypeId (string) --
The system-generated ID of the event. For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide .
ServiceName (string) --
The name of the service for which the event applies.
EventTypeName (string) --
The name of the event.
ResourceType (string) --
The resource type of the event.
CodeStarNotifications.Paginator.
ListNotificationRules
¶paginator = client.get_paginator('list_notification_rules')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from CodeStarNotifications.Client.list_notification_rules()
.
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
Filters=[
{
'Name': 'EVENT_TYPE_ID'|'CREATED_BY'|'RESOURCE'|'TARGET_ADDRESS',
'Value': 'string'
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
The filters to use to return information by service or resource type. For valid values, see ListNotificationRulesFilter.
Note
A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.
Information about a filter to apply to the list of returned notification rules. You can filter by event type, owner, resource, or target.
The name of the attribute you want to use to filter the returned notification rules.
The value of the attribute you want to use to filter the returned notification rules. For example, if you specify filtering by RESOURCE in Name, you might specify the ARN of a pipeline in CodePipeline for the value.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken
will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken
from a previous response.
dict
Response Syntax
{
'NotificationRules': [
{
'Id': 'string',
'Arn': 'string'
},
]
}
Response Structure
(dict) --
NotificationRules (list) --
The list of notification rules for the Amazon Web Services account, by Amazon Resource Name (ARN) and ID.
(dict) --
Information about a specified notification rule.
Id (string) --
The unique ID of the notification rule.
Arn (string) --
The Amazon Resource Name (ARN) of the notification rule.
CodeStarNotifications.Paginator.
ListTargets
¶paginator = client.get_paginator('list_targets')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from CodeStarNotifications.Client.list_targets()
.
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
Filters=[
{
'Name': 'TARGET_TYPE'|'TARGET_ADDRESS'|'TARGET_STATUS',
'Value': 'string'
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
The filters to use to return information by service or resource type. Valid filters include target type, target address, and target status.
Note
A filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.
Information about a filter to apply to the list of returned targets. You can filter by target type, address, or status. For example, to filter results to notification rules that have active Chatbot topics as targets, you could specify a ListTargetsFilter Name as TargetType
and a Value of SNS
, and a Name of TARGET_STATUS
and a Value of ACTIVE
.
The name of the attribute you want to use to filter the returned targets.
The value of the attribute you want to use to filter the returned targets. For example, if you specify SNS
for the Target type, you could specify an Amazon Resource Name (ARN) for a topic as the value.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken
will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken
from a previous response.
dict
Response Syntax
{
'Targets': [
{
'TargetAddress': 'string',
'TargetType': 'string',
'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED'
},
],
}
Response Structure
(dict) --
Targets (list) --
The list of notification rule targets.
(dict) --
Information about the targets specified for a notification rule.
TargetAddress (string) --
The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
TargetType (string) --
The type of the target (for example, SNS
).
SNS
.AWSChatbotSlack
.TargetStatus (string) --
The status of the target.