@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
686 lines • 22.9 kB
JavaScript
"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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PreventionJobTrigger = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* A job trigger configuration.
*
* To get more information about JobTrigger, see:
*
* * [API documentation](https://cloud.google.com/dlp/docs/reference/rest/v2/projects.jobTriggers)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/dlp/docs/creating-job-triggers)
*
* ## Example Usage
*
* ### Dlp Job Trigger Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basic = new gcp.dataloss.PreventionJobTrigger("basic", {
* parent: "projects/my-project-name",
* description: "Description",
* displayName: "Displayname",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset",
* },
* },
* },
* }],
* storageConfig: {
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Bigquery Row Limit
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bigqueryRowLimit = new gcp.dataloss.PreventionJobTrigger("bigquery_row_limit", {
* parent: "projects/my-project-name",
* description: "Description",
* displayName: "Displayname",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset",
* },
* },
* },
* }],
* storageConfig: {
* bigQueryOptions: {
* tableReference: {
* projectId: "project",
* datasetId: "dataset",
* tableId: "table_to_scan",
* },
* rowsLimit: 1000,
* sampleMethod: "RANDOM_START",
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Bigquery Row Limit Percentage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const bigqueryRowLimitPercentage = new gcp.dataloss.PreventionJobTrigger("bigquery_row_limit_percentage", {
* parent: "projects/my-project-name",
* description: "Description",
* displayName: "Displayname",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset",
* },
* },
* },
* }],
* storageConfig: {
* bigQueryOptions: {
* tableReference: {
* projectId: "project",
* datasetId: "dataset",
* tableId: "table_to_scan",
* },
* rowsLimitPercent: 50,
* sampleMethod: "RANDOM_START",
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Job Notification Emails
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const jobNotificationEmails = new gcp.dataloss.PreventionJobTrigger("job_notification_emails", {
* parent: "projects/my-project-name",
* description: "Description for the job_trigger created by terraform",
* displayName: "TerraformDisplayName",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "sample-inspect-template",
* actions: [{
* jobNotificationEmails: {},
* }],
* storageConfig: {
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Deidentify
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.bigquery.Dataset("default", {
* datasetId: "tf_test",
* friendlyName: "terraform-test",
* description: "Description for the dataset created by terraform",
* location: "US",
* defaultTableExpirationMs: 3600000,
* labels: {
* env: "default",
* },
* });
* const defaultTable = new gcp.bigquery.Table("default", {
* datasetId: _default.datasetId,
* tableId: "tf_test",
* deletionProtection: false,
* timePartitioning: {
* type: "DAY",
* },
* labels: {
* env: "default",
* },
* schema: ` [
* {
* \\"name\\": \\"quantity\\",
* \\"type\\": \\"NUMERIC\\",
* \\"mode\\": \\"NULLABLE\\",
* \\"description\\": \\"The quantity\\"
* },
* {
* \\"name\\": \\"name\\",
* \\"type\\": \\"STRING\\",
* \\"mode\\": \\"NULLABLE\\",
* \\"description\\": \\"Name of the object\\"
* }
* ]
* `,
* });
* const deidentify = new gcp.dataloss.PreventionJobTrigger("deidentify", {
* parent: "projects/my-project-name",
* description: "Description for the job_trigger created by terraform",
* displayName: "TerraformDisplayName",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "sample-inspect-template",
* actions: [{
* deidentify: {
* cloudStorageOutput: "gs://samplebucket/dir/",
* fileTypesToTransforms: [
* "CSV",
* "TSV",
* ],
* transformationDetailsStorageConfig: {
* table: {
* projectId: "my-project-name",
* datasetId: _default.datasetId,
* tableId: defaultTable.tableId,
* },
* },
* transformationConfig: {
* deidentifyTemplate: "sample-deidentify-template",
* imageRedactTemplate: "sample-image-redact-template",
* structuredDeidentifyTemplate: "sample-structured-deidentify-template",
* },
* },
* }],
* storageConfig: {
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Hybrid
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const hybridTrigger = new gcp.dataloss.PreventionJobTrigger("hybrid_trigger", {
* parent: "projects/my-project-name",
* triggers: [{
* manual: {},
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset",
* },
* },
* },
* }],
* storageConfig: {
* hybridOptions: {
* description: "Hybrid job trigger for data from the comments field of a table that contains customer appointment bookings",
* requiredFindingLabelKeys: ["appointment-bookings-comments"],
* labels: {
* env: "prod",
* },
* tableOptions: {
* identifyingFields: [{
* name: "booking_id",
* }],
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Inspect
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const inspect = new gcp.dataloss.PreventionJobTrigger("inspect", {
* parent: "projects/my-project-name",
* description: "Description",
* displayName: "Displayname",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset",
* },
* },
* },
* }],
* storageConfig: {
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* inspectConfig: {
* customInfoTypes: [{
* infoType: {
* name: "MY_CUSTOM_TYPE",
* },
* likelihood: "UNLIKELY",
* regex: {
* pattern: "test*",
* },
* }],
* infoTypes: [{
* name: "EMAIL_ADDRESS",
* }],
* minLikelihood: "UNLIKELY",
* ruleSets: [
* {
* infoTypes: [{
* name: "EMAIL_ADDRESS",
* }],
* rules: [{
* exclusionRule: {
* regex: {
* pattern: ".+@example.com",
* },
* matchingType: "MATCHING_TYPE_FULL_MATCH",
* },
* }],
* },
* {
* infoTypes: [{
* name: "MY_CUSTOM_TYPE",
* }],
* rules: [{
* hotwordRule: {
* hotwordRegex: {
* pattern: "example*",
* },
* proximity: {
* windowBefore: 50,
* },
* likelihoodAdjustment: {
* fixedLikelihood: "VERY_LIKELY",
* },
* },
* }],
* },
* ],
* limits: {
* maxFindingsPerItem: 10,
* maxFindingsPerRequest: 50,
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Publish To Stackdriver
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const publishToStackdriver = new gcp.dataloss.PreventionJobTrigger("publish_to_stackdriver", {
* parent: "projects/my-project-name",
* description: "Description for the job_trigger created by terraform",
* displayName: "TerraformDisplayName",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "sample-inspect-template",
* actions: [{
* publishToStackdriver: {},
* }],
* storageConfig: {
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger With Id
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const withTriggerId = new gcp.dataloss.PreventionJobTrigger("with_trigger_id", {
* parent: "projects/my-project-name",
* description: "Starting description",
* displayName: "display",
* triggerId: "id-",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset123",
* },
* },
* },
* }],
* storageConfig: {
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Multiple Actions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basic = new gcp.dataloss.PreventionJobTrigger("basic", {
* parent: "projects/my-project-name",
* description: "Description",
* displayName: "Displayname",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [
* {
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset",
* },
* },
* },
* },
* {
* pubSub: {
* topic: "projects/project/topics/topic-name",
* },
* },
* ],
* storageConfig: {
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Cloud Storage Optional Timespan Autopopulation
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basic = new gcp.dataloss.PreventionJobTrigger("basic", {
* parent: "projects/my-project-name",
* description: "Description",
* displayName: "Displayname",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "fake",
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "dataset",
* },
* },
* },
* }],
* storageConfig: {
* timespanConfig: {
* enableAutoPopulationOfTimespanConfig: true,
* },
* cloudStorageOptions: {
* fileSet: {
* url: "gs://mybucket/directory/",
* },
* },
* },
* },
* });
* ```
* ### Dlp Job Trigger Timespan Config Big Query
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const timespanConfigBigQuery = new gcp.dataloss.PreventionJobTrigger("timespan_config_big_query", {
* parent: "projects/my-project-name",
* description: "BigQuery DLP Job Trigger with timespan config and row limit",
* displayName: "bigquery-dlp-job-trigger-limit-timespan",
* triggers: [{
* schedule: {
* recurrencePeriodDuration: "86400s",
* },
* }],
* inspectJob: {
* inspectTemplateName: "projects/test/locations/global/inspectTemplates/6425492983381733900",
* storageConfig: {
* bigQueryOptions: {
* tableReference: {
* projectId: "project",
* datasetId: "dataset",
* tableId: "table",
* },
* sampleMethod: "",
* },
* timespanConfig: {
* startTime: "2023-01-01T00:00:23Z",
* timestampField: {
* name: "timestamp",
* },
* },
* },
* actions: [{
* saveFindings: {
* outputConfig: {
* table: {
* projectId: "project",
* datasetId: "output",
* },
* },
* },
* }],
* },
* });
* ```
*
* ## Import
*
* JobTrigger can be imported using any of these accepted formats:
*
* * `{{parent}}/jobTriggers/{{name}}`
* * `{{parent}}/{{name}}`
*
* When using the `pulumi import` command, JobTrigger can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:dataloss/preventionJobTrigger:PreventionJobTrigger default {{parent}}/jobTriggers/{{name}}
* $ pulumi import gcp:dataloss/preventionJobTrigger:PreventionJobTrigger default {{parent}}/{{name}}
* ```
*/
class PreventionJobTrigger extends pulumi.CustomResource {
/**
* Get an existing PreventionJobTrigger 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 PreventionJobTrigger(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:dataloss/preventionJobTrigger:PreventionJobTrigger';
/**
* Returns true if the given object is an instance of PreventionJobTrigger. 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'] === PreventionJobTrigger.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["inspectJob"] = state?.inspectJob;
resourceInputs["lastRunTime"] = state?.lastRunTime;
resourceInputs["name"] = state?.name;
resourceInputs["parent"] = state?.parent;
resourceInputs["status"] = state?.status;
resourceInputs["triggerId"] = state?.triggerId;
resourceInputs["triggers"] = state?.triggers;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.parent === undefined && !opts.urn) {
throw new Error("Missing required property 'parent'");
}
if (args?.triggers === undefined && !opts.urn) {
throw new Error("Missing required property 'triggers'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["inspectJob"] = args?.inspectJob;
resourceInputs["parent"] = args?.parent;
resourceInputs["status"] = args?.status;
resourceInputs["triggerId"] = args?.triggerId;
resourceInputs["triggers"] = args?.triggers;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["lastRunTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PreventionJobTrigger.__pulumiType, name, resourceInputs, opts);
}
}
exports.PreventionJobTrigger = PreventionJobTrigger;
//# sourceMappingURL=preventionJobTrigger.js.map