Removes an existing policy from a bot or bot alias. If the resource doesn't have a policy attached, Amazon Lex returns an exception.
Parameters:
-
resource_arn
(AmazonResourceName)
–
The Amazon Resource Name (ARN) of the bot or bot alias that has the resource policy attached.
-
expected_revision_id
(Optional[RevisionId], default:
None
)
–
The identifier of the revision to edit. If this ID doesn't match the current revision number, Amazon Lex returns an exception
If you don't specify a revision ID, Amazon Lex will delete the current policy.
Raises:
-
InternalServerException
–
The service encountered an unexpected condition. Try your request again.
-
PreconditionFailedException
–
Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.
-
ResourceNotFoundException
–
You asked to describe a resource that doesn't exist. Check the resource that you are requesting and try again.
-
ThrottlingException
–
Your request rate is too high. Reduce the frequency of requests.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_lex_models_v2/_services/async_lex_models_v2.py
| async def delete_resource_policy(
self,
resource_arn: "capo_lex_models_v2.types.amazon_resource_name.AmazonResourceName",
*,
config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
expected_revision_id: Optional[
"capo_lex_models_v2.types.revision_id.RevisionId"
] = None,
) -> "capo_lex_models_v2.types.delete_resource_policy_response.DeleteResourcePolicyResponse":
"""<p>Removes an existing policy from a bot or bot alias. If the resource doesn't have a policy attached, Amazon Lex returns an exception.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the bot or bot alias that has the resource policy attached.</p>
expected_revision_id: <p>The identifier of the revision to edit. If this ID doesn't match the current revision number, Amazon Lex returns an exception</p> <p>If you don't specify a revision ID, Amazon Lex will delete the current policy.</p>
Raises:
capo_lex_models_v2.errors.internal_server_exception.InternalServerException: <p>The service encountered an unexpected condition. Try your request again.</p>
capo_lex_models_v2.errors.precondition_failed_exception.PreconditionFailedException: <p>Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.</p>
capo_lex_models_v2.errors.resource_not_found_exception.ResourceNotFoundException: <p>You asked to describe a resource that doesn't exist. Check the resource that you are requesting and try again.</p>
capo_lex_models_v2.errors.throttling_exception.ThrottlingException: <p>Your request rate is too high. Reduce the frequency of requests.</p>
capo_lex_models_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_lex_models_v2.types.delete_resource_policy_request.DeleteResourcePolicyRequest]",
) -> AsyncOperationResponse[
"capo_lex_models_v2.types.delete_resource_policy_response.DeleteResourcePolicyResponse"
]:
import capo_lex_models_v2._operations.lex_model_building_service_v2.delete_resource_policy
(
output,
http_response,
) = await capo_lex_models_v2._operations.lex_model_building_service_v2.delete_resource_policy.async_delete_resource_policy(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteResourcePolicy")
)
input_: capo_lex_models_v2.types.delete_resource_policy_request.DeleteResourcePolicyRequest = {
"resource_arn": resource_arn
}
if expected_revision_id is not None:
input_["expected_revision_id"] = expected_revision_id
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|