deleteResourcePolicyStatement method
Deletes a policy statement from a resource policy. If you delete the last statement from a policy, the policy is deleted. If you specify a statement ID that doesn't exist in the policy, or if the bot or bot alias doesn't have a policy attached, Amazon Lex returns an exception.
You need to add the DeleteResourcePolicy or
UpdateResourcePolicy action to the bot role in order to call
the API.
May throw InternalServerException.
May throw PreconditionFailedException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter resourceArn :
The Amazon Resource Name (ARN) of the bot or bot alias that the resource
policy is attached to.
Parameter statementId :
The name of the statement (SID) to delete from the policy.
Parameter expectedRevisionId :
The identifier of the revision of the policy to delete the statement from.
If this revision ID doesn't match the current revision ID, Amazon Lex
throws an exception.
If you don't specify a revision, Amazon Lex removes the current contents of the statement.
Implementation
Future<DeleteResourcePolicyStatementResponse> deleteResourcePolicyStatement({
required String resourceArn,
required String statementId,
String? expectedRevisionId,
}) async {
final $query = <String, List<String>>{
if (expectedRevisionId != null)
'expectedRevisionId': [expectedRevisionId],
};
final response = await _protocol.send(
payload: null,
method: 'DELETE',
requestUri:
'/policy/${Uri.encodeComponent(resourceArn)}/statements/${Uri.encodeComponent(statementId)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return DeleteResourcePolicyStatementResponse.fromJson(response);
}