List of usage examples for com.amazonaws.services.identitymanagement AmazonIdentityManagement detachRolePolicy
DetachRolePolicyResult detachRolePolicy(DetachRolePolicyRequest detachRolePolicyRequest);
Removes the specified managed policy from the specified role.
From source file:aws.example.iam.DetachRolePolicy.java
License:Open Source License
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);/* w ww . j a va 2s . c om*/ } 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); }
From source file:iam.src.main.java.aws.example.iam.DetachRolePolicy.java
License:Open Source License
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);//from w ww. j ava2s . c o m } String roleName = args[0]; String policyArn = args[1]; final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient(); DetachRolePolicyRequest request = new DetachRolePolicyRequest().withRoleName(roleName) .withPolicyArn(policyArn); DetachRolePolicyResult response = iam.detachRolePolicy(request); System.out.println("Successfully detached policy " + policyArn + " from role " + roleName); }