UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

665 lines • 22.1 kB
"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.PreventionJobTrigger = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = 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}} * ``` * * ```sh * $ 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.createTime : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["inspectJob"] = state ? state.inspectJob : undefined; resourceInputs["lastRunTime"] = state ? state.lastRunTime : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["parent"] = state ? state.parent : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["triggerId"] = state ? state.triggerId : undefined; resourceInputs["triggers"] = state ? state.triggers : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; } else { const args = argsOrState; if ((!args || args.parent === undefined) && !opts.urn) { throw new Error("Missing required property 'parent'"); } if ((!args || args.triggers === undefined) && !opts.urn) { throw new Error("Missing required property 'triggers'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["inspectJob"] = args ? args.inspectJob : undefined; resourceInputs["parent"] = args ? args.parent : undefined; resourceInputs["status"] = args ? args.status : undefined; resourceInputs["triggerId"] = args ? args.triggerId : undefined; resourceInputs["triggers"] = args ? args.triggers : undefined; 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; /** @internal */ PreventionJobTrigger.__pulumiType = 'gcp:dataloss/preventionJobTrigger:PreventionJobTrigger'; //# sourceMappingURL=preventionJobTrigger.js.map