@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
349 lines • 13.4 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Datascan = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a user-visible job which provides the insights for the related data source.
*
* To get more information about Datascan, see:
*
* * [API documentation](https://cloud.google.com/dataplex/docs/reference/rest)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dataplex/docs)
*
* ## Example Usage
*
* ### Dataplex Datascan Basic Profile
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicProfile = new gcp.dataplex.Datascan("basic_profile", {
* location: "us-central1",
* dataScanId: "dataprofile-basic",
* data: {
* resource: "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare",
* },
* executionSpec: {
* trigger: {
* onDemand: {},
* },
* },
* dataProfileSpec: {},
* project: "my-project-name",
* });
* ```
* ### Dataplex Datascan Full Profile
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const source = new gcp.bigquery.Dataset("source", {
* datasetId: "dataplex_dataset",
* friendlyName: "test",
* description: "This is a test description",
* location: "US",
* deleteContentsOnDestroy: true,
* });
* const fullProfile = new gcp.dataplex.Datascan("full_profile", {
* location: "us-central1",
* displayName: "Full Datascan Profile",
* dataScanId: "dataprofile-full",
* description: "Example resource - Full Datascan Profile",
* labels: {
* author: "billing",
* },
* data: {
* resource: "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare",
* },
* executionSpec: {
* trigger: {
* schedule: {
* cron: "TZ=America/New_York 1 1 * * *",
* },
* },
* },
* dataProfileSpec: {
* samplingPercent: 80,
* rowFilter: "word_count > 10",
* includeFields: {
* fieldNames: ["word_count"],
* },
* excludeFields: {
* fieldNames: ["property_type"],
* },
* postScanActions: {
* bigqueryExport: {
* resultsTable: "//bigquery.googleapis.com/projects/my-project-name/datasets/dataplex_dataset/tables/profile_export",
* },
* },
* },
* project: "my-project-name",
* }, {
* dependsOn: [source],
* });
* ```
* ### Dataplex Datascan Basic Quality
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicQuality = new gcp.dataplex.Datascan("basic_quality", {
* location: "us-central1",
* dataScanId: "dataquality-basic",
* data: {
* resource: "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/samples/tables/shakespeare",
* },
* executionSpec: {
* trigger: {
* onDemand: {},
* },
* },
* dataQualitySpec: {
* rules: [{
* dimension: "VALIDITY",
* name: "rule1",
* description: "rule 1 for validity dimension",
* tableConditionExpectation: {
* sqlExpression: "COUNT(*) > 0",
* },
* }],
* },
* project: "my-project-name",
* });
* ```
* ### Dataplex Datascan Full Quality
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const fullQuality = new gcp.dataplex.Datascan("full_quality", {
* location: "us-central1",
* displayName: "Full Datascan Quality",
* dataScanId: "dataquality-full",
* description: "Example resource - Full Datascan Quality",
* labels: {
* author: "billing",
* },
* data: {
* resource: "//bigquery.googleapis.com/projects/bigquery-public-data/datasets/austin_bikeshare/tables/bikeshare_stations",
* },
* executionSpec: {
* trigger: {
* schedule: {
* cron: "TZ=America/New_York 1 1 * * *",
* },
* },
* field: "modified_date",
* },
* dataQualitySpec: {
* samplingPercent: 5,
* rowFilter: "station_id > 1000",
* rules: [
* {
* column: "address",
* dimension: "VALIDITY",
* threshold: 0.99,
* nonNullExpectation: {},
* },
* {
* column: "council_district",
* dimension: "VALIDITY",
* ignoreNull: true,
* threshold: 0.9,
* rangeExpectation: {
* minValue: "1",
* maxValue: "10",
* strictMinEnabled: true,
* strictMaxEnabled: false,
* },
* },
* {
* column: "power_type",
* dimension: "VALIDITY",
* ignoreNull: false,
* regexExpectation: {
* regex: ".*solar.*",
* },
* },
* {
* column: "property_type",
* dimension: "VALIDITY",
* ignoreNull: false,
* setExpectation: {
* values: [
* "sidewalk",
* "parkland",
* ],
* },
* },
* {
* column: "address",
* dimension: "UNIQUENESS",
* uniquenessExpectation: {},
* },
* {
* column: "number_of_docks",
* dimension: "VALIDITY",
* statisticRangeExpectation: {
* statistic: "MEAN",
* minValue: "5",
* maxValue: "15",
* strictMinEnabled: true,
* strictMaxEnabled: true,
* },
* },
* {
* column: "footprint_length",
* dimension: "VALIDITY",
* rowConditionExpectation: {
* sqlExpression: "footprint_length > 0 AND footprint_length <= 10",
* },
* },
* {
* dimension: "VALIDITY",
* tableConditionExpectation: {
* sqlExpression: "COUNT(*) > 0",
* },
* },
* {
* dimension: "VALIDITY",
* sqlAssertion: {
* sqlStatement: "select * from bigquery-public-data.austin_bikeshare.bikeshare_stations where station_id is null",
* },
* },
* ],
* },
* project: "my-project-name",
* });
* ```
*
* ## Import
*
* Datascan can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/dataScans/{{data_scan_id}}`
*
* * `{{project}}/{{location}}/{{data_scan_id}}`
*
* * `{{location}}/{{data_scan_id}}`
*
* * `{{data_scan_id}}`
*
* When using the `pulumi import` command, Datascan can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:dataplex/datascan:Datascan default projects/{{project}}/locations/{{location}}/dataScans/{{data_scan_id}}
* ```
*
* ```sh
* $ pulumi import gcp:dataplex/datascan:Datascan default {{project}}/{{location}}/{{data_scan_id}}
* ```
*
* ```sh
* $ pulumi import gcp:dataplex/datascan:Datascan default {{location}}/{{data_scan_id}}
* ```
*
* ```sh
* $ pulumi import gcp:dataplex/datascan:Datascan default {{data_scan_id}}
* ```
*/
class Datascan extends pulumi.CustomResource {
/**
* Get an existing Datascan 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 Datascan(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Datascan. 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'] === Datascan.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["data"] = state ? state.data : undefined;
resourceInputs["dataProfileSpec"] = state ? state.dataProfileSpec : undefined;
resourceInputs["dataQualitySpec"] = state ? state.dataQualitySpec : undefined;
resourceInputs["dataScanId"] = state ? state.dataScanId : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["executionSpec"] = state ? state.executionSpec : undefined;
resourceInputs["executionStatuses"] = state ? state.executionStatuses : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["uid"] = state ? state.uid : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.data === undefined) && !opts.urn) {
throw new Error("Missing required property 'data'");
}
if ((!args || args.dataScanId === undefined) && !opts.urn) {
throw new Error("Missing required property 'dataScanId'");
}
if ((!args || args.executionSpec === undefined) && !opts.urn) {
throw new Error("Missing required property 'executionSpec'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["data"] = args ? args.data : undefined;
resourceInputs["dataProfileSpec"] = args ? args.dataProfileSpec : undefined;
resourceInputs["dataQualitySpec"] = args ? args.dataQualitySpec : undefined;
resourceInputs["dataScanId"] = args ? args.dataScanId : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["executionSpec"] = args ? args.executionSpec : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["executionStatuses"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Datascan.__pulumiType, name, resourceInputs, opts);
}
}
exports.Datascan = Datascan;
/** @internal */
Datascan.__pulumiType = 'gcp:dataplex/datascan:Datascan';
//# sourceMappingURL=datascan.js.map