Example usage for com.amazonaws.services.identitymanagement.model DetachRolePolicyRequest DetachRolePolicyRequest

List of usage examples for com.amazonaws.services.identitymanagement.model DetachRolePolicyRequest DetachRolePolicyRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.identitymanagement.model DetachRolePolicyRequest DetachRolePolicyRequest.

Prototype

DetachRolePolicyRequest

Source Link

Usage

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  w w .  j  a va 2s.  c o  m*/
    }

    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 w w .ja  v  a  2 s.c  om
    }

    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);
}