UNPKG

@pulumi/gcp

Version:

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

339 lines (338 loc) • 15.7 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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}} * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: TriggerState, opts?: pulumi.CustomResourceOptions): Trigger; /** * 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: any): obj is Trigger; /** * Optional. The name of the channel associated with the trigger in `projects/{project}/locations/{location}/channels/{channel}` format. You must provide a channel to receive events from Eventarc SaaS partners. */ readonly channel: pulumi.Output<string | undefined>; /** * Output only. The reason(s) why a trigger is in FAILED state. */ readonly conditions: pulumi.Output<{ [key: string]: string; }>; /** * Output only. The creation time. */ readonly createTime: pulumi.Output<string>; /** * Required. Destination specifies where the events should be sent to. * Structure is documented below. */ readonly destination: pulumi.Output<outputs.eventarc.TriggerDestination>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * Output only. This checksum is computed by the server based on the value of other fields, and may be sent only on create requests to ensure the client has an up-to-date value before proceeding. */ readonly etag: pulumi.Output<string>; /** * Optional. EventDataContentType specifies the type of payload in MIME format that is expected from the CloudEvent data field. This is set to `application/json` if the value is not defined. */ readonly eventDataContentType: pulumi.Output<string>; /** * Optional. User labels attached to the triggers that can be used to group resources. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The location for the resource */ readonly location: pulumi.Output<string>; /** * Required. null The list of filters that applies to event attributes. Only events that match all the provided filters will be sent to the destination. * Structure is documented below. */ readonly matchingCriterias: pulumi.Output<outputs.eventarc.TriggerMatchingCriteria[]>; /** * Required. The resource name of the trigger. Must be unique within the location on the project. */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * Optional. The IAM service account email associated with the trigger. The service account represents the identity of the trigger. The principal who calls this API must have `iam.serviceAccounts.actAs` permission in the service account. See https://cloud.google.com/iam/docs/understanding-service-accounts#sa_common for more information. For Cloud Run destinations, this service account is used to generate identity tokens when invoking the service. See https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account for information on how to invoke authenticated Cloud Run services. In order to create Audit Log triggers, the service account should also have `roles/eventarc.eventReceiver` IAM role. */ readonly serviceAccount: pulumi.Output<string | undefined>; /** * Optional. In order to deliver messages, Eventarc may use other GCP products as transport intermediary. This field contains a reference to that transport intermediary. This information can be used for debugging purposes. * Structure is documented below. */ readonly transport: pulumi.Output<outputs.eventarc.TriggerTransport>; /** * Output only. Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted. */ readonly uid: pulumi.Output<string>; /** * Output only. The last-modified time. */ readonly updateTime: pulumi.Output<string>; /** * Create a Trigger 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: TriggerArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Trigger resources. */ export interface TriggerState { /** * Optional. The name of the channel associated with the trigger in `projects/{project}/locations/{location}/channels/{channel}` format. You must provide a channel to receive events from Eventarc SaaS partners. */ channel?: pulumi.Input<string>; /** * Output only. The reason(s) why a trigger is in FAILED state. */ conditions?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Output only. The creation time. */ createTime?: pulumi.Input<string>; /** * Required. Destination specifies where the events should be sent to. * Structure is documented below. */ destination?: pulumi.Input<inputs.eventarc.TriggerDestination>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Output only. This checksum is computed by the server based on the value of other fields, and may be sent only on create requests to ensure the client has an up-to-date value before proceeding. */ etag?: pulumi.Input<string>; /** * Optional. EventDataContentType specifies the type of payload in MIME format that is expected from the CloudEvent data field. This is set to `application/json` if the value is not defined. */ eventDataContentType?: pulumi.Input<string>; /** * Optional. User labels attached to the triggers that can be used to group resources. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The location for the resource */ location?: pulumi.Input<string>; /** * Required. null The list of filters that applies to event attributes. Only events that match all the provided filters will be sent to the destination. * Structure is documented below. */ matchingCriterias?: pulumi.Input<pulumi.Input<inputs.eventarc.TriggerMatchingCriteria>[]>; /** * Required. The resource name of the trigger. Must be unique within the location on the project. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Optional. The IAM service account email associated with the trigger. The service account represents the identity of the trigger. The principal who calls this API must have `iam.serviceAccounts.actAs` permission in the service account. See https://cloud.google.com/iam/docs/understanding-service-accounts#sa_common for more information. For Cloud Run destinations, this service account is used to generate identity tokens when invoking the service. See https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account for information on how to invoke authenticated Cloud Run services. In order to create Audit Log triggers, the service account should also have `roles/eventarc.eventReceiver` IAM role. */ serviceAccount?: pulumi.Input<string>; /** * Optional. In order to deliver messages, Eventarc may use other GCP products as transport intermediary. This field contains a reference to that transport intermediary. This information can be used for debugging purposes. * Structure is documented below. */ transport?: pulumi.Input<inputs.eventarc.TriggerTransport>; /** * Output only. Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted. */ uid?: pulumi.Input<string>; /** * Output only. The last-modified time. */ updateTime?: pulumi.Input<string>; } /** * The set of arguments for constructing a Trigger resource. */ export interface TriggerArgs { /** * Optional. The name of the channel associated with the trigger in `projects/{project}/locations/{location}/channels/{channel}` format. You must provide a channel to receive events from Eventarc SaaS partners. */ channel?: pulumi.Input<string>; /** * Required. Destination specifies where the events should be sent to. * Structure is documented below. */ destination: pulumi.Input<inputs.eventarc.TriggerDestination>; /** * Optional. EventDataContentType specifies the type of payload in MIME format that is expected from the CloudEvent data field. This is set to `application/json` if the value is not defined. */ eventDataContentType?: pulumi.Input<string>; /** * Optional. User labels attached to the triggers that can be used to group resources. * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The location for the resource */ location: pulumi.Input<string>; /** * Required. null The list of filters that applies to event attributes. Only events that match all the provided filters will be sent to the destination. * Structure is documented below. */ matchingCriterias: pulumi.Input<pulumi.Input<inputs.eventarc.TriggerMatchingCriteria>[]>; /** * Required. The resource name of the trigger. Must be unique within the location on the project. */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Optional. The IAM service account email associated with the trigger. The service account represents the identity of the trigger. The principal who calls this API must have `iam.serviceAccounts.actAs` permission in the service account. See https://cloud.google.com/iam/docs/understanding-service-accounts#sa_common for more information. For Cloud Run destinations, this service account is used to generate identity tokens when invoking the service. See https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account for information on how to invoke authenticated Cloud Run services. In order to create Audit Log triggers, the service account should also have `roles/eventarc.eventReceiver` IAM role. */ serviceAccount?: pulumi.Input<string>; /** * Optional. In order to deliver messages, Eventarc may use other GCP products as transport intermediary. This field contains a reference to that transport intermediary. This information can be used for debugging purposes. * Structure is documented below. */ transport?: pulumi.Input<inputs.eventarc.TriggerTransport>; }