deletePolicy method

Future<DeletePolicyResponse> deletePolicy({
  1. required String policyEngineId,
  2. required String policyId,
})

Deletes an existing policy from the AgentCore Policy system. Once deleted, the policy can no longer be used for agent behavior control and all references to it become invalid. This is an asynchronous operation. Use the GetPolicy operation to poll the status field to track completion.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter policyEngineId : The identifier of the policy engine that manages the policy to be deleted. This ensures the policy is deleted from the correct policy engine context.

Parameter policyId : The unique identifier of the policy to be deleted. This must be a valid policy ID that exists within the specified policy engine.

Implementation

Future<DeletePolicyResponse> deletePolicy({
  required String policyEngineId,
  required String policyId,
}) async {
  final response = await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri:
        '/policy-engines/${Uri.encodeComponent(policyEngineId)}/policies/${Uri.encodeComponent(policyId)}',
    exceptionFnMap: _exceptionFns,
  );
  return DeletePolicyResponse.fromJson(response);
}