@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
155 lines • 7.02 kB
JavaScript
;
// *** 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, Object.assign(Object.assign({}, 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 ? state.attributes : undefined;
resourceInputs["clientMetadata"] = state ? state.clientMetadata : undefined;
resourceInputs["creationDate"] = state ? state.creationDate : undefined;
resourceInputs["desiredDeliveryMediums"] = state ? state.desiredDeliveryMediums : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["forceAliasCreation"] = state ? state.forceAliasCreation : undefined;
resourceInputs["lastModifiedDate"] = state ? state.lastModifiedDate : undefined;
resourceInputs["messageAction"] = state ? state.messageAction : undefined;
resourceInputs["mfaSettingLists"] = state ? state.mfaSettingLists : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["preferredMfaSetting"] = state ? state.preferredMfaSetting : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["sub"] = state ? state.sub : undefined;
resourceInputs["temporaryPassword"] = state ? state.temporaryPassword : undefined;
resourceInputs["userPoolId"] = state ? state.userPoolId : undefined;
resourceInputs["username"] = state ? state.username : undefined;
resourceInputs["validationData"] = state ? state.validationData : undefined;
}
else {
const args = argsOrState;
if ((!args || args.userPoolId === undefined) && !opts.urn) {
throw new Error("Missing required property 'userPoolId'");
}
if ((!args || args.username === undefined) && !opts.urn) {
throw new Error("Missing required property 'username'");
}
resourceInputs["attributes"] = args ? args.attributes : undefined;
resourceInputs["clientMetadata"] = args ? args.clientMetadata : undefined;
resourceInputs["desiredDeliveryMediums"] = args ? args.desiredDeliveryMediums : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["forceAliasCreation"] = args ? args.forceAliasCreation : undefined;
resourceInputs["messageAction"] = args ? args.messageAction : undefined;
resourceInputs["password"] = (args === null || args === void 0 ? void 0 : args.password) ? pulumi.secret(args.password) : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["temporaryPassword"] = (args === null || args === void 0 ? void 0 : args.temporaryPassword) ? pulumi.secret(args.temporaryPassword) : undefined;
resourceInputs["userPoolId"] = args ? args.userPoolId : undefined;
resourceInputs["username"] = args ? args.username : undefined;
resourceInputs["validationData"] = args ? args.validationData : undefined;
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