All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.awsnative.cognito.kotlin.UserPool.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.cognito.kotlin

import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolAccountRecoverySetting
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolAddOns
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolAdminCreateUserConfig
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolDeviceConfiguration
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolEmailConfiguration
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolLambdaConfig
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolPolicies
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolSchemaAttribute
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolSmsConfiguration
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolUserAttributeUpdateSettings
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolUsernameConfiguration
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolVerificationMessageTemplate
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolAccountRecoverySetting.Companion.toKotlin as userPoolAccountRecoverySettingToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolAddOns.Companion.toKotlin as userPoolAddOnsToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolAdminCreateUserConfig.Companion.toKotlin as userPoolAdminCreateUserConfigToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolDeviceConfiguration.Companion.toKotlin as userPoolDeviceConfigurationToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolEmailConfiguration.Companion.toKotlin as userPoolEmailConfigurationToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolLambdaConfig.Companion.toKotlin as userPoolLambdaConfigToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolPolicies.Companion.toKotlin as userPoolPoliciesToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolSchemaAttribute.Companion.toKotlin as userPoolSchemaAttributeToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolSmsConfiguration.Companion.toKotlin as userPoolSmsConfigurationToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolUserAttributeUpdateSettings.Companion.toKotlin as userPoolUserAttributeUpdateSettingsToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolUsernameConfiguration.Companion.toKotlin as userPoolUsernameConfigurationToKotlin
import com.pulumi.awsnative.cognito.kotlin.outputs.UserPoolVerificationMessageTemplate.Companion.toKotlin as userPoolVerificationMessageTemplateToKotlin

/**
 * Builder for [UserPool].
 */
@PulumiTagMarker
public class UserPoolResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: UserPoolArgs = UserPoolArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend UserPoolArgsBuilder.() -> Unit) {
        val builder = UserPoolArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): UserPool {
        val builtJavaResource = com.pulumi.awsnative.cognito.UserPool(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return UserPool(builtJavaResource)
    }
}

/**
 * Definition of AWS::Cognito::UserPool Resource Type
 */
