Skip to content

Commit 3eeb773

Browse files
feat(pubsub): update the API
#### pubsub:v1 The following keys were added: - schemas.JavaScriptUDF.description - schemas.JavaScriptUDF.id - schemas.JavaScriptUDF.properties.code.description - schemas.JavaScriptUDF.properties.code.type - schemas.JavaScriptUDF.properties.functionName.description - schemas.JavaScriptUDF.properties.functionName.type - schemas.JavaScriptUDF.type - schemas.MessageTransform.description - schemas.MessageTransform.id - schemas.MessageTransform.properties.enabled.description - schemas.MessageTransform.properties.enabled.type - schemas.MessageTransform.properties.javascriptUdf.$ref - schemas.MessageTransform.properties.javascriptUdf.description - schemas.MessageTransform.type - schemas.Subscription.properties.messageTransforms.description - schemas.Subscription.properties.messageTransforms.items.$ref - schemas.Subscription.properties.messageTransforms.type - schemas.Topic.properties.messageTransforms.description - schemas.Topic.properties.messageTransforms.items.$ref - schemas.Topic.properties.messageTransforms.type The following keys were changed: - schemas.CloudStorageConfig.properties.maxDuration.description - schemas.DeadLetterPolicy.properties.maxDeliveryAttempts.description - schemas.RetryPolicy.description - schemas.Subscription.properties.enableExactlyOnceDelivery.description - schemas.Subscription.properties.retryPolicy.description
1 parent 3fe49ca commit 3eeb773

File tree

2 files changed

+89
-11
lines changed

2 files changed

+89
-11
lines changed

