use of com.amazonaws.services.identitymanagement.model.DetachRolePolicyResult in project aws-doc-sdk-examples by awsdocs.
the class DetachRolePolicy method main.
public static void main(String[] args) {
final String USAGE = "To run this example, supply a role name and policy arn\n" + "Ex: DetachRolePolicy <role-name> <policy-arn>>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String role_name = args[0];
String policy_arn = args[1];
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
DetachRolePolicyRequest request = new DetachRolePolicyRequest().withRoleName(role_name).withPolicyArn(policy_arn);
DetachRolePolicyResult response = iam.detachRolePolicy(request);
System.out.println("Successfully detached policy " + policy_arn + " from role " + role_name);
}
Aggregations