Skip to content

put_resource_policy

put_resource_policy(
    arn: ResourcePolicyTargetArn,
    *,
    config_overrides: Optional[ContinuumClientConfig] = None,
    policy: Optional[ResourcePolicyInputDocument] = None,
    expected_revision_id: Optional[ResourcePolicyRevisionId] = None,
) -> PutResourcePolicyOutput

Creates or replaces the resource policy attached to a Continuum resource.

Parameters:

  • arn (ResourcePolicyTargetArn) –

    The ARN of a resource in the caller's account.

  • policy (Optional[ResourcePolicyInputDocument], default: None ) –

    Omit or supply an empty Statement array to clear resource-policy grants and store the canonical empty-statement policy. Cross-account access is denied; same-account access remains subject to identity policies. Use an explicit Deny statement to deny same-account principals too.

  • expected_revision_id (Optional[ResourcePolicyRevisionId], default: None ) –

    Optional optimistic-concurrency token for the currently observed policy.

Raises:

  • AccessDeniedException –

    The request is not authorized. Verify that your credentials and request signature are valid and that you have permission to perform this action.

  • ConflictException –

    The request could not be completed due to a conflict with the current state of the resource.

  • InternalServerException –

    The request couldn't be processed because of an internal server issue. Try again later. If the problem persists, contact AWS Support.

  • ResourceNotFoundException –

    The specified resource was not found. Verify that the resource identifier is correct and that the resource exists.

  • ThrottlingException –

    The request was denied due to request throttling.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_continuum/_services/continuum.py
def put_resource_policy(
    self,
    arn: "capo_continuum.types.resource_policy_target_arn.ResourcePolicyTargetArn",
    *,
    config_overrides: Optional[ContinuumClientConfig] = None,
    policy: Optional[
        "capo_continuum.types.resource_policy_input_document.ResourcePolicyInputDocument"
    ] = None,
    expected_revision_id: Optional[
        "capo_continuum.types.resource_policy_revision_id.ResourcePolicyRevisionId"
    ] = None,
) -> "capo_continuum.types.put_resource_policy_output.PutResourcePolicyOutput":
    """Creates or replaces the resource policy attached to a Continuum resource.

    Args:
        arn: The ARN of a resource in the caller's account.
        policy: Omit or supply an empty Statement array to clear resource-policy grants and store the canonical empty-statement policy. Cross-account access is denied; same-account access remains subject to identity policies. Use an explicit Deny statement to deny same-account principals too.
        expected_revision_id: Optional optimistic-concurrency token for the currently observed policy.

    Raises:
        capo_continuum.errors.access_denied_exception.AccessDeniedException: The request is not authorized. Verify that your credentials and request signature are valid and that you have permission to perform this action.
        capo_continuum.errors.conflict_exception.ConflictException: The request could not be completed due to a conflict with the current state of the resource.
        capo_continuum.errors.internal_server_exception.InternalServerException: The request couldn't be processed because of an internal server issue. Try again later. If the problem persists, contact AWS Support.
        capo_continuum.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource was not found. Verify that the resource identifier is correct and that the resource exists.
        capo_continuum.errors.throttling_exception.ThrottlingException: The request was denied due to request throttling.
        capo_continuum.errors.validation_exception.ValidationException
        capo_continuum.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_continuum.types.put_resource_policy_input.PutResourcePolicyInput]",
    ) -> OperationResponse[
        "capo_continuum.types.put_resource_policy_output.PutResourcePolicyOutput"
    ]:
        import capo_continuum._operations.continuum_control_plane.put_resource_policy

        output, http_response = (
            capo_continuum._operations.continuum_control_plane.put_resource_policy.put_resource_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_continuum.types.put_resource_policy_input.PutResourcePolicyInput",
    ) -> dict[str, Any]:
        import capo_continuum.types.put_resource_policy_input

        return capo_continuum.types.put_resource_policy_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_continuum.types.put_resource_policy_output.PutResourcePolicyOutput",
    ) -> dict[str, Any]:
        import capo_continuum.types.put_resource_policy_output

        return capo_continuum.types.put_resource_policy_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "PutResourcePolicy",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_continuum.types.put_resource_policy_input.PutResourcePolicyInput = {
        "arn": arn
    }
    if policy is not None:
        input_["policy"] = policy
    if expected_revision_id is not None:
        input_["expected_revision_id"] = expected_revision_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output