Class User


  • public class User
    extends com.pulumi.resources.CustomResource
    Provides a Cognito User Resource. ## Example Usage ### Basic configuration
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.cognito.UserPool;
     import com.pulumi.aws.cognito.UserPoolArgs;
     import com.pulumi.aws.cognito.User;
     import com.pulumi.aws.cognito.UserArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new UserPool("example", UserPoolArgs.builder()
                 .name("MyExamplePool")
                 .build());
     
             var exampleUser = new User("exampleUser", UserArgs.builder()
                 .userPoolId(example.id())
                 .username("example")
                 .build());
     
         }
     }
     
     
    ### Setting user attributes
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.cognito.UserPool;
     import com.pulumi.aws.cognito.UserPoolArgs;
     import com.pulumi.aws.cognito.inputs.UserPoolSchemaArgs;
     import com.pulumi.aws.cognito.inputs.UserPoolSchemaStringAttributeConstraintsArgs;
     import com.pulumi.aws.cognito.User;
     import com.pulumi.aws.cognito.UserArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new UserPool("example", UserPoolArgs.builder()
                 .schemas(            
                     UserPoolSchemaArgs.builder()
                         .name("example")
                         .attributeDataType("Boolean")
                         .mutable(false)
                         .required(false)
                         .developerOnlyAttribute(false)
                         .build(),
                     UserPoolSchemaArgs.builder()
                         .stringAttributeConstraints(UserPoolSchemaStringAttributeConstraintsArgs.builder()
                             .build())
                         .name("foo")
                         .attributeDataType("String")
                         .mutable(false)
                         .required(false)
                         .developerOnlyAttribute(false)
                         .build())
                 .name("mypool")
                 .build());
     
             var exampleUser = new User("exampleUser", UserArgs.builder()
                 .userPoolId(example.id())
                 .username("example")
                 .attributes(Map.ofEntries(
                     Map.entry("example", "true"),
                     Map.entry("foo", "bar"),
                     Map.entry("email", "no-reply@example.com"),
                     Map.entry("email_verified", "true")
                 ))
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import Cognito User using the `userPoolId`/`name` attributes concatenated. For example: ```sh $ pulumi import aws:cognito/user:User user us-east-1_vG78M4goG/user ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      User​(java.lang.String name)  
      User​(java.lang.String name, UserArgs args)  
      User​(java.lang.String name, UserArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> attributes()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> clientMetadata()  
      com.pulumi.core.Output<java.lang.String> creationDate()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> desiredDeliveryMediums()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enabled()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> forceAliasCreation()  
      static User get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, UserState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> lastModifiedDate()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> messageAction()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> mfaSettingLists()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> password()  
      com.pulumi.core.Output<java.lang.String> preferredMfaSetting()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> status()  
      com.pulumi.core.Output<java.lang.String> sub()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> temporaryPassword()  
      com.pulumi.core.Output<java.lang.String> username()  
      com.pulumi.core.Output<java.lang.String> userPoolId()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> validationData()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • User

        public User​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • User

        public User​(java.lang.String name,
                    UserArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • User

        public User​(java.lang.String name,
                    UserArgs args,
                    @Nullable
                    com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • attributes

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> attributes()
        Returns:
        A map that contains user attributes and attribute values to be set for the user.
      • clientMetadata

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> clientMetadata()
        Returns:
        A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the `clientMetadata` value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see [Customizing User Pool Workflows with Lambda Triggers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html).
      • creationDate

        public com.pulumi.core.Output<java.lang.String> creationDate()
      • desiredDeliveryMediums

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> desiredDeliveryMediums()
        Returns:
        A list of mediums to the welcome message will be sent through. Allowed values are `EMAIL` and `SMS`. If it's provided, make sure you have also specified `email` attribute for the `EMAIL` medium and `phoneNumber` for the `SMS`. More than one value can be specified. Amazon Cognito does not store the `desiredDeliveryMediums` value. Defaults to `["SMS"]`.
      • enabled

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enabled()
        Returns:
        Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the `enabled` value. The behavior can be changed with `messageAction` argument. Defaults to `true`.
      • forceAliasCreation

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> forceAliasCreation()
        Returns:
        If this parameter is set to True and the `phoneNumber` or `email` address specified in the `attributes` parameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store the `forceAliasCreation` value. Defaults to `false`.
      • lastModifiedDate

        public com.pulumi.core.Output<java.lang.String> lastModifiedDate()
      • messageAction

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> messageAction()
        Returns:
        Set to `RESEND` to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set to `SUPPRESS` to suppress sending the message. Only one value can be specified. Amazon Cognito does not store the `messageAction` value.
      • mfaSettingLists

        public com.pulumi.core.Output<java.util.List<java.lang.String>> mfaSettingLists()
      • password

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> password()
        Returns:
        The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only `temporaryPassword` value. You can suppress sending the welcome message with the `messageAction` argument. Amazon Cognito does not store the `password` value. Conflicts with `temporaryPassword`.
      • preferredMfaSetting

        public com.pulumi.core.Output<java.lang.String> preferredMfaSetting()
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • status

        public com.pulumi.core.Output<java.lang.String> status()
        Returns:
        current user status.
      • sub

        public com.pulumi.core.Output<java.lang.String> sub()
        Returns:
        unique user ID that is never reassignable to another user.
      • temporaryPassword

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> temporaryPassword()
        Returns:
        The user's temporary password. Conflicts with `password`.
      • userPoolId

        public com.pulumi.core.Output<java.lang.String> userPoolId()
        Returns:
        The user pool ID for the user pool where the user will be created.
      • username

        public com.pulumi.core.Output<java.lang.String> username()
        Returns:
        The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed. The following arguments are optional:
      • validationData

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> validationData()
        Returns:
        The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the `validationData` value. For more information, see [Customizing User Pool Workflows with Lambda Triggers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html). > **NOTE:** Clearing `password` or `temporaryPassword` does not reset user's password in Cognito.
      • get

        public static User get​(java.lang.String name,
                               com.pulumi.core.Output<java.lang.String> id,
                               @Nullable
                               UserState state,
                               @Nullable
                               com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.