public class UserPool internal constructor(
    override val javaResource: com.pulumi.awsnative.cognito.UserPool,
) : KotlinCustomResource(javaResource, UserPoolMapper) {
    /**
     * Use this setting to define which verified available method a user can use to recover their password when they call `ForgotPassword` . It allows you to define a preferred method when a user has more than one method available. With this setting, SMS does not qualify for a valid password recovery mechanism if the user also has SMS MFA enabled. In the absence of this setting, Cognito uses the legacy behavior to determine the recovery method where SMS is preferred over email.
     */
    public val accountRecoverySetting: Output?
        get() = javaResource.accountRecoverySetting().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolAccountRecoverySettingToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The settings for administrator creation of users in a user pool. Contains settings for allowing user sign-up, customizing invitation messages to new users, and the amount of time before temporary passwords expire.
     * This data type is a request and response parameter of [CreateUserPool](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateUserPool.html) and [UpdateUserPool](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UpdateUserPool.html) , and a response parameter of [DescribeUserPool](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_DescribeUserPool.html) .
     */
    public val adminCreateUserConfig: Output?
        get() = javaResource.adminCreateUserConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolAdminCreateUserConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Attributes supported as an alias for this user pool. Possible values: *phone_number* , *email* , or *preferred_username* .
     * > This user pool property cannot be updated.
     */
    public val aliasAttributes: Output>?
        get() = javaResource.aliasAttributes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The Amazon Resource Name (ARN) of the user pool, such as `arn:aws:cognito-idp:us-east-1:123412341234:userpool/us-east-1_123412341` .
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The attributes to be auto-verified. Possible values: *email* , *phone_number* .
     */
    public val autoVerifiedAttributes: Output>?
        get() = javaResource.autoVerifiedAttributes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * When active, `DeletionProtection` prevents accidental deletion of your user
     * pool. Before you can delete a user pool that you have protected against deletion, you
     * must deactivate this feature.
     * When you try to delete a protected user pool in a `DeleteUserPool` API request, Amazon Cognito returns an `InvalidParameterException` error. To delete a protected user pool, send a new `DeleteUserPool` request after you deactivate deletion protection in an `UpdateUserPool` API request.
     */
    public val deletionProtection: Output?
        get() = javaResource.deletionProtection().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The device-remembering configuration for a user pool. A null value indicates that you have deactivated device remembering in your user pool.
     * > When you provide a value for any `DeviceConfiguration` field, you activate the Amazon Cognito device-remembering feature.
     */
    public val deviceConfiguration: Output?
        get() = javaResource.deviceConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolDeviceConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The email configuration of your user pool. The email configuration type sets your preferred sending method, AWS Region, and sender for messages from your user pool.
     */
    public val emailConfiguration: Output?
        get() = javaResource.emailConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolEmailConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * This parameter is no longer used. See [VerificationMessageTemplateType](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerificationMessageTemplateType.html) .
     */
    public val emailVerificationMessage: Output?
        get() = javaResource.emailVerificationMessage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * This parameter is no longer used. See [VerificationMessageTemplateType](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerificationMessageTemplateType.html) .
     */
    public val emailVerificationSubject: Output?
        get() = javaResource.emailVerificationSubject().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Enables MFA on a specified user pool. To disable all MFAs after it has been enabled, set MfaConfiguration to "OFF" and remove EnabledMfas. MFAs can only be all disabled if MfaConfiguration is OFF. Once SMS_MFA is enabled, SMS_MFA can only be disabled by setting MfaConfiguration to "OFF". Can be one of the following values:
     * - `SMS_MFA` - Enables SMS MFA for the user pool. SMS_MFA can only be enabled if SMS configuration is provided.
     * - `SOFTWARE_TOKEN_MFA` - Enables software token MFA for the user pool.
     * Allowed values: `SMS_MFA` | `SOFTWARE_TOKEN_MFA`
     */
    public val enabledMfas: Output>?
        get() = javaResource.enabledMfas().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * A collection of user pool Lambda triggers. Amazon Cognito invokes triggers at several possible stages of authentication operations. Triggers can modify the outcome of the operations that invoked them.
     */
    public val lambdaConfig: Output?
        get() = javaResource.lambdaConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    userPoolLambdaConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The multi-factor authentication (MFA) configuration. Valid values include:
     * - `OFF` MFA won't be used for any users.
     * - `ON` MFA is required for all users to sign in.
     * - `OPTIONAL` MFA will be required only for individual users who have an MFA factor activated.
     */
    public val mfaConfiguration: Output?
        get() = javaResource.mfaConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of user pool policies. Contains the policy that sets password-complexity requirements.
     * This data type is a request and response parameter of [CreateUserPool](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateUserPool.html) and [UpdateUserPool](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_UpdateUserPool.html) , and a response parameter of [DescribeUserPool](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_DescribeUserPool.html) .
     */
    public val policies: Output?
        get() = javaResource.policies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    userPoolPoliciesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The provider name of the Amazon Cognito user pool, specified as a `String` .
     */
    public val providerName: Output
        get() = javaResource.providerName().applyValue({ args0 -> args0 })

    /**
     * The URL of the provider of the Amazon Cognito user pool, specified as a `String` .
     */
    public val providerUrl: Output
        get() = javaResource.providerUrl().applyValue({ args0 -> args0 })

    /**
     * The schema attributes for the new user pool. These attributes can be standard or custom attributes.
     * > During a user pool update, you can add new schema attributes but you cannot modify or delete an existing schema attribute.
     */
    public val schema: Output>?
        get() = javaResource.schema().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> userPoolSchemaAttributeToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * A string representing the SMS authentication message.
     */
    public val smsAuthenticationMessage: Output?
        get() = javaResource.smsAuthenticationMessage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your AWS account through Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the AWS Region that you want, the Amazon Cognito user pool uses an AWS Identity and Access Management (IAM) role in your AWS account .
     */
    public val smsConfiguration: Output?
        get() = javaResource.smsConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolSmsConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * This parameter is no longer used. See [VerificationMessageTemplateType](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_VerificationMessageTemplateType.html) .
     */
    public val smsVerificationMessage: Output?
        get() = javaResource.smsVerificationMessage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The settings for updates to user attributes. These settings include the property `AttributesRequireVerificationBeforeUpdate` ,
     * a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For
     * more information, see [Verifying updates to email addresses and phone numbers](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html#user-pool-settings-verifications-verify-attribute-updates) .
     */
    public val userAttributeUpdateSettings: Output?
        get() = javaResource.userAttributeUpdateSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolUserAttributeUpdateSettingsToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * User pool add-ons. Contains settings for activation of advanced security features. To log user security information but take no action, set to `AUDIT` . To configure automatic security responses to risky traffic to your user pool, set to `ENFORCED` .
     * For more information, see [Adding advanced security to a user pool](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html) .
     */
    public val userPoolAddOns: Output?
        get() = javaResource.userPoolAddOns().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolAddOnsToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The ID of the user pool.
     */
    public val userPoolId: Output
        get() = javaResource.userPoolId().applyValue({ args0 -> args0 })

    /**
     * A string used to name the user pool.
     */
    public val userPoolName: Output?
        get() = javaResource.userPoolName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.
     */
    public val userPoolTags: Output>?
        get() = javaResource.userPoolTags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Determines whether email addresses or phone numbers can be specified as user names when a user signs up. Possible values: `phone_number` or `email` .
     * This user pool property cannot be updated.
     */
    public val usernameAttributes: Output>?
        get() = javaResource.usernameAttributes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * You can choose to set case sensitivity on the username input for the selected sign-in option. For example, when this is set to `False` , users will be able to sign in using either "username" or "Username". This configuration is immutable once it has been set.
     */
    public val usernameConfiguration: Output?
        get() = javaResource.usernameConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolUsernameConfigurationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The template for the verification message that your user pool delivers to users who set an email address or phone number attribute.
     * Set the email message type that corresponds to your `DefaultEmailOption` selection. For `CONFIRM_WITH_LINK` , specify an `EmailMessageByLink` and leave `EmailMessage` blank. For `CONFIRM_WITH_CODE` , specify an `EmailMessage` and leave `EmailMessageByLink` blank. When you supply both parameters with either choice, Amazon Cognito returns an error.
     */
    public val verificationMessageTemplate: Output?
        get() = javaResource.verificationMessageTemplate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> userPoolVerificationMessageTemplateToKotlin(args0) })
            }).orElse(null)
        })
}

public object UserPoolMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.cognito.UserPool::class == javaResource::class

    override fun map(javaResource: Resource): UserPool = UserPool(
        javaResource as
            com.pulumi.awsnative.cognito.UserPool,
    )
}

/**
 * @see [UserPool].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [UserPool].
 */
public suspend fun userPool(name: String, block: suspend UserPoolResourceBuilder.() -> Unit): UserPool {
    val builder = UserPoolResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [UserPool].
 * @param name The _unique_ name of the resulting resource.
 */
public fun userPool(name: String): UserPool {
    val builder = UserPoolResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy