@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
901 lines (900 loc) • 38.7 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A named resource representing the stream of messages from a single,
* specific topic, to be delivered to the subscribing application.
*
* To get more information about Subscription, see:
*
* * [API documentation](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions)
* * How-to Guides
* * [Managing Subscriptions](https://cloud.google.com/pubsub/docs/admin#managing_subscriptions)
*
* > **Note:** You can retrieve the email of the Google Managed Pub/Sub Service Account used for forwarding
* by using the `gcp.projects.ServiceIdentity` resource.
*
* ## Example Usage
*
* ### Pubsub Subscription Push
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* ackDeadlineSeconds: 20,
* labels: {
* foo: "bar",
* },
* pushConfig: {
* pushEndpoint: "https://example.com/push",
* attributes: {
* "x-goog-version": "v1",
* },
* },
* });
* ```
* ### Pubsub Subscription Pull
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* labels: {
* foo: "bar",
* },
* messageRetentionDuration: "1200s",
* retainAckedMessages: true,
* ackDeadlineSeconds: 20,
* expirationPolicy: {
* ttl: "300000.5s",
* },
* retryPolicy: {
* minimumBackoff: "10s",
* },
* enableMessageOrdering: false,
* });
* ```
* ### Pubsub Subscription Pull Filter
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* labels: {
* foo: "bar",
* },
* filter: ` attributes.foo = "foo"
* AND attributes.bar = "bar"
* `,
* ackDeadlineSeconds: 20,
* });
* ```
* ### Pubsub Subscription Dead Letter
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const exampleDeadLetter = new gcp.pubsub.Topic("example_dead_letter", {name: "example-topic-dead-letter"});
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* deadLetterPolicy: {
* deadLetterTopic: exampleDeadLetter.id,
* maxDeliveryAttempts: 10,
* },
* });
* ```
* ### Pubsub Subscription Push Bq
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const test = new gcp.bigquery.Dataset("test", {datasetId: "example_dataset"});
* const testTable = new gcp.bigquery.Table("test", {
* tableId: "example_table",
* datasetId: test.datasetId,
* schema: `[
* {
* "name": "data",
* "type": "STRING",
* "mode": "NULLABLE",
* "description": "The data"
* }
* ]
* `,
* deletionProtection: false,
* });
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* bigqueryConfig: {
* table: pulumi.interpolate`${testTable.project}.${testTable.datasetId}.${testTable.tableId}`,
* },
* });
* const project = gcp.organizations.getProject({});
* ```
* ### Pubsub Subscription Push Bq Table Schema
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const test = new gcp.bigquery.Dataset("test", {datasetId: "example_dataset"});
* const testTable = new gcp.bigquery.Table("test", {
* tableId: "example_table",
* datasetId: test.datasetId,
* schema: `[
* {
* "name": "data",
* "type": "STRING",
* "mode": "NULLABLE",
* "description": "The data"
* }
* ]
* `,
* deletionProtection: false,
* });
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* bigqueryConfig: {
* table: pulumi.interpolate`${testTable.project}.${testTable.datasetId}.${testTable.tableId}`,
* useTableSchema: true,
* },
* });
* const project = gcp.organizations.getProject({});
* ```
* ### Pubsub Subscription Push Bq Service Account
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const bqWriteServiceAccount = new gcp.serviceaccount.Account("bq_write_service_account", {
* accountId: "example-bqw",
* displayName: "BQ Write Service Account",
* });
* const project = gcp.organizations.getProject({});
* const bigqueryMetadataViewer = new gcp.projects.IAMMember("bigquery_metadata_viewer", {
* project: project.then(project => project.projectId),
* role: "roles/bigquery.metadataViewer",
* member: pulumi.interpolate`serviceAccount:${bqWriteServiceAccount.email}`,
* });
* const bigqueryDataEditor = new gcp.projects.IAMMember("bigquery_data_editor", {
* project: project.then(project => project.projectId),
* role: "roles/bigquery.dataEditor",
* member: pulumi.interpolate`serviceAccount:${bqWriteServiceAccount.email}`,
* });
* const test = new gcp.bigquery.Dataset("test", {datasetId: "example_dataset"});
* const testTable = new gcp.bigquery.Table("test", {
* deletionProtection: false,
* tableId: "example_table",
* datasetId: test.datasetId,
* schema: `[
* {
* "name": "data",
* "type": "STRING",
* "mode": "NULLABLE",
* "description": "The data"
* }
* ]
* `,
* });
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* bigqueryConfig: {
* table: pulumi.interpolate`${testTable.project}.${testTable.datasetId}.${testTable.tableId}`,
* serviceAccountEmail: bqWriteServiceAccount.email,
* },
* }, {
* dependsOn: [
* bqWriteServiceAccount,
* bigqueryMetadataViewer,
* bigqueryDataEditor,
* ],
* });
* ```
* ### Pubsub Subscription Push Cloudstorage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.storage.Bucket("example", {
* name: "example-bucket",
* location: "US",
* uniformBucketLevelAccess: true,
* });
* const exampleTopic = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const project = gcp.organizations.getProject({});
* const admin = new gcp.storage.BucketIAMMember("admin", {
* bucket: example.name,
* role: "roles/storage.admin",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
* });
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: exampleTopic.id,
* cloudStorageConfig: {
* bucket: example.name,
* filenamePrefix: "pre-",
* filenameSuffix: "-_50610",
* filenameDatetimeFormat: "YYYY-MM-DD/hh_mm_ssZ",
* maxBytes: 1000,
* maxDuration: "300s",
* maxMessages: 1000,
* },
* }, {
* dependsOn: [
* example,
* admin,
* ],
* });
* ```
* ### Pubsub Subscription Push Cloudstorage Avro
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.storage.Bucket("example", {
* name: "example-bucket",
* location: "US",
* uniformBucketLevelAccess: true,
* });
* const exampleTopic = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const project = gcp.organizations.getProject({});
* const admin = new gcp.storage.BucketIAMMember("admin", {
* bucket: example.name,
* role: "roles/storage.admin",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
* });
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: exampleTopic.id,
* cloudStorageConfig: {
* bucket: example.name,
* filenamePrefix: "pre-",
* filenameSuffix: "-_77124",
* filenameDatetimeFormat: "YYYY-MM-DD/hh_mm_ssZ",
* maxBytes: 1000,
* maxDuration: "300s",
* maxMessages: 1000,
* avroConfig: {
* writeMetadata: true,
* useTopicSchema: true,
* },
* },
* }, {
* dependsOn: [
* example,
* admin,
* ],
* });
* ```
* ### Pubsub Subscription Push Cloudstorage Service Account
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.storage.Bucket("example", {
* name: "example-bucket",
* location: "US",
* uniformBucketLevelAccess: true,
* });
* const exampleTopic = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const storageWriteServiceAccount = new gcp.serviceaccount.Account("storage_write_service_account", {
* accountId: "example-stw",
* displayName: "Storage Write Service Account",
* });
* const admin = new gcp.storage.BucketIAMMember("admin", {
* bucket: example.name,
* role: "roles/storage.admin",
* member: pulumi.interpolate`serviceAccount:${storageWriteServiceAccount.email}`,
* });
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: exampleTopic.id,
* cloudStorageConfig: {
* bucket: example.name,
* filenamePrefix: "pre-",
* filenameSuffix: "-_15335",
* filenameDatetimeFormat: "YYYY-MM-DD/hh_mm_ssZ",
* maxBytes: 1000,
* maxDuration: "300s",
* serviceAccountEmail: storageWriteServiceAccount.email,
* },
* }, {
* dependsOn: [
* storageWriteServiceAccount,
* example,
* admin,
* ],
* });
* const project = gcp.organizations.getProject({});
* ```
* ### Pubsub Subscription Single Smt
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* messageTransforms: [{
* javascriptUdf: {
* functionName: "isYearEven",
* code: `function isYearEven(message, metadata) {
* const data = JSON.parse(message.data);
* return message.year %2 === 0;
* }
* `,
* },
* }],
* });
* ```
* ### Pubsub Subscription Multiple Smts
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
* const exampleSubscription = new gcp.pubsub.Subscription("example", {
* name: "example-subscription",
* topic: example.id,
* messageTransforms: [
* {
* javascriptUdf: {
* functionName: "redactSSN",
* code: `function redactSSN(message, metadata) {
* const data = JSON.parse(message.data);
* delete data['ssn'];
* message.data = JSON.stringify(data);
* return message;
* }
* `,
* },
* },
* {
* javascriptUdf: {
* functionName: "otherFunc",
* code: `function otherFunc(message, metadata) {
* return null;
* }
* `,
* },
* },
* {
* disabled: true,
* javascriptUdf: {
* functionName: "someSMTWeDisabled",
* code: "...",
* },
* },
* ],
* });
* ```
*
* ## Import
*
* Subscription can be imported using any of these accepted formats:
*
* * `projects/{{project}}/subscriptions/{{name}}`
*
* * `{{project}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Subscription can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:pubsub/subscription:Subscription default projects/{{project}}/subscriptions/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/subscription:Subscription default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/subscription:Subscription default {{name}}
* ```
*/
export declare class Subscription extends pulumi.CustomResource {
/**
* Get an existing Subscription 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?: SubscriptionState, opts?: pulumi.CustomResourceOptions): Subscription;
/**
* Returns true if the given object is an instance of Subscription. 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 Subscription;
/**
* This value is the maximum time after a subscriber receives a message
* before the subscriber should acknowledge the message. After message
* delivery but before the ack deadline expires and before the message is
* acknowledged, it is an outstanding message and will not be delivered
* again during that time (on a best-effort basis).
* For pull subscriptions, this value is used as the initial value for
* the ack deadline. To override this value for a given message, call
* subscriptions.modifyAckDeadline with the corresponding ackId if using
* pull. The minimum custom deadline you can specify is 10 seconds. The
* maximum custom deadline you can specify is 600 seconds (10 minutes).
* If this parameter is 0, a default value of 10 seconds is used.
* For push delivery, this value is also used to set the request timeout
* for the call to the push endpoint.
* If the subscriber never acknowledges the message, the Pub/Sub system
* will eventually redeliver the message.
*/
readonly ackDeadlineSeconds: pulumi.Output<number>;
/**
* If delivery to BigQuery is used with this subscription, this field is used to configure it.
* Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined.
* If all three are empty, then the subscriber will pull and ack messages using API methods.
* Structure is documented below.
*/
readonly bigqueryConfig: pulumi.Output<outputs.pubsub.SubscriptionBigqueryConfig | undefined>;
/**
* If delivery to Cloud Storage is used with this subscription, this field is used to configure it.
* Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined.
* If all three are empty, then the subscriber will pull and ack messages using API methods.
* Structure is documented below.
*/
readonly cloudStorageConfig: pulumi.Output<outputs.pubsub.SubscriptionCloudStorageConfig | undefined>;
/**
* A policy that specifies the conditions for dead lettering messages in
* this subscription. If deadLetterPolicy is not set, dead lettering
* is disabled.
* The Cloud Pub/Sub service account associated with this subscription's
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
* Structure is documented below.
*/
readonly deadLetterPolicy: pulumi.Output<outputs.pubsub.SubscriptionDeadLetterPolicy | undefined>;
/**
* 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;
}>;
/**
* If `true`, Pub/Sub provides the following guarantees for the delivery
* of a message with a given value of messageId on this Subscriptions':
* - The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
* - An acknowledged message will not be resent to a subscriber.
* Note that subscribers may still receive multiple copies of a message when `enableExactlyOnceDelivery`
* is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
*/
readonly enableExactlyOnceDelivery: pulumi.Output<boolean | undefined>;
/**
* If `true`, messages published with the same orderingKey in PubsubMessage will be delivered to
* the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they
* may be delivered in any order.
*/
readonly enableMessageOrdering: pulumi.Output<boolean | undefined>;
/**
* A policy that specifies the conditions for this subscription's expiration.
* A subscription is considered active as long as any connected subscriber
* is successfully consuming messages from the subscription or is issuing
* operations on the subscription. If expirationPolicy is not set, a default
* policy with ttl of 31 days will be used. If it is set but ttl is "", the
* resource never expires. The minimum allowed value for expirationPolicy.ttl
* is 1 day.
* Structure is documented below.
*/
readonly expirationPolicy: pulumi.Output<outputs.pubsub.SubscriptionExpirationPolicy>;
/**
* The subscription only delivers the messages that match the filter.
* Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages
* by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription,
* you can't modify the filter.
*/
readonly filter: pulumi.Output<string | undefined>;
/**
* A set of key/value label pairs to assign to this Subscription.
*
* **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>;
/**
* How long to retain unacknowledged messages in the subscription's
* backlog, from the moment a message is published. If
* retainAckedMessages is true, then this also configures the retention
* of acknowledged messages, and thus configures how far back in time a
* subscriptions.seek can be done. Defaults to 7 days. Cannot be more
* than 31 days (`"2678400s"`) or less than 10 minutes (`"600s"`).
* A duration in seconds with up to nine fractional digits, terminated
* by 's'. Example: `"600.5s"`.
*/
readonly messageRetentionDuration: pulumi.Output<string | undefined>;
/**
* Transforms to be applied to messages published to the topic. Transforms are applied in the
* order specified.
* Structure is documented below.
*/
readonly messageTransforms: pulumi.Output<outputs.pubsub.SubscriptionMessageTransform[] | undefined>;
/**
* Name of the subscription.
*/
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;
}>;
/**
* If push delivery is used with this subscription, this field is used to
* configure it. An empty pushConfig signifies that the subscriber will
* pull and ack messages using API methods.
* Structure is documented below.
*/
readonly pushConfig: pulumi.Output<outputs.pubsub.SubscriptionPushConfig | undefined>;
/**
* Indicates whether to retain acknowledged messages. If `true`, then
* messages are not expunged from the subscription's backlog, even if
* they are acknowledged, until they fall out of the
* messageRetentionDuration window.
*/
readonly retainAckedMessages: pulumi.Output<boolean | undefined>;
/**
* A policy that specifies how Pub/Sub retries message delivery for this subscription.
* If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers.
* RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message
* Structure is documented below.
*/
readonly retryPolicy: pulumi.Output<outputs.pubsub.SubscriptionRetryPolicy | undefined>;
/**
* A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
* (as in the id property of a google_pubsub_topic), or just a topic name if
* the topic is in the same project as the subscription.
*/
readonly topic: pulumi.Output<string>;
/**
* Create a Subscription 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: SubscriptionArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Subscription resources.
*/
export interface SubscriptionState {
/**
* This value is the maximum time after a subscriber receives a message
* before the subscriber should acknowledge the message. After message
* delivery but before the ack deadline expires and before the message is
* acknowledged, it is an outstanding message and will not be delivered
* again during that time (on a best-effort basis).
* For pull subscriptions, this value is used as the initial value for
* the ack deadline. To override this value for a given message, call
* subscriptions.modifyAckDeadline with the corresponding ackId if using
* pull. The minimum custom deadline you can specify is 10 seconds. The
* maximum custom deadline you can specify is 600 seconds (10 minutes).
* If this parameter is 0, a default value of 10 seconds is used.
* For push delivery, this value is also used to set the request timeout
* for the call to the push endpoint.
* If the subscriber never acknowledges the message, the Pub/Sub system
* will eventually redeliver the message.
*/
ackDeadlineSeconds?: pulumi.Input<number>;
/**
* If delivery to BigQuery is used with this subscription, this field is used to configure it.
* Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined.
* If all three are empty, then the subscriber will pull and ack messages using API methods.
* Structure is documented below.
*/
bigqueryConfig?: pulumi.Input<inputs.pubsub.SubscriptionBigqueryConfig>;
/**
* If delivery to Cloud Storage is used with this subscription, this field is used to configure it.
* Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined.
* If all three are empty, then the subscriber will pull and ack messages using API methods.
* Structure is documented below.
*/
cloudStorageConfig?: pulumi.Input<inputs.pubsub.SubscriptionCloudStorageConfig>;
/**
* A policy that specifies the conditions for dead lettering messages in
* this subscription. If deadLetterPolicy is not set, dead lettering
* is disabled.
* The Cloud Pub/Sub service account associated with this subscription's
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
* Structure is documented below.
*/
deadLetterPolicy?: pulumi.Input<inputs.pubsub.SubscriptionDeadLetterPolicy>;
/**
* 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>;
}>;
/**
* If `true`, Pub/Sub provides the following guarantees for the delivery
* of a message with a given value of messageId on this Subscriptions':
* - The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
* - An acknowledged message will not be resent to a subscriber.
* Note that subscribers may still receive multiple copies of a message when `enableExactlyOnceDelivery`
* is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
*/
enableExactlyOnceDelivery?: pulumi.Input<boolean>;
/**
* If `true`, messages published with the same orderingKey in PubsubMessage will be delivered to
* the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they
* may be delivered in any order.
*/
enableMessageOrdering?: pulumi.Input<boolean>;
/**
* A policy that specifies the conditions for this subscription's expiration.
* A subscription is considered active as long as any connected subscriber
* is successfully consuming messages from the subscription or is issuing
* operations on the subscription. If expirationPolicy is not set, a default
* policy with ttl of 31 days will be used. If it is set but ttl is "", the
* resource never expires. The minimum allowed value for expirationPolicy.ttl
* is 1 day.
* Structure is documented below.
*/
expirationPolicy?: pulumi.Input<inputs.pubsub.SubscriptionExpirationPolicy>;
/**
* The subscription only delivers the messages that match the filter.
* Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages
* by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription,
* you can't modify the filter.
*/
filter?: pulumi.Input<string>;
/**
* A set of key/value label pairs to assign to this Subscription.
*
* **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>;
}>;
/**
* How long to retain unacknowledged messages in the subscription's
* backlog, from the moment a message is published. If
* retainAckedMessages is true, then this also configures the retention
* of acknowledged messages, and thus configures how far back in time a
* subscriptions.seek can be done. Defaults to 7 days. Cannot be more
* than 31 days (`"2678400s"`) or less than 10 minutes (`"600s"`).
* A duration in seconds with up to nine fractional digits, terminated
* by 's'. Example: `"600.5s"`.
*/
messageRetentionDuration?: pulumi.Input<string>;
/**
* Transforms to be applied to messages published to the topic. Transforms are applied in the
* order specified.
* Structure is documented below.
*/
messageTransforms?: pulumi.Input<pulumi.Input<inputs.pubsub.SubscriptionMessageTransform>[]>;
/**
* Name of the subscription.
*/
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>;
}>;
/**
* If push delivery is used with this subscription, this field is used to
* configure it. An empty pushConfig signifies that the subscriber will
* pull and ack messages using API methods.
* Structure is documented below.
*/
pushConfig?: pulumi.Input<inputs.pubsub.SubscriptionPushConfig>;
/**
* Indicates whether to retain acknowledged messages. If `true`, then
* messages are not expunged from the subscription's backlog, even if
* they are acknowledged, until they fall out of the
* messageRetentionDuration window.
*/
retainAckedMessages?: pulumi.Input<boolean>;
/**
* A policy that specifies how Pub/Sub retries message delivery for this subscription.
* If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers.
* RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message
* Structure is documented below.
*/
retryPolicy?: pulumi.Input<inputs.pubsub.SubscriptionRetryPolicy>;
/**
* A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
* (as in the id property of a google_pubsub_topic), or just a topic name if
* the topic is in the same project as the subscription.
*/
topic?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Subscription resource.
*/
export interface SubscriptionArgs {
/**
* This value is the maximum time after a subscriber receives a message
* before the subscriber should acknowledge the message. After message
* delivery but before the ack deadline expires and before the message is
* acknowledged, it is an outstanding message and will not be delivered
* again during that time (on a best-effort basis).
* For pull subscriptions, this value is used as the initial value for
* the ack deadline. To override this value for a given message, call
* subscriptions.modifyAckDeadline with the corresponding ackId if using
* pull. The minimum custom deadline you can specify is 10 seconds. The
* maximum custom deadline you can specify is 600 seconds (10 minutes).
* If this parameter is 0, a default value of 10 seconds is used.
* For push delivery, this value is also used to set the request timeout
* for the call to the push endpoint.
* If the subscriber never acknowledges the message, the Pub/Sub system
* will eventually redeliver the message.
*/
ackDeadlineSeconds?: pulumi.Input<number>;
/**
* If delivery to BigQuery is used with this subscription, this field is used to configure it.
* Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined.
* If all three are empty, then the subscriber will pull and ack messages using API methods.
* Structure is documented below.
*/
bigqueryConfig?: pulumi.Input<inputs.pubsub.SubscriptionBigqueryConfig>;
/**
* If delivery to Cloud Storage is used with this subscription, this field is used to configure it.
* Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined.
* If all three are empty, then the subscriber will pull and ack messages using API methods.
* Structure is documented below.
*/
cloudStorageConfig?: pulumi.Input<inputs.pubsub.SubscriptionCloudStorageConfig>;
/**
* A policy that specifies the conditions for dead lettering messages in
* this subscription. If deadLetterPolicy is not set, dead lettering
* is disabled.
* The Cloud Pub/Sub service account associated with this subscription's
* parent project (i.e.,
* service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
* permission to Acknowledge() messages on this subscription.
* Structure is documented below.
*/
deadLetterPolicy?: pulumi.Input<inputs.pubsub.SubscriptionDeadLetterPolicy>;
/**
* If `true`, Pub/Sub provides the following guarantees for the delivery
* of a message with a given value of messageId on this Subscriptions':
* - The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
* - An acknowledged message will not be resent to a subscriber.
* Note that subscribers may still receive multiple copies of a message when `enableExactlyOnceDelivery`
* is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
*/
enableExactlyOnceDelivery?: pulumi.Input<boolean>;
/**
* If `true`, messages published with the same orderingKey in PubsubMessage will be delivered to
* the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they
* may be delivered in any order.
*/
enableMessageOrdering?: pulumi.Input<boolean>;
/**
* A policy that specifies the conditions for this subscription's expiration.
* A subscription is considered active as long as any connected subscriber
* is successfully consuming messages from the subscription or is issuing
* operations on the subscription. If expirationPolicy is not set, a default
* policy with ttl of 31 days will be used. If it is set but ttl is "", the
* resource never expires. The minimum allowed value for expirationPolicy.ttl
* is 1 day.
* Structure is documented below.
*/
expirationPolicy?: pulumi.Input<inputs.pubsub.SubscriptionExpirationPolicy>;
/**
* The subscription only delivers the messages that match the filter.
* Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages
* by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription,
* you can't modify the filter.
*/
filter?: pulumi.Input<string>;
/**
* A set of key/value label pairs to assign to this Subscription.
*
* **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>;
}>;
/**
* How long to retain unacknowledged messages in the subscription's
* backlog, from the moment a message is published. If
* retainAckedMessages is true, then this also configures the retention
* of acknowledged messages, and thus configures how far back in time a
* subscriptions.seek can be done. Defaults to 7 days. Cannot be more
* than 31 days (`"2678400s"`) or less than 10 minutes (`"600s"`).
* A duration in seconds with up to nine fractional digits, terminated
* by 's'. Example: `"600.5s"`.
*/
messageRetentionDuration?: pulumi.Input<string>;
/**
* Transforms to be applied to messages published to the topic. Transforms are applied in the
* order specified.
* Structure is documented below.
*/
messageTransforms?: pulumi.Input<pulumi.Input<inputs.pubsub.SubscriptionMessageTransform>[]>;
/**
* Name of the subscription.
*/
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>;
/**
* If push delivery is used with this subscription, this field is used to
* configure it. An empty pushConfig signifies that the subscriber will
* pull and ack messages using API methods.
* Structure is documented below.
*/
pushConfig?: pulumi.Input<inputs.pubsub.SubscriptionPushConfig>;
/**
* Indicates whether to retain acknowledged messages. If `true`, then
* messages are not expunged from the subscription's backlog, even if
* they are acknowledged, until they fall out of the
* messageRetentionDuration window.
*/
retainAckedMessages?: pulumi.Input<boolean>;
/**
* A policy that specifies how Pub/Sub retries message delivery for this subscription.
* If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers.
* RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message
* Structure is documented below.
*/
retryPolicy?: pulumi.Input<inputs.pubsub.SubscriptionRetryPolicy>;
/**
* A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
* (as in the id property of a google_pubsub_topic), or just a topic name if
* the topic is in the same project as the subscription.
*/
topic: pulumi.Input<string>;
}