Skip to content

put_resource_policy async

put_resource_policy(
    policy: NonEmptyString,
    resource_arn: NonEmptyString,
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
) -> PutResourcePolicyOutput

Stores a resource policy for the ARN of a Project or ReportGroup object.

Parameters:

Raises:

Source code in docs_src/capo_codebuild/_services/async_code_build.py
async def put_resource_policy(
    self,
    policy: "capo_codebuild.types.non_empty_string.NonEmptyString",
    resource_arn: "capo_codebuild.types.non_empty_string.NonEmptyString",
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
) -> "capo_codebuild.types.put_resource_policy_output.PutResourcePolicyOutput":
    """<p> Stores a resource policy for the ARN of a <code>Project</code> or <code>ReportGroup</code> object. </p>

    Args:
        policy: <p> A JSON-formatted resource policy. For more information, see <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/project-sharing.html#project-sharing-share">Sharing a Project</a> and <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/report-groups-sharing.html#report-groups-sharing-share">Sharing a Report Group</a> in the <i>CodeBuild User Guide</i>. </p>
        resource_arn: <p> The ARN of the <code>Project</code> or <code>ReportGroup</code> resource you want to associate with a resource policy. </p>

    Raises:
        capo_codebuild.errors.invalid_input_exception.InvalidInputException: <p>The input value that was provided is not valid.</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.put_resource_policy_input.PutResourcePolicyInput]",
    ) -> AsyncOperationResponse[
        "capo_codebuild.types.put_resource_policy_output.PutResourcePolicyOutput"
    ]:
        import capo_codebuild._operations.code_build_20161006.put_resource_policy

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutResourcePolicy")
    )
    input_: capo_codebuild.types.put_resource_policy_input.PutResourcePolicyInput = {
        "policy": policy,
        "resource_arn": resource_arn,
    }

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