Search in sources :

Example 1 with CreateAccessKeyResult

use of com.amazonaws.services.identitymanagement.model.CreateAccessKeyResult in project aws-doc-sdk-examples by awsdocs.

the class CreateAccessKey method main.

public static void main(String[] args) {
    final String USAGE = "To run this example, supply an IAM user\n" + "Ex: CreateAccessKey <user>\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String user = args[0];
    final AmazonIdentityManagement iam = AmazonIdentityManagementClientBuilder.defaultClient();
    CreateAccessKeyRequest request = new CreateAccessKeyRequest().withUserName(user);
    CreateAccessKeyResult response = iam.createAccessKey(request);
    System.out.println("Created access key: " + response.getAccessKey());
}
Also used : CreateAccessKeyResult(com.amazonaws.services.identitymanagement.model.CreateAccessKeyResult) CreateAccessKeyRequest(com.amazonaws.services.identitymanagement.model.CreateAccessKeyRequest) AmazonIdentityManagement(com.amazonaws.services.identitymanagement.AmazonIdentityManagement)

Aggregations

AmazonIdentityManagement (com.amazonaws.services.identitymanagement.AmazonIdentityManagement)1 CreateAccessKeyRequest (com.amazonaws.services.identitymanagement.model.CreateAccessKeyRequest)1 CreateAccessKeyResult (com.amazonaws.services.identitymanagement.model.CreateAccessKeyResult)1