Search in sources :

Example 1 with CreatePolicyResult

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());
}
Also used : CreatePolicyRequest(com.amazonaws.services.identitymanagement.model.CreatePolicyRequest) CreatePolicyResult(com.amazonaws.services.identitymanagement.model.CreatePolicyResult) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement)

Aggregations

AmazonIdentityManagement (com.amazonaws.services.identitymanagement.AmazonIdentityManagement)1 CreatePolicyRequest (com.amazonaws.services.identitymanagement.model.CreatePolicyRequest)1 CreatePolicyResult (com.amazonaws.services.identitymanagement.model.CreatePolicyResult)1