@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
188 lines • 6.82 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.LogDeliveryConfiguration = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an AWS Cognito IDP (Identity Provider) Log Delivery Configuration.
*
* ## Example Usage
*
* ### Basic Usage with CloudWatch Logs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cognito.UserPool("example", {name: "example"});
* const exampleLogGroup = new aws.cloudwatch.LogGroup("example", {name: "example"});
* const exampleLogDeliveryConfiguration = new aws.cognito.LogDeliveryConfiguration("example", {
* userPoolId: example.id,
* logConfigurations: [{
* eventSource: "userNotification",
* logLevel: "ERROR",
* cloudWatchLogsConfiguration: {
* logGroupArn: exampleLogGroup.arn,
* },
* }],
* });
* ```
*
* ### Multiple Log Configurations with Different Destinations
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cognito.UserPool("example", {name: "example"});
* const exampleLogGroup = new aws.cloudwatch.LogGroup("example", {name: "example"});
* const exampleBucket = new aws.s3.Bucket("example", {
* bucket: "example-bucket",
* forceDestroy: true,
* });
* const firehose = new aws.iam.Role("firehose", {
* name: "firehose-role",
* assumeRolePolicy: JSON.stringify({
* Version: "2012-10-17",
* Statement: [{
* Action: "sts:AssumeRole",
* Effect: "Allow",
* Principal: {
* Service: "firehose.amazonaws.com",
* },
* }],
* }),
* });
* const firehoseRolePolicy = new aws.iam.RolePolicy("firehose", {
* name: "firehose-policy",
* role: firehose.id,
* policy: pulumi.jsonStringify({
* Version: "2012-10-17",
* Statement: [{
* Effect: "Allow",
* Action: [
* "s3:AbortMultipartUpload",
* "s3:GetBucketLocation",
* "s3:GetObject",
* "s3:ListBucket",
* "s3:ListBucketMultipartUploads",
* "s3:PutObject",
* ],
* Resource: [
* exampleBucket.arn,
* pulumi.interpolate`${exampleBucket.arn}/*`,
* ],
* }],
* }),
* });
* const exampleFirehoseDeliveryStream = new aws.kinesis.FirehoseDeliveryStream("example", {
* name: "example-stream",
* destination: "extended_s3",
* extendedS3Configuration: {
* roleArn: firehose.arn,
* bucketArn: exampleBucket.arn,
* },
* });
* const exampleLogDeliveryConfiguration = new aws.cognito.LogDeliveryConfiguration("example", {
* userPoolId: example.id,
* logConfigurations: [
* {
* eventSource: "userNotification",
* logLevel: "INFO",
* cloudWatchLogsConfiguration: {
* logGroupArn: exampleLogGroup.arn,
* },
* },
* {
* eventSource: "userAuthEvents",
* logLevel: "ERROR",
* firehoseConfiguration: {
* streamArn: exampleFirehoseDeliveryStream.arn,
* },
* },
* ],
* });
* ```
*
* ### S3 Configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cognito.UserPool("example", {name: "example"});
* const exampleBucket = new aws.s3.Bucket("example", {
* bucket: "example-bucket",
* forceDestroy: true,
* });
* const exampleLogDeliveryConfiguration = new aws.cognito.LogDeliveryConfiguration("example", {
* userPoolId: example.id,
* logConfigurations: [{
* eventSource: "userNotification",
* logLevel: "ERROR",
* s3Configuration: {
* bucketArn: exampleBucket.arn,
* },
* }],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Cognito IDP (Identity Provider) Log Delivery Configuration using the `user_pool_id`. For example:
*
* ```sh
* $ pulumi import aws:cognito/logDeliveryConfiguration:LogDeliveryConfiguration example us-west-2_example123
* ```
*/
class LogDeliveryConfiguration extends pulumi.CustomResource {
/**
* Get an existing LogDeliveryConfiguration 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 LogDeliveryConfiguration(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of LogDeliveryConfiguration. 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'] === LogDeliveryConfiguration.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["logConfigurations"] = state?.logConfigurations;
resourceInputs["region"] = state?.region;
resourceInputs["userPoolId"] = state?.userPoolId;
}
else {
const args = argsOrState;
if (args?.userPoolId === undefined && !opts.urn) {
throw new Error("Missing required property 'userPoolId'");
}
resourceInputs["logConfigurations"] = args?.logConfigurations;
resourceInputs["region"] = args?.region;
resourceInputs["userPoolId"] = args?.userPoolId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LogDeliveryConfiguration.__pulumiType, name, resourceInputs, opts);
}
}
exports.LogDeliveryConfiguration = LogDeliveryConfiguration;
/** @internal */
LogDeliveryConfiguration.__pulumiType = 'aws:cognito/logDeliveryConfiguration:LogDeliveryConfiguration';
//# sourceMappingURL=logDeliveryConfiguration.js.map
;