Skip to content

update_webhook async

update_webhook(
    project_name: ProjectName,
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
    branch_filter: Optional[String] = None,
    rotate_secret: Optional[Boolean] = None,
    filter_groups: Optional[FilterGroups] = None,
    build_type: Optional[WebhookBuildType] = None,
    pull_request_build_policy: Optional[PullRequestBuildPolicy] = None,
) -> UpdateWebhookOutput

Updates the webhook associated with an CodeBuild build project.

If you use Bitbucket for your repository, rotateSecret is ignored.

Parameters:

  • project_name (ProjectName) –

    The name of the CodeBuild project.

  • branch_filter (Optional[String], default: None ) –

    A regular expression used to determine which repository branches are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If branchFilter is empty, then all branches are built.

    It is recommended that you use filterGroups instead of branchFilter.

  • rotate_secret (Optional[Boolean], default: None ) –

    A boolean value that specifies whether the associated GitHub repository's secret token should be updated. If you use Bitbucket for your repository, rotateSecret is ignored.

  • filter_groups (Optional[FilterGroups], default: None ) –

    An array of arrays of WebhookFilter objects used to determine if a webhook event can trigger a build. A filter group must contain at least one EVENT WebhookFilter.

  • build_type (Optional[WebhookBuildType], default: None ) –

    Specifies the type of build this webhook will trigger.

    RUNNER_BUILDKITE_BUILD is only available for NO_SOURCE source type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see Tutorial: Configure a CodeBuild-hosted Buildkite runner in the CodeBuild user guide.

  • pull_request_build_policy (Optional[PullRequestBuildPolicy], default: None ) –

    A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.

Raises:

Source code in docs_src/capo_codebuild/_services/async_code_build.py
async def update_webhook(
    self,
    project_name: "capo_codebuild.types.project_name.ProjectName",
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
    branch_filter: Optional["capo_codebuild.types.string.String"] = None,
    rotate_secret: Optional["capo_codebuild.types.boolean.Boolean"] = None,
    filter_groups: Optional[
        "capo_codebuild.types.filter_groups.FilterGroups"
    ] = None,
    build_type: Optional[
        "capo_codebuild.types.webhook_build_type.WebhookBuildType"
    ] = None,
    pull_request_build_policy: Optional[
        "capo_codebuild.types.pull_request_build_policy.PullRequestBuildPolicy"
    ] = None,
) -> "capo_codebuild.types.update_webhook_output.UpdateWebhookOutput":
    """<p> Updates the webhook associated with an CodeBuild build project. </p> <note> <p> If you use Bitbucket for your repository, <code>rotateSecret</code> is ignored. </p> </note>

    Args:
        project_name: <p>The name of the CodeBuild project.</p>
        branch_filter: <p>A regular expression used to determine which repository branches are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If <code>branchFilter</code> is empty, then all branches are built.</p> <note> <p> It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>. </p> </note>
        rotate_secret: <p> A boolean value that specifies whether the associated GitHub repository's secret token should be updated. If you use Bitbucket for your repository, <code>rotateSecret</code> is ignored. </p>
        filter_groups: <p> An array of arrays of <code>WebhookFilter</code> objects used to determine if a webhook event can trigger a build. A filter group must contain at least one <code>EVENT</code> <code>WebhookFilter</code>. </p>
        build_type: <p>Specifies the type of build this webhook will trigger.</p> <note> <p> <code>RUNNER_BUILDKITE_BUILD</code> is only available for <code>NO_SOURCE</code> source type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/sample-runner-buildkite.html">Tutorial: Configure a CodeBuild-hosted Buildkite runner</a> in the <i>CodeBuild user guide</i>.</p> </note>
        pull_request_build_policy: <p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>

    Raises:
        capo_codebuild.errors.invalid_input_exception.InvalidInputException: <p>The input value that was provided is not valid.</p>
        capo_codebuild.errors.o_auth_provider_exception.OAuthProviderException: <p>There was a problem with the underlying OAuth provider.</p>
        capo_codebuild.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified Amazon Web Services resource cannot be found.</p>
        capo_codebuild.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codebuild.types.update_webhook_input.UpdateWebhookInput]",
    ) -> AsyncOperationResponse[
        "capo_codebuild.types.update_webhook_output.UpdateWebhookOutput"
    ]:
        import capo_codebuild._operations.code_build_20161006.update_webhook

        (
            output,
            http_response,
        ) = await capo_codebuild._operations.code_build_20161006.update_webhook.async_update_webhook(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateWebhook")
    )
    input_: capo_codebuild.types.update_webhook_input.UpdateWebhookInput = {
        "project_name": project_name
    }
    if branch_filter is not None:
        input_["branch_filter"] = branch_filter
    if rotate_secret is not None:
        input_["rotate_secret"] = rotate_secret
    if filter_groups is not None:
        input_["filter_groups"] = filter_groups
    if build_type is not None:
        input_["build_type"] = build_type
    if pull_request_build_policy is not None:
        input_["pull_request_build_policy"] = pull_request_build_policy

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output