Skip to content

put_resource_policy

put_resource_policy(
    resource_arn: ResourceArn,
    resource_policy: Policy,
    client_token: IdempotenceToken,
    *,
    config_overrides: Optional[LookoutEquipmentClientConfig] = None,
    policy_revision_id: Optional[PolicyRevisionId] = None,
) -> PutResourcePolicyResponse

Creates a resource control policy for a given resource.

Parameters:

  • resource_arn (ResourceArn) –

    The Amazon Resource Name (ARN) of the resource for which the policy is being created.

  • resource_policy (Policy) –

    The JSON-formatted resource policy to create.

  • policy_revision_id (Optional[PolicyRevisionId], default: None ) –

    A unique identifier for a revision of the resource policy.

  • client_token (IdempotenceToken) –

    A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one.

Raises:

  • AccessDeniedException –

    The request could not be completed because you do not have access to the resource.

  • ConflictException –

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

  • InternalServerException –

    Processing of the request has failed because of an unknown error, exception or failure.

  • ResourceNotFoundException –

    The resource requested could not be found. Verify the resource ID and retry your request.

  • ServiceQuotaExceededException –

    Resource limitations have been exceeded.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized.

  • UnknownServiceError –

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

Source code in docs_src/capo_lookoutequipment/_services/lookout_equipment.py
def put_resource_policy(
    self,
    resource_arn: "capo_lookoutequipment.types.resource_arn.ResourceArn",
    resource_policy: "capo_lookoutequipment.types.policy.Policy",
    client_token: "capo_lookoutequipment.types.idempotence_token.IdempotenceToken",
    *,
    config_overrides: Optional[LookoutEquipmentClientConfig] = None,
    policy_revision_id: Optional[
        "capo_lookoutequipment.types.policy_revision_id.PolicyRevisionId"
    ] = None,
) -> "capo_lookoutequipment.types.put_resource_policy_response.PutResourcePolicyResponse":
    """<p>Creates a resource control policy for a given resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource for which the policy is being created.</p>
        resource_policy: <p>The JSON-formatted resource policy to create.</p>
        policy_revision_id: <p>A unique identifier for a revision of the resource policy.</p>
        client_token: <p>A unique identifier for the request. If you do not set the client request token, Amazon Lookout for Equipment generates one. </p>

    Raises:
        capo_lookoutequipment.errors.access_denied_exception.AccessDeniedException: <p>The request could not be completed because you do not have access to the resource. </p>
        capo_lookoutequipment.errors.conflict_exception.ConflictException: <p> The request could not be completed due to a conflict with the current state of the target resource. </p>
        capo_lookoutequipment.errors.internal_server_exception.InternalServerException: <p> Processing of the request has failed because of an unknown error, exception or failure. </p>
        capo_lookoutequipment.errors.resource_not_found_exception.ResourceNotFoundException: <p> The resource requested could not be found. Verify the resource ID and retry your request. </p>
        capo_lookoutequipment.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> Resource limitations have been exceeded. </p>
        capo_lookoutequipment.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_lookoutequipment.errors.validation_exception.ValidationException: <p> The input fails to satisfy constraints specified by Amazon Lookout for Equipment or a related Amazon Web Services service that's being utilized. </p>
        capo_lookoutequipment.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lookoutequipment.types.put_resource_policy_request.PutResourcePolicyRequest]",
    ) -> OperationResponse[
        "capo_lookoutequipment.types.put_resource_policy_response.PutResourcePolicyResponse"
    ]:
        import capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.put_resource_policy

        output, http_response = (
            capo_lookoutequipment._operations.aws_lookout_equipment_frontend_service.put_resource_policy.put_resource_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutResourcePolicy")
    )
    input_: capo_lookoutequipment.types.put_resource_policy_request.PutResourcePolicyRequest = {
        "resource_arn": resource_arn,
        "resource_policy": resource_policy,
        "client_token": client_token,
    }
    if policy_revision_id is not None:
        input_["policy_revision_id"] = policy_revision_id

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