UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

155 lines 6.35 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.User = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a Cognito User Resource. * * ## Example Usage * * ### Basic configuration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.cognito.UserPool("example", {name: "MyExamplePool"}); * const exampleUser = new aws.cognito.User("example", { * userPoolId: example.id, * username: "example", * }); * ``` * * ### Setting user attributes * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.cognito.UserPool("example", { * name: "mypool", * schemas: [ * { * name: "example", * attributeDataType: "Boolean", * mutable: false, * required: false, * developerOnlyAttribute: false, * }, * { * name: "foo", * attributeDataType: "String", * mutable: false, * required: false, * developerOnlyAttribute: false, * stringAttributeConstraints: {}, * }, * ], * }); * const exampleUser = new aws.cognito.User("example", { * userPoolId: example.id, * username: "example", * attributes: { * example: "true", * foo: "bar", * email: "no-reply@example.com", * email_verified: "true", * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Cognito User using the `user_pool_id`/`name` attributes concatenated. For example: * * ```sh * $ pulumi import aws:cognito/user:User user us-east-1_vG78M4goG/user * ``` */ class User extends pulumi.CustomResource { /** * Get an existing User resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new User(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of User. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === User.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["attributes"] = state?.attributes; resourceInputs["clientMetadata"] = state?.clientMetadata; resourceInputs["creationDate"] = state?.creationDate; resourceInputs["desiredDeliveryMediums"] = state?.desiredDeliveryMediums; resourceInputs["enabled"] = state?.enabled; resourceInputs["forceAliasCreation"] = state?.forceAliasCreation; resourceInputs["lastModifiedDate"] = state?.lastModifiedDate; resourceInputs["messageAction"] = state?.messageAction; resourceInputs["mfaSettingLists"] = state?.mfaSettingLists; resourceInputs["password"] = state?.password; resourceInputs["preferredMfaSetting"] = state?.preferredMfaSetting; resourceInputs["region"] = state?.region; resourceInputs["status"] = state?.status; resourceInputs["sub"] = state?.sub; resourceInputs["temporaryPassword"] = state?.temporaryPassword; resourceInputs["userPoolId"] = state?.userPoolId; resourceInputs["username"] = state?.username; resourceInputs["validationData"] = state?.validationData; } else { const args = argsOrState; if (args?.userPoolId === undefined && !opts.urn) { throw new Error("Missing required property 'userPoolId'"); } if (args?.username === undefined && !opts.urn) { throw new Error("Missing required property 'username'"); } resourceInputs["attributes"] = args?.attributes; resourceInputs["clientMetadata"] = args?.clientMetadata; resourceInputs["desiredDeliveryMediums"] = args?.desiredDeliveryMediums; resourceInputs["enabled"] = args?.enabled; resourceInputs["forceAliasCreation"] = args?.forceAliasCreation; resourceInputs["messageAction"] = args?.messageAction; resourceInputs["password"] = args?.password ? pulumi.secret(args.password) : undefined; resourceInputs["region"] = args?.region; resourceInputs["temporaryPassword"] = args?.temporaryPassword ? pulumi.secret(args.temporaryPassword) : undefined; resourceInputs["userPoolId"] = args?.userPoolId; resourceInputs["username"] = args?.username; resourceInputs["validationData"] = args?.validationData; resourceInputs["creationDate"] = undefined /*out*/; resourceInputs["lastModifiedDate"] = undefined /*out*/; resourceInputs["mfaSettingLists"] = undefined /*out*/; resourceInputs["preferredMfaSetting"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["sub"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["password", "temporaryPassword"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(User.__pulumiType, name, resourceInputs, opts); } } exports.User = User; /** @internal */ User.__pulumiType = 'aws:cognito/user:User'; //# sourceMappingURL=user.js.map