UNPKG

@pulumi/gcp

Version:

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

178 lines 6.94 kB
"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! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Trigger = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * The Eventarc Trigger resource * * To get more information about Trigger, see: * * * [API documentation](https://cloud.google.com/eventarc/docs/reference/rest/v1/projects.locations.triggers) * * How-to Guides * * [Official Documentation](https://cloud.google.com/eventarc/standard/docs/overview#eventarc-triggers) * * ## Example Usage * * ### Eventarc Trigger With Cloud Run Destination * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const foo = new gcp.pubsub.Topic("foo", {name: "some-topic"}); * const _default = new gcp.cloudrun.Service("default", { * name: "some-service", * location: "us-central1", * template: { * spec: { * containers: [{ * image: "gcr.io/cloudrun/hello", * ports: [{ * containerPort: 8080, * }], * }], * containerConcurrency: 50, * timeoutSeconds: 100, * }, * }, * traffics: [{ * percent: 100, * latestRevision: true, * }], * }); * const primary = new gcp.eventarc.Trigger("primary", { * name: "some-trigger", * location: "us-central1", * matchingCriterias: [{ * attribute: "type", * value: "google.cloud.pubsub.topic.v1.messagePublished", * }], * destination: { * cloudRunService: { * service: _default.name, * region: "us-central1", * }, * }, * labels: { * foo: "bar", * }, * transport: { * pubsub: { * topic: foo.id, * }, * }, * }); * ``` * * ## Import * * Trigger can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/triggers/{{name}}` * * * `{{project}}/{{location}}/{{name}}` * * * `{{location}}/{{name}}` * * When using the `pulumi import` command, Trigger can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:eventarc/trigger:Trigger default projects/{{project}}/locations/{{location}}/triggers/{{name}} * ``` * * ```sh * $ pulumi import gcp:eventarc/trigger:Trigger default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:eventarc/trigger:Trigger default {{location}}/{{name}} * ``` */ class Trigger extends pulumi.CustomResource { /** * Get an existing Trigger 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 Trigger(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Trigger. 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'] === Trigger.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["channel"] = state?.channel; resourceInputs["conditions"] = state?.conditions; resourceInputs["createTime"] = state?.createTime; resourceInputs["destination"] = state?.destination; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["etag"] = state?.etag; resourceInputs["eventDataContentType"] = state?.eventDataContentType; resourceInputs["labels"] = state?.labels; resourceInputs["location"] = state?.location; resourceInputs["matchingCriterias"] = state?.matchingCriterias; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["serviceAccount"] = state?.serviceAccount; resourceInputs["transport"] = state?.transport; resourceInputs["uid"] = state?.uid; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.destination === undefined && !opts.urn) { throw new Error("Missing required property 'destination'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.matchingCriterias === undefined && !opts.urn) { throw new Error("Missing required property 'matchingCriterias'"); } resourceInputs["channel"] = args?.channel; resourceInputs["destination"] = args?.destination; resourceInputs["eventDataContentType"] = args?.eventDataContentType; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["matchingCriterias"] = args?.matchingCriterias; resourceInputs["name"] = args?.name; resourceInputs["project"] = args?.project; resourceInputs["serviceAccount"] = args?.serviceAccount; resourceInputs["transport"] = args?.transport; resourceInputs["conditions"] = undefined /*out*/; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["pulumiLabels"] = 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(Trigger.__pulumiType, name, resourceInputs, opts); } } exports.Trigger = Trigger; /** @internal */ Trigger.__pulumiType = 'gcp:eventarc/trigger:Trigger'; //# sourceMappingURL=trigger.js.map