@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
224 lines • 9.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.DataExchangeSubscription = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A Bigquery Analytics Hub Data Exchange subscription
*
* To get more information about DataExchangeSubscription, see:
*
* * [API documentation](https://cloud.google.com/bigquery/docs/reference/analytics-hub/rest/v1/projects.locations.subscriptions)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/bigquery/docs/analytics-hub-introduction)
*
* > **Note:** When importing the resource with `pulumi import`, provide the destination/subscriber's project and location
* in the format projects/{{subscriber_project}}/locations/{{subscriber_location}}/subscriptions/{{subscription_id}}
* ## Example Usage
*
* ### Bigquery Analyticshub Dataexchange Subscription Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const subscription = new gcp.bigqueryanalyticshub.DataExchange("subscription", {
* location: "us",
* dataExchangeId: "my_test_dataexchange",
* displayName: "my_test_dataexchange",
* description: "Test Data Exchange",
* sharingEnvironmentConfig: {
* dcrExchangeConfig: {},
* },
* });
* const subscriptionDataset = new gcp.bigquery.Dataset("subscription", {
* datasetId: "listing_src_dataset",
* friendlyName: "listing_src_dataset",
* description: "Dataset for Listing",
* location: "us",
* });
* const subscriptionTable = new gcp.bigquery.Table("subscription", {
* deletionProtection: false,
* tableId: "listing_src_table",
* datasetId: subscriptionDataset.datasetId,
* schema: `[
* {
* "name": "name",
* "type": "STRING",
* "mode": "NULLABLE"
* },
* {
* "name": "post_abbr",
* "type": "STRING",
* "mode": "NULLABLE"
* },
* {
* "name": "date",
* "type": "DATE",
* "mode": "NULLABLE"
* }
* ]
* `,
* });
* const subscriptionListing = new gcp.bigqueryanalyticshub.Listing("subscription", {
* location: "us",
* dataExchangeId: subscription.dataExchangeId,
* listingId: "my_test_listing",
* displayName: "my_test_listing",
* description: "Test Listing",
* restrictedExportConfig: {
* enabled: true,
* },
* bigqueryDataset: {
* dataset: subscriptionDataset.id,
* selectedResources: [{
* table: subscriptionTable.id,
* }],
* },
* });
* const subscriptionDataExchangeSubscription = new gcp.bigqueryanalyticshub.DataExchangeSubscription("subscription", {
* project: subscriptionDataset.project,
* location: "us",
* dataExchangeProject: subscription.project,
* dataExchangeLocation: subscription.location,
* dataExchangeId: subscription.dataExchangeId,
* subscriptionId: "my_subscription_id",
* subscriberContact: "testuser@example.com",
* destinationDataset: {
* location: "us",
* datasetReference: {
* projectId: subscriptionDataset.project,
* datasetId: "subscribed_dest_dataset",
* },
* friendlyName: "Subscribed Destination Dataset",
* description: "Destination dataset for subscription",
* labels: {
* environment: "development",
* owner: "team-a",
* },
* },
* refreshPolicy: "ON_READ",
* });
* ```
*
* ## Import
*
* DataExchangeSubscription can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/subscriptions/{{subscription_id}}`
*
* * `{{project}}/{{location}}/{{subscription_id}}`
*
* * `{{location}}/{{subscription_id}}`
*
* When using the `pulumi import` command, DataExchangeSubscription can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:bigqueryanalyticshub/dataExchangeSubscription:DataExchangeSubscription default projects/{{project}}/locations/{{location}}/subscriptions/{{subscription_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigqueryanalyticshub/dataExchangeSubscription:DataExchangeSubscription default {{project}}/{{location}}/{{subscription_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigqueryanalyticshub/dataExchangeSubscription:DataExchangeSubscription default {{location}}/{{subscription_id}}
* ```
*/
class DataExchangeSubscription extends pulumi.CustomResource {
/**
* Get an existing DataExchangeSubscription 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 DataExchangeSubscription(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of DataExchangeSubscription. 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'] === DataExchangeSubscription.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["creationTime"] = state?.creationTime;
resourceInputs["dataExchange"] = state?.dataExchange;
resourceInputs["dataExchangeId"] = state?.dataExchangeId;
resourceInputs["dataExchangeLocation"] = state?.dataExchangeLocation;
resourceInputs["dataExchangeProject"] = state?.dataExchangeProject;
resourceInputs["destinationDataset"] = state?.destinationDataset;
resourceInputs["lastModifyTime"] = state?.lastModifyTime;
resourceInputs["linkedDatasetMaps"] = state?.linkedDatasetMaps;
resourceInputs["linkedResources"] = state?.linkedResources;
resourceInputs["location"] = state?.location;
resourceInputs["logLinkedDatasetQueryUserEmail"] = state?.logLinkedDatasetQueryUserEmail;
resourceInputs["name"] = state?.name;
resourceInputs["organizationDisplayName"] = state?.organizationDisplayName;
resourceInputs["organizationId"] = state?.organizationId;
resourceInputs["project"] = state?.project;
resourceInputs["refreshPolicy"] = state?.refreshPolicy;
resourceInputs["resourceType"] = state?.resourceType;
resourceInputs["state"] = state?.state;
resourceInputs["subscriberContact"] = state?.subscriberContact;
resourceInputs["subscriptionId"] = state?.subscriptionId;
}
else {
const args = argsOrState;
if (args?.dataExchangeId === undefined && !opts.urn) {
throw new Error("Missing required property 'dataExchangeId'");
}
if (args?.dataExchangeLocation === undefined && !opts.urn) {
throw new Error("Missing required property 'dataExchangeLocation'");
}
if (args?.dataExchangeProject === undefined && !opts.urn) {
throw new Error("Missing required property 'dataExchangeProject'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.subscriptionId === undefined && !opts.urn) {
throw new Error("Missing required property 'subscriptionId'");
}
resourceInputs["dataExchangeId"] = args?.dataExchangeId;
resourceInputs["dataExchangeLocation"] = args?.dataExchangeLocation;
resourceInputs["dataExchangeProject"] = args?.dataExchangeProject;
resourceInputs["destinationDataset"] = args?.destinationDataset;
resourceInputs["location"] = args?.location;
resourceInputs["project"] = args?.project;
resourceInputs["refreshPolicy"] = args?.refreshPolicy;
resourceInputs["subscriberContact"] = args?.subscriberContact;
resourceInputs["subscriptionId"] = args?.subscriptionId;
resourceInputs["creationTime"] = undefined /*out*/;
resourceInputs["dataExchange"] = undefined /*out*/;
resourceInputs["lastModifyTime"] = undefined /*out*/;
resourceInputs["linkedDatasetMaps"] = undefined /*out*/;
resourceInputs["linkedResources"] = undefined /*out*/;
resourceInputs["logLinkedDatasetQueryUserEmail"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["organizationDisplayName"] = undefined /*out*/;
resourceInputs["organizationId"] = undefined /*out*/;
resourceInputs["resourceType"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DataExchangeSubscription.__pulumiType, name, resourceInputs, opts);
}
}
exports.DataExchangeSubscription = DataExchangeSubscription;
/** @internal */
DataExchangeSubscription.__pulumiType = 'gcp:bigqueryanalyticshub/dataExchangeSubscription:DataExchangeSubscription';
//# sourceMappingURL=dataExchangeSubscription.js.map
;