discovery/pubsub-v1.json

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@
16381638
}
16391639
}
16401640
},
1641-
"revision": "20241231",
1641+
"revision": "20250218",
16421642
"rootUrl": "https://pubsub.googleapis.com/",
16431643
"schemas": {
16441644
"AcknowledgeRequest": {
@@ -1996,7 +1996,7 @@
19961996
"type": "string"
19971997
},
19981998
"maxDuration": {
1999-
"description": "Optional. The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline.",
1999+
"description": "Optional. The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgment deadline.",
20002000
"format": "google-duration",
20012001
"type": "string"
20022002
},
@@ -2125,7 +2125,7 @@
21252125
"type": "string"
21262126
},
21272127
"maxDeliveryAttempts": {
2128-
"description": "Optional. The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.",
2128+
"description": "Optional. The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgment deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.",
21292129
"format": "int32",
21302130
"type": "integer"
21312131
}
@@ -2210,6 +2210,21 @@
22102210
},
22112211
"type": "object"
22122212
},
2213+
"JavaScriptUDF": {
2214+
"description": "User-defined JavaScript function that can transform or filter a Pub/Sub message.",
2215+
"id": "JavaScriptUDF",
2216+
"properties": {
2217+
"code": {
2218+
"description": "Required. JavaScript code that contains a function `function_name` with the below signature: ``` /** * Transforms a Pub/Sub message. * @return {(Object)>|null)} - To * filter a message, return `null`. To transform a message return a map * with the following keys: * - (required) 'data' : {string} * - (optional) 'attributes' : {Object} * Returning empty `attributes` will remove all attributes from the * message. * * @param {(Object)>} Pub/Sub * message. Keys: * - (required) 'data' : {string} * - (required) 'attributes' : {Object} * * @param {Object} metadata - Pub/Sub message metadata. * Keys: * - (required) 'message_id' : {string} * - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format * - (optional) 'ordering_key': {string} */ function (message, metadata) { } ```",
2219+
"type": "string"
2220+
},
2221+
"functionName": {
2222+
"description": "Required. Name of the JavasScript function that should applied to Pub/Sub messages.",
2223+
"type": "string"
2224+
}
2225+
},
2226+
"type": "object"
2227+
},
22132228
"ListSchemaRevisionsResponse": {
22142229
"description": "Response for the `ListSchemaRevisions` method.",
22152230
"id": "ListSchemaRevisionsResponse",
@@ -2354,6 +2369,21 @@
23542369
},
23552370
"type": "object"
23562371
},
2372+
"MessageTransform": {
2373+
"description": "All supported message transforms types.",
2374+
"id": "MessageTransform",
2375+
"properties": {
2376+
"enabled": {
2377+
"description": "Optional. If set to true, the transform is enabled. If false, the transform is disabled and will not be applied to messages. Defaults to `true`.",
2378+
"type": "boolean"
2379+
},
2380+
"javascriptUdf": {
2381+
"$ref": "JavaScriptUDF",
2382+
"description": "Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's are specified on a resource, each must have a unique `function_name`."
2383+
}
2384+
},
2385+
"type": "object"
2386+
},
23572387
"ModifyAckDeadlineRequest": {
23582388
"description": "Request for the ModifyAckDeadline method.",
23592389
"id": "ModifyAckDeadlineRequest",
@@ -2615,7 +2645,7 @@
26152645
"type": "object"
26162646
},
26172647
"RetryPolicy": {
2618-
"description": "A policy that specifies how Pub/Sub retries message delivery. Retry delay will be exponential based on provided minimum and maximum backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message. Retry Policy is implemented on a best effort basis. At times, the delay between consecutive deliveries may not match the configuration. That is, delay can be more or less than configured backoff.",
2648+
"description": "A policy that specifies how Pub/Sub retries message delivery. Retry delay will be exponential based on provided minimum and maximum backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded events for a given message. Retry Policy is implemented on a best effort basis. At times, the delay between consecutive deliveries may not match the configuration. That is, delay can be more or less than configured backoff.",
26192649
"id": "RetryPolicy",
26202650
"properties": {
26212651
"maximumBackoff": {
@@ -2806,7 +2836,7 @@
28062836
"type": "boolean"
28072837
},
28082838
"enableExactlyOnceDelivery": {
2809-
"description": "Optional. If true, Pub/Sub provides the following guarantees for the delivery of a message with a given value of `message_id` on this subscription: * 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 `enable_exactly_once_delivery` is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct `message_id` values.",
2839+
"description": "Optional. If true, Pub/Sub provides the following guarantees for the delivery of a message with a given value of `message_id` on this subscription: * The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgment deadline expires. * An acknowledged message will not be resent to a subscriber. Note that subscribers may still receive multiple copies of a message when `enable_exactly_once_delivery` is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct `message_id` values.",
28102840
"type": "boolean"
28112841
},
28122842
"enableMessageOrdering": {
@@ -2833,6 +2863,13 @@
28332863
"format": "google-duration",
28342864
"type": "string"
28352865
},
2866+
"messageTransforms": {
2867+
"description": "Optional. Transforms to be applied to messages before they are delivered to subscribers. Transforms are applied in the order specified.",
2868+
"items": {
2869+
"$ref": "MessageTransform"
2870+
},
2871+
"type": "array"
2872+
},
28362873
"name": {
28372874
"description": "Required. The name of the subscription. It must have the format `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.",
28382875
"type": "string"
@@ -2847,7 +2884,7 @@
28472884
},
28482885
"retryPolicy": {
28492886
"$ref": "RetryPolicy",
2850-
"description": "Optional. 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."
2887+
"description": "Optional. 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 acknowledgment deadline exceeded events for a given message."
28512888
},
28522889
"state": {
28532890
"description": "Output only. An output-only field indicating whether or not the subscription can receive messages.",
@@ -2950,6 +2987,13 @@
29502987
"$ref": "MessageStoragePolicy",
29512988
"description": "Optional. Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect."
29522989
},
2990+
"messageTransforms": {
2991+
"description": "Optional. Transforms to be applied to messages published to the topic. Transforms are applied in the order specified.",
2992+
"items": {
2993+
"$ref": "MessageTransform"
2994+
},
2995+
"type": "array"
2996+
},
29532997
"name": {
29542998
"description": "Required. The name of the topic. It must have the format `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.",
29552999
"type": "string"

src/apis/pubsub/v1.ts

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export namespace pubsub_v1 {
362362
*/
363363
maxBytes?: string | null;
364364
/**
365-
* Optional. The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline.
365+
* Optional. The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgment deadline.
366366
*/
367367
maxDuration?: string | null;
368368
/**
@@ -442,7 +442,7 @@ export namespace pubsub_v1 {
442442
*/
443443
deadLetterTopic?: string | null;
444444
/**
445-
* Optional. The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
445+
* Optional. The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgment deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
446446
*/
447447
maxDeliveryAttempts?: number | null;
448448
}
@@ -513,6 +513,19 @@ export namespace pubsub_v1 {
513513
*/
514514
platformLogsSettings?: Schema$PlatformLogsSettings;
515515
}
516+
/**
517+
* User-defined JavaScript function that can transform or filter a Pub/Sub message.
518+
*/
519+
export interface Schema$JavaScriptUDF {
520+
/**
521+
* Required. JavaScript code that contains a function `function_name` with the below signature: ``` /x* * Transforms a Pub/Sub message. * @return {(Object)\>|null)\} - To * filter a message, return `null`. To transform a message return a map * with the following keys: * - (required) 'data' : {string\} * - (optional) 'attributes' : {Object\} * Returning empty `attributes` will remove all attributes from the * message. * * @param {(Object)\>\} Pub/Sub * message. Keys: * - (required) 'data' : {string\} * - (required) 'attributes' : {Object\} * * @param {Object\} metadata - Pub/Sub message metadata. * Keys: * - (required) 'message_id' : {string\} * - (optional) 'publish_time': {string\} YYYY-MM-DDTHH:MM:SSZ format * - (optional) 'ordering_key': {string\} x/ function (message, metadata) { \} ```
522+
*/
523+
code?: string | null;
524+
/**
525+
* Required. Name of the JavasScript function that should applied to Pub/Sub messages.
526+
*/
527+
functionName?: string | null;
528+
}
516529
/**
517530
* Response for the `ListSchemaRevisions` method.
518531
*/
@@ -617,6 +630,19 @@ export namespace pubsub_v1 {
617630
*/
618631
enforceInTransit?: boolean | null;
619632
}
633+
/**
634+
* All supported message transforms types.
635+
*/
636+
export interface Schema$MessageTransform {
637+
/**
638+
* Optional. If set to true, the transform is enabled. If false, the transform is disabled and will not be applied to messages. Defaults to `true`.
639+
*/
640+
enabled?: boolean | null;
641+
/**
642+
* Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's are specified on a resource, each must have a unique `function_name`.
643+
*/
644+
javascriptUdf?: Schema$JavaScriptUDF;
645+
}
620646
/**
621647
* Request for the ModifyAckDeadline method.
622648
*/
@@ -803,7 +829,7 @@ export namespace pubsub_v1 {
803829
message?: Schema$PubsubMessage;
804830
}
805831
/**
806-
* A policy that specifies how Pub/Sub retries message delivery. Retry delay will be exponential based on provided minimum and maximum backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message. Retry Policy is implemented on a best effort basis. At times, the delay between consecutive deliveries may not match the configuration. That is, delay can be more or less than configured backoff.
832+
* A policy that specifies how Pub/Sub retries message delivery. Retry delay will be exponential based on provided minimum and maximum backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded events for a given message. Retry Policy is implemented on a best effort basis. At times, the delay between consecutive deliveries may not match the configuration. That is, delay can be more or less than configured backoff.
807833
*/
808834
export interface Schema$RetryPolicy {
809835
/**
@@ -946,7 +972,7 @@ export namespace pubsub_v1 {
946972
*/
947973
detached?: boolean | null;
948974
/**
949-
* Optional. If true, Pub/Sub provides the following guarantees for the delivery of a message with a given value of `message_id` on this subscription: * 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 `enable_exactly_once_delivery` is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct `message_id` values.
975+
* Optional. If true, Pub/Sub provides the following guarantees for the delivery of a message with a given value of `message_id` on this subscription: * The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgment deadline expires. * An acknowledged message will not be resent to a subscriber. Note that subscribers may still receive multiple copies of a message when `enable_exactly_once_delivery` is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct `message_id` values.
950976
*/
951977
enableExactlyOnceDelivery?: boolean | null;
952978
/**
@@ -969,6 +995,10 @@ export namespace pubsub_v1 {
969995
* Optional. How long to retain unacknowledged messages in the subscription's backlog, from the moment a message is published. If `retain_acked_messages` is true, then this also configures the retention of acknowledged messages, and thus configures how far back in time a `Seek` can be done. Defaults to 7 days. Cannot be more than 31 days or less than 10 minutes.
970996
*/
971997
messageRetentionDuration?: string | null;
998+
/**
999+
* Optional. Transforms to be applied to messages before they are delivered to subscribers. Transforms are applied in the order specified.
1000+
*/
1001+
messageTransforms?: Schema$MessageTransform[];
9721002
/**
9731003
* Required. The name of the subscription. It must have the format `"projects/{project\}/subscriptions/{subscription\}"`. `{subscription\}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
9741004
*/
@@ -982,7 +1012,7 @@ export namespace pubsub_v1 {
9821012
*/
9831013
retainAckedMessages?: boolean | null;
9841014
/**
985-
* Optional. 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.
1015+
* Optional. 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 acknowledgment deadline exceeded events for a given message.
9861016
*/
9871017
retryPolicy?: Schema$RetryPolicy;
9881018
/**
@@ -1053,6 +1083,10 @@ export namespace pubsub_v1 {
10531083
* Optional. Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect.
10541084
*/
10551085
messageStoragePolicy?: Schema$MessageStoragePolicy;
1086+
/**
1087+
* Optional. Transforms to be applied to messages published to the topic. Transforms are applied in the order specified.
1088+
*/
1089+
messageTransforms?: Schema$MessageTransform[];
10561090
/**
10571091
* Required. The name of the topic. It must have the format `"projects/{project\}/topics/{topic\}"`. `{topic\}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`.
10581092
*/

0 commit comments

Comments
 (0)