use of com.amazonaws.services.identitymanagement.model.CreatePolicyResult in project aws-doc-sdk-examples by awsdocs.
the class CreatePolicy method main.
public static void main(String[] args) {
final String USAGE = "To run this example, supply a policy name\n" + "Ex: CreatePolicy <policy-name>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String policy_name = args[0];
final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
CreatePolicyRequest request = new CreatePolicyRequest().withPolicyName(policy_name).withPolicyDocument(POLICY_DOCUMENT);
CreatePolicyResult response = iam.createPolicy(request);
System.out.println("Successfully created policy: " + response.getPolicy().getPolicyName());
}
Aggregations