@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
212 lines • 7.92 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.SessionLogger = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for managing an AWS WorkSpaces Web Session Logger.
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const exampleBucket = new aws.s3.Bucket("example", {bucket: "example-session-logs"});
* const example = aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: ["workspaces-web.amazonaws.com"],
* }],
* actions: ["s3:PutObject"],
* resources: [pulumi.interpolate`${exampleBucket.arn}/*`],
* }],
* });
* const exampleBucketPolicy = new aws.s3.BucketPolicy("example", {
* bucket: exampleBucket.id,
* policy: example.apply(example => example.json),
* });
* const exampleSessionLogger = new aws.workspacesweb.SessionLogger("example", {
* displayName: "example-session-logger",
* eventFilter: {
* all: {},
* },
* logConfiguration: {
* s3: {
* bucket: exampleBucket.id,
* folderStructure: "Flat",
* logFileFormat: "Json",
* },
* },
* }, {
* dependsOn: [exampleBucketPolicy],
* });
* ```
*
* ### Complete Configuration with KMS Encryption
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const exampleBucket = new aws.s3.Bucket("example", {
* bucket: "example-session-logs",
* forceDestroy: true,
* });
* const example = aws.iam.getPolicyDocumentOutput({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: ["workspaces-web.amazonaws.com"],
* }],
* actions: ["s3:PutObject"],
* resources: [
* exampleBucket.arn,
* pulumi.interpolate`${exampleBucket.arn}/*`,
* ],
* }],
* });
* const exampleBucketPolicy = new aws.s3.BucketPolicy("example", {
* bucket: exampleBucket.id,
* policy: example.apply(example => example.json),
* });
* const current = aws.getPartition({});
* const currentGetCallerIdentity = aws.getCallerIdentity({});
* const kmsKeyPolicy = Promise.all([current, currentGetCallerIdentity]).then(([current, currentGetCallerIdentity]) => aws.iam.getPolicyDocument({
* statements: [
* {
* principals: [{
* type: "AWS",
* identifiers: [`arn:${current.partition}:iam::${currentGetCallerIdentity.accountId}:root`],
* }],
* actions: ["kms:*"],
* resources: ["*"],
* },
* {
* principals: [{
* type: "Service",
* identifiers: ["workspaces-web.amazonaws.com"],
* }],
* actions: [
* "kms:Encrypt",
* "kms:GenerateDataKey*",
* "kms:ReEncrypt*",
* "kms:Decrypt",
* ],
* resources: ["*"],
* },
* ],
* }));
* const exampleKey = new aws.kms.Key("example", {
* description: "KMS key for WorkSpaces Web Session Logger",
* policy: kmsKeyPolicy.then(kmsKeyPolicy => kmsKeyPolicy.json),
* });
* const exampleSessionLogger = new aws.workspacesweb.SessionLogger("example", {
* displayName: "example-session-logger",
* customerManagedKey: exampleKey.arn,
* additionalEncryptionContext: {
* Environment: "Production",
* Application: "WorkSpacesWeb",
* },
* eventFilter: {
* includes: [
* "SessionStart",
* "SessionEnd",
* ],
* },
* logConfiguration: {
* s3: {
* bucket: exampleBucket.id,
* bucketOwner: currentGetCallerIdentity.then(currentGetCallerIdentity => currentGetCallerIdentity.accountId),
* folderStructure: "NestedByDate",
* keyPrefix: "workspaces-web-logs/",
* logFileFormat: "JsonLines",
* },
* },
* tags: {
* Name: "example-session-logger",
* Environment: "Production",
* },
* }, {
* dependsOn: [
* exampleBucketPolicy,
* exampleKey,
* ],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import WorkSpaces Web Session Logger using the `session_logger_arn`. For example:
*
* ```sh
* $ pulumi import aws:workspacesweb/sessionLogger:SessionLogger example arn:aws:workspaces-web:us-west-2:123456789012:sessionLogger/session_logger-id-12345678
* ```
*/
class SessionLogger extends pulumi.CustomResource {
/**
* Get an existing SessionLogger 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 SessionLogger(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SessionLogger. 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'] === SessionLogger.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["additionalEncryptionContext"] = state?.additionalEncryptionContext;
resourceInputs["associatedPortalArns"] = state?.associatedPortalArns;
resourceInputs["customerManagedKey"] = state?.customerManagedKey;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["eventFilter"] = state?.eventFilter;
resourceInputs["logConfiguration"] = state?.logConfiguration;
resourceInputs["region"] = state?.region;
resourceInputs["sessionLoggerArn"] = state?.sessionLoggerArn;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
resourceInputs["additionalEncryptionContext"] = args?.additionalEncryptionContext;
resourceInputs["customerManagedKey"] = args?.customerManagedKey;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["eventFilter"] = args?.eventFilter;
resourceInputs["logConfiguration"] = args?.logConfiguration;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["associatedPortalArns"] = undefined /*out*/;
resourceInputs["sessionLoggerArn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SessionLogger.__pulumiType, name, resourceInputs, opts);
}
}
exports.SessionLogger = SessionLogger;
/** @internal */
SessionLogger.__pulumiType = 'aws:workspacesweb/sessionLogger:SessionLogger';
//# sourceMappingURL=sessionLogger.js.map