Skip to content

put_resource_policy async

put_resource_policy(
    resource_arn: PipelineArn,
    policy: ResourcePolicy,
    *,
    config_overrides: Optional[AsyncOSISClientConfig] = None,
) -> PutResourcePolicyResponse

Attaches a resource-based policy to an OpenSearch Ingestion resource. Resource-based policies grant permissions to principals to perform actions on the resource.

Parameters:

  • resource_arn (PipelineArn) –

    The Amazon Resource Name (ARN) of the resource to attach the policy to.

  • policy (ResourcePolicy) –

    The resource-based policy document in JSON format.

Raises:

Source code in docs_src/capo_osis/_services/async_osis.py
async def put_resource_policy(
    self,
    resource_arn: "capo_osis.types.pipeline_arn.PipelineArn",
    policy: "capo_osis.types.resource_policy.ResourcePolicy",
    *,
    config_overrides: Optional[AsyncOSISClientConfig] = None,
) -> "capo_osis.types.put_resource_policy_response.PutResourcePolicyResponse":
    """<p>Attaches a resource-based policy to an OpenSearch Ingestion resource. Resource-based policies grant permissions to principals to perform actions on the resource.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource to attach the policy to.</p>
        policy: <p>The resource-based policy document in JSON format.</p>

    Raises:
        capo_osis.errors.access_denied_exception.AccessDeniedException: <p>You don't have permissions to access the resource.</p>
        capo_osis.errors.disabled_operation_exception.DisabledOperationException: <p>Exception is thrown when an operation has been disabled.</p>
        capo_osis.errors.internal_exception.InternalException: <p>The request failed because of an unknown error, exception, or failure (the failure is internal to the service).</p>
        capo_osis.errors.limit_exceeded_exception.LimitExceededException: <p>You attempted to create more than the allowed number of tags.</p>
        capo_osis.errors.resource_not_found_exception.ResourceNotFoundException: <p>You attempted to access or delete a resource that does not exist.</p>
        capo_osis.errors.validation_exception.ValidationException: <p>An exception for missing or invalid input fields.</p>
        capo_osis.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_osis.types.put_resource_policy_request.PutResourcePolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_osis.types.put_resource_policy_response.PutResourcePolicyResponse"
    ]:
        import capo_osis._operations.amazon_open_search_ingestion_service.put_resource_policy

        (
            output,
            http_response,
        ) = await capo_osis._operations.amazon_open_search_ingestion_service.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_osis.types.put_resource_policy_request.PutResourcePolicyRequest = {
        "resource_arn": resource_arn,
        "policy": policy,
    }

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