UNPKG

@pulumi/gcp

Version:

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

766 lines (765 loc) • 24.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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}} * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: PreventionJobTriggerState, opts?: pulumi.CustomResourceOptions): 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: any): obj is PreventionJobTrigger; /** * The creation timestamp of an inspectTemplate. Set by the server. */ readonly createTime: pulumi.Output<string>; /** * A description of the job trigger. */ readonly description: pulumi.Output<string | undefined>; /** * User set display name of the job trigger. */ readonly displayName: pulumi.Output<string | undefined>; /** * Controls what and how to inspect for findings. * Structure is documented below. */ readonly inspectJob: pulumi.Output<outputs.dataloss.PreventionJobTriggerInspectJob | undefined>; /** * The timestamp of the last time this trigger executed. */ readonly lastRunTime: pulumi.Output<string>; /** * The resource name of the job trigger. Set by the server. */ readonly name: pulumi.Output<string>; /** * The parent of the trigger, either in the format `projects/{{project}}` * or `projects/{{project}}/locations/{{location}}` */ readonly parent: pulumi.Output<string>; /** * Whether the trigger is currently active. * Default value is `HEALTHY`. * Possible values are: `PAUSED`, `HEALTHY`, `CANCELLED`. */ readonly status: pulumi.Output<string | undefined>; /** * The trigger id can contain uppercase and lowercase letters, numbers, and hyphens; * that is, it must match the regular expression: [a-zA-Z\d-_]+. * The maximum length is 100 characters. Can be empty to allow the system to generate one. */ readonly triggerId: pulumi.Output<string>; /** * What event needs to occur for a new job to be started. * Structure is documented below. */ readonly triggers: pulumi.Output<outputs.dataloss.PreventionJobTriggerTrigger[]>; /** * The last update timestamp of an inspectTemplate. Set by the server. */ readonly updateTime: pulumi.Output<string>; /** * Create a PreventionJobTrigger resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: PreventionJobTriggerArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering PreventionJobTrigger resources. */ export interface PreventionJobTriggerState { /** * The creation timestamp of an inspectTemplate. Set by the server. */ createTime?: pulumi.Input<string>; /** * A description of the job trigger. */ description?: pulumi.Input<string>; /** * User set display name of the job trigger. */ displayName?: pulumi.Input<string>; /** * Controls what and how to inspect for findings. * Structure is documented below. */ inspectJob?: pulumi.Input<inputs.dataloss.PreventionJobTriggerInspectJob>; /** * The timestamp of the last time this trigger executed. */ lastRunTime?: pulumi.Input<string>; /** * The resource name of the job trigger. Set by the server. */ name?: pulumi.Input<string>; /** * The parent of the trigger, either in the format `projects/{{project}}` * or `projects/{{project}}/locations/{{location}}` */ parent?: pulumi.Input<string>; /** * Whether the trigger is currently active. * Default value is `HEALTHY`. * Possible values are: `PAUSED`, `HEALTHY`, `CANCELLED`. */ status?: pulumi.Input<string>; /** * The trigger id can contain uppercase and lowercase letters, numbers, and hyphens; * that is, it must match the regular expression: [a-zA-Z\d-_]+. * The maximum length is 100 characters. Can be empty to allow the system to generate one. */ triggerId?: pulumi.Input<string>; /** * What event needs to occur for a new job to be started. * Structure is documented below. */ triggers?: pulumi.Input<pulumi.Input<inputs.dataloss.PreventionJobTriggerTrigger>[]>; /** * The last update timestamp of an inspectTemplate. Set by the server. */ updateTime?: pulumi.Input<string>; } /** * The set of arguments for constructing a PreventionJobTrigger resource. */ export interface PreventionJobTriggerArgs { /** * A description of the job trigger. */ description?: pulumi.Input<string>; /** * User set display name of the job trigger. */ displayName?: pulumi.Input<string>; /** * Controls what and how to inspect for findings. * Structure is documented below. */ inspectJob?: pulumi.Input<inputs.dataloss.PreventionJobTriggerInspectJob>; /** * The parent of the trigger, either in the format `projects/{{project}}` * or `projects/{{project}}/locations/{{location}}` */ parent: pulumi.Input<string>; /** * Whether the trigger is currently active. * Default value is `HEALTHY`. * Possible values are: `PAUSED`, `HEALTHY`, `CANCELLED`. */ status?: pulumi.Input<string>; /** * The trigger id can contain uppercase and lowercase letters, numbers, and hyphens; * that is, it must match the regular expression: [a-zA-Z\d-_]+. * The maximum length is 100 characters. Can be empty to allow the system to generate one. */ triggerId?: pulumi.Input<string>; /** * What event needs to occur for a new job to be started. * Structure is documented below. */ triggers: pulumi.Input<pulumi.Input<inputs.dataloss.PreventionJobTriggerTrigger>[]>; }