Search in sources :

Example 1 with DeletePolicyRequest

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");
}
Also used : DeletePolicyRequest(software.amazon.awssdk.services.iam.model.DeletePolicyRequest) IamException(software.amazon.awssdk.services.iam.model.IamException)

Aggregations

DeletePolicyRequest (software.amazon.awssdk.services.iam.model.DeletePolicyRequest)1 IamException (software.amazon.awssdk.services.iam.model.IamException)1