Example usage for com.amazonaws.services.identitymanagement AmazonIdentityManagement getPolicy

List of usage examples for com.amazonaws.services.identitymanagement AmazonIdentityManagement getPolicy

Introduction

In this page you can find the example usage for com.amazonaws.services.identitymanagement AmazonIdentityManagement getPolicy.

Prototype

GetPolicyResult getPolicy(GetPolicyRequest getPolicyRequest);

Source Link

Document

Retrieves information about the specified managed policy, including the policy's default version and the total number of IAM users, groups, and roles to which the policy is attached.

Usage

From source file:aws.example.iam.GetPolicy.java

License:Open Source License

public static void main(String[] args) {

    final String USAGE = "To run this example, supply a policy arn\n" + "Ex: GetPolicy <policy-arn>\n";

    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);/*w  w  w. jav  a 2 s .  c  o  m*/
    }

    String policy_arn = args[0];

    final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();

    GetPolicyRequest request = new GetPolicyRequest().withPolicyArn(policy_arn);

    GetPolicyResult response = iam.getPolicy(request);

    System.out.format("Successfully retrieved policy %s", response.getPolicy().getPolicyName());
}

From source file:iam.src.main.java.aws.example.iam.GetPolicy.java

License:Open Source License

public static void main(String[] args) {

    final String USAGE = "To run this example, supply a policy arn\n" + "Ex: GetPolicy <policy-arn>\n";

    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);// www .j a  v a  2  s  .c om
    }

    String policyArn = args[0];

    final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();

    GetPolicyRequest request = new GetPolicyRequest().withPolicyArn(policyArn);

    GetPolicyResult response = iam.getPolicy(request);

    System.out.format("Successfully retrieved policy %s", response.getPolicy().getPolicyName());
}