UNPKG

@pulumi/aws

Version:

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

198 lines • 8.07 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: [pulumi.all([example.id, currentGetRegion, currentGetPartition]).apply(([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, Object.assign(Object.assign({}, 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 ? state.arn : undefined; resourceInputs["awsAccountId"] = state ? state.awsAccountId : undefined; resourceInputs["credentials"] = state ? state.credentials : undefined; resourceInputs["dataSourceId"] = state ? state.dataSourceId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["parameters"] = state ? state.parameters : undefined; resourceInputs["permissions"] = state ? state.permissions : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["sslProperties"] = state ? state.sslProperties : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["vpcConnectionProperties"] = state ? state.vpcConnectionProperties : undefined; } else { const args = argsOrState; if ((!args || args.dataSourceId === undefined) && !opts.urn) { throw new Error("Missing required property 'dataSourceId'"); } if ((!args || args.parameters === undefined) && !opts.urn) { throw new Error("Missing required property 'parameters'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["awsAccountId"] = args ? args.awsAccountId : undefined; resourceInputs["credentials"] = args ? args.credentials : undefined; resourceInputs["dataSourceId"] = args ? args.dataSourceId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["parameters"] = args ? args.parameters : undefined; resourceInputs["permissions"] = args ? args.permissions : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["sslProperties"] = args ? args.sslProperties : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["vpcConnectionProperties"] = args ? args.vpcConnectionProperties : undefined; 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