FilterGroup

class aws_cdk.aws_codebuild.FilterGroup(*args: Any, **kwargs)

Bases: object

An object that represents a group of filter conditions for a webhook.

Every condition in a given FilterGroup must be true in order for the whole group to be true. You construct instances of it by calling the {@link #inEventOf} static factory method, and then calling various andXyz instance methods to create modified instances of it (this class is immutable).

You pass instances of this class to the webhookFilters property when constructing a source.

ExampleMetadata:

infused

Example:

git_hub_source = codebuild.Source.git_hub(
    owner="awslabs",
    repo="aws-cdk",
    webhook=True,  # optional, default: true if `webhookFilters` were provided, false otherwise
    webhook_triggers_batch_build=True,  # optional, default is false
    webhook_filters=[
        codebuild.FilterGroup.in_event_of(codebuild.EventAction.PUSH).and_branch_is("master").and_commit_message_is("the commit message")
    ]
)

Methods

and_actor_account_is(pattern)

Create a new FilterGroup with an added condition: the account ID of the actor initiating the event must match the given pattern.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_actor_account_is_not(pattern)

Create a new FilterGroup with an added condition: the account ID of the actor initiating the event must not match the given pattern.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_base_branch_is(branch_name)

Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given base branch.

Note that you cannot use this method if this Group contains the PUSH event action.

Parameters:

branch_name (str) – the name of the branch (can be a regular expression).

Return type:

FilterGroup

and_base_branch_is_not(branch_name)

Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must not target the given base branch.

Note that you cannot use this method if this Group contains the PUSH event action.

Parameters:

branch_name (str) – the name of the branch (can be a regular expression).

Return type:

FilterGroup

and_base_ref_is(pattern)

Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must target the given Git reference.

Note that you cannot use this method if this Group contains the PUSH event action.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_base_ref_is_not(pattern)

Create a new FilterGroup with an added condition: the Pull Request that is the source of the event must not target the given Git reference.

Note that you cannot use this method if this Group contains the PUSH event action.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_branch_is(branch_name)

Create a new FilterGroup with an added condition: the event must affect the given branch.

Parameters:

branch_name (str) – the name of the branch (can be a regular expression).

Return type:

FilterGroup

and_branch_is_not(branch_name)

Create a new FilterGroup with an added condition: the event must not affect the given branch.

Parameters:

branch_name (str) – the name of the branch (can be a regular expression).

Return type:

FilterGroup

and_commit_message_is(commit_message)

Create a new FilterGroup with an added condition: the event must affect a head commit with the given message.

Parameters:

commit_message (str) – the commit message (can be a regular expression).

Return type:

FilterGroup

and_commit_message_is_not(commit_message)

Create a new FilterGroup with an added condition: the event must not affect a head commit with the given message.

Parameters:

commit_message (str) – the commit message (can be a regular expression).

Return type:

FilterGroup

and_file_path_is(pattern)

Create a new FilterGroup with an added condition: the push that is the source of the event must affect a file that matches the given pattern.

Note that you can only use this method if this Group contains only the PUSH event action, and only for GitHub, Bitbucket and GitHubEnterprise sources.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_file_path_is_not(pattern)

Create a new FilterGroup with an added condition: the push that is the source of the event must not affect a file that matches the given pattern.

Note that you can only use this method if this Group contains only the PUSH event action, and only for GitHub, Bitbucket and GitHubEnterprise sources.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_head_ref_is(pattern)

Create a new FilterGroup with an added condition: the event must affect a Git reference (ie., a branch or a tag) that matches the given pattern.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_head_ref_is_not(pattern)

Create a new FilterGroup with an added condition: the event must not affect a Git reference (ie., a branch or a tag) that matches the given pattern.

Parameters:

pattern (str) – a regular expression.

Return type:

FilterGroup

and_tag_is(tag_name)

Create a new FilterGroup with an added condition: the event must affect the given tag.

Parameters:

tag_name (str) – the name of the tag (can be a regular expression).

Return type:

FilterGroup

and_tag_is_not(tag_name)

Create a new FilterGroup with an added condition: the event must not affect the given tag.

Parameters:

tag_name (str) – the name of the tag (can be a regular expression).

Return type:

FilterGroup

Static Methods

classmethod in_event_of(*actions)

Creates a new event FilterGroup that triggers on any of the provided actions.

Parameters:

actions (EventAction) – the actions to trigger the webhook on.

Return type:

FilterGroup