@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
178 lines • 7.52 kB
JavaScript
;
// *** 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.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, Object.assign(Object.assign({}, 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 ? state.channel : undefined;
resourceInputs["conditions"] = state ? state.conditions : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["destination"] = state ? state.destination : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["eventDataContentType"] = state ? state.eventDataContentType : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["matchingCriterias"] = state ? state.matchingCriterias : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["serviceAccount"] = state ? state.serviceAccount : undefined;
resourceInputs["transport"] = state ? state.transport : undefined;
resourceInputs["uid"] = state ? state.uid : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.destination === undefined) && !opts.urn) {
throw new Error("Missing required property 'destination'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if ((!args || args.matchingCriterias === undefined) && !opts.urn) {
throw new Error("Missing required property 'matchingCriterias'");
}
resourceInputs["channel"] = args ? args.channel : undefined;
resourceInputs["destination"] = args ? args.destination : undefined;
resourceInputs["eventDataContentType"] = args ? args.eventDataContentType : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["matchingCriterias"] = args ? args.matchingCriterias : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["serviceAccount"] = args ? args.serviceAccount : undefined;
resourceInputs["transport"] = args ? args.transport : undefined;
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