List of usage examples for com.amazonaws.services.identitymanagement AmazonIdentityManagement createPolicy
CreatePolicyResult createPolicy(CreatePolicyRequest createPolicyRequest);
Creates a new managed policy for your AWS account.
From source file:aws.example.iam.CreatePolicy.java
License:Open Source License
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);/*from w w w. j a v a2 s. c om*/ } 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()); }
From source file:iam.src.main.java.aws.example.iam.CreatePolicy.java
License:Open Source License
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);/*from w w w .j a va2 s .c o m*/ } String policyName = args[0]; final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient(); CreatePolicyRequest request = new CreatePolicyRequest().withPolicyName(policyName) .withPolicyDocument(POLICY_DOCUMENT); CreatePolicyResult response = iam.createPolicy(request); System.out.println("Successfully created policy: " + response.getPolicy().getPolicyName()); }