UNPKG

@pulumi/aws

Version:

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

198 lines 7.57 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.DataSource = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for managing QuickSight Data Source * * ## Example Usage * * ### S3 Data Source * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const _default = new aws.quicksight.DataSource("default", { * dataSourceId: "example-id", * name: "My Cool Data in S3", * parameters: { * s3: { * manifestFileLocation: { * bucket: "my-bucket", * key: "path/to/manifest.json", * }, * }, * }, * type: "S3", * }); * ``` * * ### S3 Data Source with IAM Role ARN * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getCallerIdentity({}); * const currentGetPartition = aws.getPartition({}); * const currentGetRegion = aws.getRegion({}); * const example = new aws.s3.Bucket("example", {}); * const exampleBucketObjectv2 = new aws.s3.BucketObjectv2("example", { * bucket: example.bucket, * key: "manifest.json", * content: pulumi.jsonStringify({ * fileLocations: [{ * URIPrefixes: [Promise.all([example.id, currentGetRegion, currentGetPartition]).then(([id, currentGetRegion, currentGetPartition]) => `https://${id}.s3-${currentGetRegion.region}.${currentGetPartition.dnsSuffix}`)], * }], * globalUploadSettings: { * format: "CSV", * delimiter: ",", * textqualifier: "\"", * containsHeader: true, * }, * }), * }); * const exampleRole = new aws.iam.Role("example", { * name: "example", * assumeRolePolicy: JSON.stringify({ * Version: "2012-10-17", * Statement: [{ * Action: "sts:AssumeRole", * Effect: "Allow", * Principal: { * Service: "quicksight.amazonaws.com", * }, * Condition: { * StringEquals: { * "aws:SourceAccount": current.then(current => current.accountId), * }, * }, * }], * }), * }); * const examplePolicy = new aws.iam.Policy("example", { * name: "example", * description: "Policy to allow QuickSight access to S3 bucket", * policy: pulumi.jsonStringify({ * Version: "2012-10-17", * Statement: [ * { * Action: ["s3:GetObject"], * Effect: "Allow", * Resource: pulumi.interpolate`${example.arn}/${exampleBucketObjectv2.key}`, * }, * { * Action: ["s3:ListBucket"], * Effect: "Allow", * Resource: example.arn, * }, * ], * }), * }); * const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", { * policyArn: examplePolicy.arn, * role: exampleRole.name, * }); * const exampleDataSource = new aws.quicksight.DataSource("example", { * dataSourceId: "example-id", * name: "manifest in S3", * parameters: { * s3: { * manifestFileLocation: { * bucket: example.bucket, * key: exampleBucketObjectv2.key, * }, * roleArn: exampleRole.arn, * }, * }, * type: "S3", * }); * ``` * * ## Import * * Using `pulumi import`, import a QuickSight data source using the AWS account ID, and data source ID separated by a slash (`/`). For example: * * ```sh * $ pulumi import aws:quicksight/dataSource:DataSource example 123456789123/my-data-source-id * ``` */ class DataSource extends pulumi.CustomResource { /** * Get an existing DataSource 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 DataSource(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of DataSource. 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'] === DataSource.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["awsAccountId"] = state?.awsAccountId; resourceInputs["credentials"] = state?.credentials; resourceInputs["dataSourceId"] = state?.dataSourceId; resourceInputs["name"] = state?.name; resourceInputs["parameters"] = state?.parameters; resourceInputs["permissions"] = state?.permissions; resourceInputs["region"] = state?.region; resourceInputs["sslProperties"] = state?.sslProperties; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["type"] = state?.type; resourceInputs["vpcConnectionProperties"] = state?.vpcConnectionProperties; } else { const args = argsOrState; if (args?.dataSourceId === undefined && !opts.urn) { throw new Error("Missing required property 'dataSourceId'"); } if (args?.parameters === undefined && !opts.urn) { throw new Error("Missing required property 'parameters'"); } if (args?.type === undefined && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["awsAccountId"] = args?.awsAccountId; resourceInputs["credentials"] = args?.credentials; resourceInputs["dataSourceId"] = args?.dataSourceId; resourceInputs["name"] = args?.name; resourceInputs["parameters"] = args?.parameters; resourceInputs["permissions"] = args?.permissions; resourceInputs["region"] = args?.region; resourceInputs["sslProperties"] = args?.sslProperties; resourceInputs["tags"] = args?.tags; resourceInputs["type"] = args?.type; resourceInputs["vpcConnectionProperties"] = args?.vpcConnectionProperties; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DataSource.__pulumiType, name, resourceInputs, opts); } } exports.DataSource = DataSource; /** @internal */ DataSource.__pulumiType = 'aws:quicksight/dataSource:DataSource'; //# sourceMappingURL=dataSource.js.map