@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
238 lines • 10.5 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.UserPoolClient = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Cognito User Pool Client resource.
*
* To manage a User Pool Client created by another service, such as when [configuring an OpenSearch Domain to use Cognito authentication](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html),
* use the `aws.cognito.ManagedUserPoolClient` resource instead.
*
* ## Example Usage
*
* ### Create a basic user pool client
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pool = new aws.cognito.UserPool("pool", {name: "pool"});
* const client = new aws.cognito.UserPoolClient("client", {
* name: "client",
* userPoolId: pool.id,
* });
* ```
*
* ### Create a user pool client with no SRP authentication
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pool = new aws.cognito.UserPool("pool", {name: "pool"});
* const client = new aws.cognito.UserPoolClient("client", {
* name: "client",
* userPoolId: pool.id,
* generateSecret: true,
* explicitAuthFlows: ["ADMIN_NO_SRP_AUTH"],
* });
* ```
*
* ### Create a user pool client with pinpoint analytics
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const testUserPool = new aws.cognito.UserPool("test", {name: "pool"});
* const testApp = new aws.pinpoint.App("test", {name: "pinpoint"});
* const assumeRole = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: ["cognito-idp.amazonaws.com"],
* }],
* actions: ["sts:AssumeRole"],
* }],
* });
* const testRole = new aws.iam.Role("test", {
* name: "role",
* assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
* });
* const testUserPoolClient = new aws.cognito.UserPoolClient("test", {
* name: "pool_client",
* userPoolId: testUserPool.id,
* analyticsConfiguration: {
* applicationId: testApp.applicationId,
* externalId: "some_id",
* roleArn: testRole.arn,
* userDataShared: true,
* },
* });
* const current = aws.getCallerIdentity({});
* const test = aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* actions: [
* "mobiletargeting:UpdateEndpoint",
* "mobiletargeting:PutEvents",
* ],
* resources: [pulumi.all([current, testApp.applicationId]).apply(([current, applicationId]) => `arn:aws:mobiletargeting:*:${current.accountId}:apps/${applicationId}*`)],
* }],
* });
* const testRolePolicy = new aws.iam.RolePolicy("test", {
* name: "role_policy",
* role: testRole.id,
* policy: test.apply(test => test.json),
* });
* ```
*
* ### Create a user pool client with Cognito as the identity provider
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pool = new aws.cognito.UserPool("pool", {name: "pool"});
* const userpoolClient = new aws.cognito.UserPoolClient("userpool_client", {
* name: "client",
* userPoolId: pool.id,
* callbackUrls: ["https://example.com"],
* allowedOauthFlowsUserPoolClient: true,
* allowedOauthFlows: [
* "code",
* "implicit",
* ],
* allowedOauthScopes: [
* "email",
* "openid",
* ],
* supportedIdentityProviders: ["COGNITO"],
* });
* ```
*
* ### Create a user pool client with refresh token rotation
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const pool = new aws.cognito.UserPool("pool", {name: "pool"});
* const userpoolClient = new aws.cognito.UserPoolClient("userpool_client", {
* name: "client",
* userPoolId: pool.id,
* explicitAuthFlows: ["ADMIN_NO_SRP_AUTH"],
* refreshTokenRotation: {
* feature: "ENABLED",
* retryGracePeriodSeconds: 10,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Cognito User Pool Clients using the `id` of the Cognito User Pool, and the `id` of the Cognito User Pool Client. For example:
*
* ```sh
* $ pulumi import aws:cognito/userPoolClient:UserPoolClient client us-west-2_abc123/3ho4ek12345678909nh3fmhpko
* ```
*/
class UserPoolClient extends pulumi.CustomResource {
/**
* Get an existing UserPoolClient 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 UserPoolClient(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of UserPoolClient. 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'] === UserPoolClient.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessTokenValidity"] = state?.accessTokenValidity;
resourceInputs["allowedOauthFlows"] = state?.allowedOauthFlows;
resourceInputs["allowedOauthFlowsUserPoolClient"] = state?.allowedOauthFlowsUserPoolClient;
resourceInputs["allowedOauthScopes"] = state?.allowedOauthScopes;
resourceInputs["analyticsConfiguration"] = state?.analyticsConfiguration;
resourceInputs["authSessionValidity"] = state?.authSessionValidity;
resourceInputs["callbackUrls"] = state?.callbackUrls;
resourceInputs["clientSecret"] = state?.clientSecret;
resourceInputs["defaultRedirectUri"] = state?.defaultRedirectUri;
resourceInputs["enablePropagateAdditionalUserContextData"] = state?.enablePropagateAdditionalUserContextData;
resourceInputs["enableTokenRevocation"] = state?.enableTokenRevocation;
resourceInputs["explicitAuthFlows"] = state?.explicitAuthFlows;
resourceInputs["generateSecret"] = state?.generateSecret;
resourceInputs["idTokenValidity"] = state?.idTokenValidity;
resourceInputs["logoutUrls"] = state?.logoutUrls;
resourceInputs["name"] = state?.name;
resourceInputs["preventUserExistenceErrors"] = state?.preventUserExistenceErrors;
resourceInputs["readAttributes"] = state?.readAttributes;
resourceInputs["refreshTokenRotation"] = state?.refreshTokenRotation;
resourceInputs["refreshTokenValidity"] = state?.refreshTokenValidity;
resourceInputs["region"] = state?.region;
resourceInputs["supportedIdentityProviders"] = state?.supportedIdentityProviders;
resourceInputs["tokenValidityUnits"] = state?.tokenValidityUnits;
resourceInputs["userPoolId"] = state?.userPoolId;
resourceInputs["writeAttributes"] = state?.writeAttributes;
}
else {
const args = argsOrState;
if (args?.userPoolId === undefined && !opts.urn) {
throw new Error("Missing required property 'userPoolId'");
}
resourceInputs["accessTokenValidity"] = args?.accessTokenValidity;
resourceInputs["allowedOauthFlows"] = args?.allowedOauthFlows;
resourceInputs["allowedOauthFlowsUserPoolClient"] = args?.allowedOauthFlowsUserPoolClient;
resourceInputs["allowedOauthScopes"] = args?.allowedOauthScopes;
resourceInputs["analyticsConfiguration"] = args?.analyticsConfiguration;
resourceInputs["authSessionValidity"] = args?.authSessionValidity;
resourceInputs["callbackUrls"] = args?.callbackUrls;
resourceInputs["defaultRedirectUri"] = args?.defaultRedirectUri;
resourceInputs["enablePropagateAdditionalUserContextData"] = args?.enablePropagateAdditionalUserContextData;
resourceInputs["enableTokenRevocation"] = args?.enableTokenRevocation;
resourceInputs["explicitAuthFlows"] = args?.explicitAuthFlows;
resourceInputs["generateSecret"] = args?.generateSecret;
resourceInputs["idTokenValidity"] = args?.idTokenValidity;
resourceInputs["logoutUrls"] = args?.logoutUrls;
resourceInputs["name"] = args?.name;
resourceInputs["preventUserExistenceErrors"] = args?.preventUserExistenceErrors;
resourceInputs["readAttributes"] = args?.readAttributes;
resourceInputs["refreshTokenRotation"] = args?.refreshTokenRotation;
resourceInputs["refreshTokenValidity"] = args?.refreshTokenValidity;
resourceInputs["region"] = args?.region;
resourceInputs["supportedIdentityProviders"] = args?.supportedIdentityProviders;
resourceInputs["tokenValidityUnits"] = args?.tokenValidityUnits;
resourceInputs["userPoolId"] = args?.userPoolId;
resourceInputs["writeAttributes"] = args?.writeAttributes;
resourceInputs["clientSecret"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["clientSecret"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(UserPoolClient.__pulumiType, name, resourceInputs, opts);
}
}
exports.UserPoolClient = UserPoolClient;
/** @internal */
UserPoolClient.__pulumiType = 'aws:cognito/userPoolClient:UserPoolClient';
//# sourceMappingURL=userPoolClient.js.map