use of software.amazon.awssdk.services.iam.model.DeletePolicyRequest in project aws-doc-sdk-examples by awsdocs.
the class DeletePolicy method deleteIAMPolicy.
// snippet-start:[iam.java2.delete_policy.main]
public static void deleteIAMPolicy(IamClient iam, String policyARN) {
try {
DeletePolicyRequest request = DeletePolicyRequest.builder().policyArn(policyARN).build();
iam.deletePolicy(request);
System.out.println("Successfully deleted the policy");
} catch (IamException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
System.out.println("Done");
}
Aggregations