com.amazonaws.services.identitymanagement.model.CreateUserRequest Java Examples

The following examples show how to use com.amazonaws.services.identitymanagement.model.CreateUserRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateUser.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {

        final String USAGE =
            "To run this example, supply a username\n" +
            "Ex: CreateUser <username>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String username = args[0];

        final AmazonIdentityManagement iam =
            AmazonIdentityManagementClientBuilder.defaultClient();

        CreateUserRequest request = new CreateUserRequest()
            .withUserName(username);

        CreateUserResult response = iam.createUser(request);

        System.out.println("Successfully created user: " +
                response.getUser().getUserName());
    }
 
Example #2
Source File: IAMService.java    From Serverless-Programming-Cookbook with MIT License 5 votes vote down vote up
/**
 * Create user.
 * @param userName - user name.
 * @return IAMOperationResponse
 */
public final IAMOperationResponse createUser(final String userName) {

    CreateUserRequest request =
            new CreateUserRequest().withUserName(userName);

    CreateUserResult response = iamClient.createUser(request);

    return new IAMOperationResponse(
            "Created user " + response.getUser().getUserName(),
            null);
}
 
Example #3
Source File: IAMServiceImpl.java    From Serverless-Programming-Cookbook with MIT License 5 votes vote down vote up
@Override
public final IAMOperationResponse createUser(final String userName) {

    CreateUserRequest request =
            new CreateUserRequest().withUserName(userName);

    CreateUserResult response = iamClient.createUser(request);

    return new IAMOperationResponse(
            "Created user " + response.getUser().getUserName(),
            null);
}
 
Example #4
Source File: IdentityManagementImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public User createUser(CreateUserRequest request,
        ResultCapture<CreateUserResult> extractor) {

    ActionResult result = service.performAction("CreateUser", request,
            extractor);

    if (result == null) return null;
    return new UserImpl(result.getResource());
}
 
Example #5
Source File: IdentityManagementImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public User createUser(String userName, ResultCapture<CreateUserResult>
        extractor) {

    CreateUserRequest request = new CreateUserRequest()
        .withUserName(userName);
    return createUser(request, extractor);
}
 
Example #6
Source File: IamIntegrationTest.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Test
@Ignore
public void testCreate() {
    String name = UUID.randomUUID().toString();
    User user = iam.createUser(new CreateUserRequest(name));
    user.delete();
}
 
Example #7
Source File: IdentityManagementImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public User createUser(CreateUserRequest request) {
    return createUser(request, null);
}
 
Example #8
Source File: IdentityManagement.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>CreateUser</code> action.
 *
 * <p>
 *
 * @return The <code>User</code> resource object associated with the result
 *         of this action.
 * @see CreateUserRequest
 */
com.amazonaws.resources.identitymanagement.User createUser(CreateUserRequest
        request);
 
Example #9
Source File: IdentityManagement.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>CreateUser</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 *
 * @return The <code>User</code> resource object associated with the result
 *         of this action.
 * @see CreateUserRequest
 */
com.amazonaws.resources.identitymanagement.User createUser(CreateUserRequest
        request, ResultCapture<CreateUserResult> extractor);