google-cloud-pubsub 1.7.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +53 -0
  4. data/OVERVIEW.md +26 -58
  5. data/lib/google-cloud-pubsub.rb +14 -13
  6. data/lib/google/cloud/pubsub.rb +15 -18
  7. data/lib/google/cloud/pubsub/async_publisher.rb +2 -3
  8. data/lib/google/cloud/pubsub/credentials.rb +2 -2
  9. data/lib/google/cloud/pubsub/message.rb +1 -1
  10. data/lib/google/cloud/pubsub/project.rb +1 -1
  11. data/lib/google/cloud/pubsub/received_message.rb +4 -4
  12. data/lib/google/cloud/pubsub/service.rb +110 -260
  13. data/lib/google/cloud/pubsub/subscriber.rb +3 -3
  14. data/lib/google/cloud/pubsub/subscriber/stream.rb +3 -2
  15. data/lib/google/cloud/pubsub/subscription.rb +86 -11
  16. data/lib/google/cloud/pubsub/subscription/push_config.rb +55 -31
  17. data/lib/google/cloud/pubsub/topic.rb +52 -14
  18. data/lib/google/cloud/pubsub/version.rb +1 -1
  19. metadata +8 -79
  20. data/lib/google/cloud/pubsub/v1.rb +0 -17
  21. data/lib/google/cloud/pubsub/v1/credentials.rb +0 -41
  22. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -21
  23. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb +0 -21
  24. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -21
  25. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -91
  26. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +0 -29
  27. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -222
  28. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -113
  29. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -807
  30. data/lib/google/cloud/pubsub/v1/doc/google/type/expr.rb +0 -19
  31. data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -928
  32. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -120
  33. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1463
  34. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -153
  35. data/lib/google/pubsub/v1/pubsub_pb.rb +0 -266
  36. data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -215
@@ -1,113 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone or local
19
- # calendar, encoded as a count of seconds and fractions of seconds at
20
- # nanosecond resolution. The count is relative to an epoch at UTC midnight on
21
- # January 1, 1970, in the proleptic Gregorian calendar which extends the
22
- # Gregorian calendar backwards to year one.
23
- #
24
- # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
25
- # second table is needed for interpretation, using a [24-hour linear
26
- # smear](https://developers.google.com/time/smear).
27
- #
28
- # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
29
- # restricting to that range, we ensure that we can convert to and from [RFC
30
- # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
31
- #
32
- # = Examples
33
- #
34
- # Example 1: Compute Timestamp from POSIX `time()`.
35
- #
36
- # Timestamp timestamp;
37
- # timestamp.set_seconds(time(NULL));
38
- # timestamp.set_nanos(0);
39
- #
40
- # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
41
- #
42
- # struct timeval tv;
43
- # gettimeofday(&tv, NULL);
44
- #
45
- # Timestamp timestamp;
46
- # timestamp.set_seconds(tv.tv_sec);
47
- # timestamp.set_nanos(tv.tv_usec * 1000);
48
- #
49
- # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
50
- #
51
- # FILETIME ft;
52
- # GetSystemTimeAsFileTime(&ft);
53
- # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
54
- #
55
- # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
56
- # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
57
- # Timestamp timestamp;
58
- # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
59
- # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
60
- #
61
- # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
62
- #
63
- # long millis = System.currentTimeMillis();
64
- #
65
- # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
66
- # .setNanos((int) ((millis % 1000) * 1000000)).build();
67
- #
68
- #
69
- # Example 5: Compute Timestamp from current time in Python.
70
- #
71
- # timestamp = Timestamp()
72
- # timestamp.GetCurrentTime()
73
- #
74
- # = JSON Mapping
75
- #
76
- # In JSON format, the Timestamp type is encoded as a string in the
77
- # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
78
- # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
79
- # where \\{year} is always expressed using four digits while \\{month}, \\{day},
80
- # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
81
- # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
82
- # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
83
- # is required. A proto3 JSON serializer should always use UTC (as indicated by
84
- # "Z") when printing the Timestamp type and a proto3 JSON parser should be
85
- # able to accept both UTC and other timezones (as indicated by an offset).
86
- #
87
- # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
88
- # 01:30 UTC on January 15, 2017.
89
- #
90
- # In JavaScript, one can convert a Date object to this format using the
91
- # standard
92
- # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
93
- # method. In Python, a standard `datetime.datetime` object can be converted
94
- # to this format using
95
- # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
96
- # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
97
- # the Joda Time's [`ISODateTimeFormat.dateTime()`](
98
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
99
- # ) to obtain a formatter capable of generating timestamps in this format.
100
- # @!attribute [rw] seconds
101
- # @return [Integer]
102
- # Represents seconds of UTC time since Unix epoch
103
- # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
104
- # 9999-12-31T23:59:59Z inclusive.
105
- # @!attribute [rw] nanos
106
- # @return [Integer]
107
- # Non-negative fractions of a second at nanosecond resolution. Negative
108
- # second values with fractions must still have non-negative nanos values
109
- # that count forward in time. Must be from 0 to 999,999,999
110
- # inclusive.
111
- class Timestamp; end
112
- end
113
- end
@@ -1,807 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Cloud
18
- module PubSub
19
- module V1
20
- # @!attribute [rw] allowed_persistence_regions
21
- # @return [Array<String>]
22
- # A list of IDs of GCP regions where messages that are published to the topic
23
- # may be persisted in storage. Messages published by publishers running in
24
- # non-allowed GCP regions (or running outside of GCP altogether) will be
25
- # routed for storage in one of the allowed regions. An empty list means that
26
- # no regions are allowed, and is not a valid configuration.
27
- class MessageStoragePolicy; end
28
-
29
- # A topic resource.
30
- # @!attribute [rw] name
31
- # @return [String]
32
- # Required. The name of the topic. It must have the format
33
- # `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
34
- # and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
35
- # underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
36
- # signs (`%`). It must be between 3 and 255 characters in length, and it
37
- # must not start with `"goog"`.
38
- # @!attribute [rw] labels
39
- # @return [Hash{String => String}]
40
- # See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
41
- # managing labels</a>.
42
- # @!attribute [rw] message_storage_policy
43
- # @return [Google::Cloud::PubSub::V1::MessageStoragePolicy]
44
- # Policy constraining the set of Google Cloud Platform regions where messages
45
- # published to the topic may be stored. If not present, then no constraints
46
- # are in effect.
47
- # @!attribute [rw] kms_key_name
48
- # @return [String]
49
- # The resource name of the Cloud KMS CryptoKey to be used to protect access
50
- # to messages published on this topic.
51
- #
52
- # The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
53
- class Topic; end
54
-
55
- # A message that is published by publishers and consumed by subscribers. The
56
- # message must contain either a non-empty data field or at least one attribute.
57
- # Note that client libraries represent this object differently
58
- # depending on the language. See the corresponding
59
- # <a href="https://cloud.google.com/pubsub/docs/reference/libraries">client
60
- # library documentation</a> for more information. See
61
- # <a href="https://cloud.google.com/pubsub/quotas">Quotas and limits</a>
62
- # for more information about message limits.
63
- # @!attribute [rw] data
64
- # @return [String]
65
- # The message data field. If this field is empty, the message must contain
66
- # at least one attribute.
67
- # @!attribute [rw] attributes
68
- # @return [Hash{String => String}]
69
- # Attributes for this message. If this field is empty, the message must
70
- # contain non-empty data.
71
- # @!attribute [rw] message_id
72
- # @return [String]
73
- # ID of this message, assigned by the server when the message is published.
74
- # Guaranteed to be unique within the topic. This value may be read by a
75
- # subscriber that receives a `PubsubMessage` via a `Pull` call or a push
76
- # delivery. It must not be populated by the publisher in a `Publish` call.
77
- # @!attribute [rw] publish_time
78
- # @return [Google::Protobuf::Timestamp]
79
- # The time at which the message was published, populated by the server when
80
- # it receives the `Publish` call. It must not be populated by the
81
- # publisher in a `Publish` call.
82
- # @!attribute [rw] ordering_key
83
- # @return [String]
84
- # If non-empty, identifies related messages for which publish order should be
85
- # respected. If a `Subscription` has `enable_message_ordering` set to `true`,
86
- # messages published with the same non-empty `ordering_key` value will be
87
- # delivered to subscribers in the order in which they are received by the
88
- # Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
89
- # must specify the same `ordering_key` value.
90
- # <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
91
- # API might be changed in backward-incompatible ways and is not recommended
92
- # for production use. It is not subject to any SLA or deprecation policy.
93
- class PubsubMessage; end
94
-
95
- # Request for the GetTopic method.
96
- # @!attribute [rw] topic
97
- # @return [String]
98
- # Required. The name of the topic to get.
99
- # Format is `projects/{project}/topics/{topic}`.
100
- class GetTopicRequest; end
101
-
102
- # Request for the UpdateTopic method.
103
- # @!attribute [rw] topic
104
- # @return [Google::Cloud::PubSub::V1::Topic]
105
- # Required. The updated topic object.
106
- # @!attribute [rw] update_mask
107
- # @return [Google::Protobuf::FieldMask]
108
- # Required. Indicates which fields in the provided topic to update. Must be
109
- # specified and non-empty. Note that if `update_mask` contains
110
- # "message_storage_policy" but the `message_storage_policy` is not set in
111
- # the `topic` provided above, then the updated value is determined by the
112
- # policy configured at the project or organization level.
113
- class UpdateTopicRequest; end
114
-
115
- # Request for the Publish method.
116
- # @!attribute [rw] topic
117
- # @return [String]
118
- # Required. The messages in the request will be published on this topic.
119
- # Format is `projects/{project}/topics/{topic}`.
120
- # @!attribute [rw] messages
121
- # @return [Array<Google::Cloud::PubSub::V1::PubsubMessage>]
122
- # Required. The messages to publish.
123
- class PublishRequest; end
124
-
125
- # Response for the `Publish` method.
126
- # @!attribute [rw] message_ids
127
- # @return [Array<String>]
128
- # The server-assigned ID of each published message, in the same order as
129
- # the messages in the request. IDs are guaranteed to be unique within
130
- # the topic.
131
- class PublishResponse; end
132
-
133
- # Request for the `ListTopics` method.
134
- # @!attribute [rw] project
135
- # @return [String]
136
- # Required. The name of the project in which to list topics.
137
- # Format is `projects/{project-id}`.
138
- # @!attribute [rw] page_size
139
- # @return [Integer]
140
- # Maximum number of topics to return.
141
- # @!attribute [rw] page_token
142
- # @return [String]
143
- # The value returned by the last `ListTopicsResponse`; indicates that this is
144
- # a continuation of a prior `ListTopics` call, and that the system should
145
- # return the next page of data.
146
- class ListTopicsRequest; end
147
-
148
- # Response for the `ListTopics` method.
149
- # @!attribute [rw] topics
150
- # @return [Array<Google::Cloud::PubSub::V1::Topic>]
151
- # The resulting topics.
152
- # @!attribute [rw] next_page_token
153
- # @return [String]
154
- # If not empty, indicates that there may be more topics that match the
155
- # request; this value should be passed in a new `ListTopicsRequest`.
156
- class ListTopicsResponse; end
157
-
158
- # Request for the `ListTopicSubscriptions` method.
159
- # @!attribute [rw] topic
160
- # @return [String]
161
- # Required. The name of the topic that subscriptions are attached to.
162
- # Format is `projects/{project}/topics/{topic}`.
163
- # @!attribute [rw] page_size
164
- # @return [Integer]
165
- # Maximum number of subscription names to return.
166
- # @!attribute [rw] page_token
167
- # @return [String]
168
- # The value returned by the last `ListTopicSubscriptionsResponse`; indicates
169
- # that this is a continuation of a prior `ListTopicSubscriptions` call, and
170
- # that the system should return the next page of data.
171
- class ListTopicSubscriptionsRequest; end
172
-
173
- # Response for the `ListTopicSubscriptions` method.
174
- # @!attribute [rw] subscriptions
175
- # @return [Array<String>]
176
- # The names of subscriptions attached to the topic specified in the request.
177
- # @!attribute [rw] next_page_token
178
- # @return [String]
179
- # If not empty, indicates that there may be more subscriptions that match
180
- # the request; this value should be passed in a new
181
- # `ListTopicSubscriptionsRequest` to get more subscriptions.
182
- class ListTopicSubscriptionsResponse; end
183
-
184
- # Request for the `ListTopicSnapshots` method.
185
- # @!attribute [rw] topic
186
- # @return [String]
187
- # Required. The name of the topic that snapshots are attached to.
188
- # Format is `projects/{project}/topics/{topic}`.
189
- # @!attribute [rw] page_size
190
- # @return [Integer]
191
- # Maximum number of snapshot names to return.
192
- # @!attribute [rw] page_token
193
- # @return [String]
194
- # The value returned by the last `ListTopicSnapshotsResponse`; indicates
195
- # that this is a continuation of a prior `ListTopicSnapshots` call, and
196
- # that the system should return the next page of data.
197
- class ListTopicSnapshotsRequest; end
198
-
199
- # Response for the `ListTopicSnapshots` method.
200
- # @!attribute [rw] snapshots
201
- # @return [Array<String>]
202
- # The names of the snapshots that match the request.
203
- # @!attribute [rw] next_page_token
204
- # @return [String]
205
- # If not empty, indicates that there may be more snapshots that match
206
- # the request; this value should be passed in a new
207
- # `ListTopicSnapshotsRequest` to get more snapshots.
208
- class ListTopicSnapshotsResponse; end
209
-
210
- # Request for the `DeleteTopic` method.
211
- # @!attribute [rw] topic
212
- # @return [String]
213
- # Required. Name of the topic to delete.
214
- # Format is `projects/{project}/topics/{topic}`.
215
- class DeleteTopicRequest; end
216
-
217
- # Request for the DetachSubscription method.
218
- # @!attribute [rw] subscription
219
- # @return [String]
220
- # Required. The subscription to detach.
221
- # Format is `projects/{project}/subscriptions/{subscription}`.
222
- class DetachSubscriptionRequest; end
223
-
224
- # Response for the DetachSubscription method.
225
- # Reserved for future use.
226
- class DetachSubscriptionResponse; end
227
-
228
- # A subscription resource.
229
- # @!attribute [rw] name
230
- # @return [String]
231
- # Required. The name of the subscription. It must have the format
232
- # `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
233
- # start with a letter, and contain only letters (`[A-Za-z]`), numbers
234
- # (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
235
- # plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
236
- # in length, and it must not start with `"goog"`.
237
- # @!attribute [rw] topic
238
- # @return [String]
239
- # Required. The name of the topic from which this subscription is receiving
240
- # messages. Format is `projects/{project}/topics/{topic}`. The value of this
241
- # field will be `_deleted-topic_` if the topic has been deleted.
242
- # @!attribute [rw] push_config
243
- # @return [Google::Cloud::PubSub::V1::PushConfig]
244
- # If push delivery is used with this subscription, this field is
245
- # used to configure it. An empty `pushConfig` signifies that the subscriber
246
- # will pull and ack messages using API methods.
247
- # @!attribute [rw] ack_deadline_seconds
248
- # @return [Integer]
249
- # The approximate amount of time (on a best-effort basis) Pub/Sub waits for
250
- # the subscriber to acknowledge receipt before resending the message. In the
251
- # interval after the message is delivered and before it is acknowledged, it
252
- # is considered to be <i>outstanding</i>. During that time period, the
253
- # message will not be redelivered (on a best-effort basis).
254
- #
255
- # For pull subscriptions, this value is used as the initial value for the ack
256
- # deadline. To override this value for a given message, call
257
- # `ModifyAckDeadline` with the corresponding `ack_id` if using
258
- # non-streaming pull or send the `ack_id` in a
259
- # `StreamingModifyAckDeadlineRequest` if using streaming pull.
260
- # The minimum custom deadline you can specify is 10 seconds.
261
- # The maximum custom deadline you can specify is 600 seconds (10 minutes).
262
- # If this parameter is 0, a default value of 10 seconds is used.
263
- #
264
- # For push delivery, this value is also used to set the request timeout for
265
- # the call to the push endpoint.
266
- #
267
- # If the subscriber never acknowledges the message, the Pub/Sub
268
- # system will eventually redeliver the message.
269
- # @!attribute [rw] retain_acked_messages
270
- # @return [true, false]
271
- # Indicates whether to retain acknowledged messages. If true, then
272
- # messages are not expunged from the subscription's backlog, even if they are
273
- # acknowledged, until they fall out of the `message_retention_duration`
274
- # window. This must be true if you would like to
275
- # <a
276
- # href="https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time">
277
- # Seek to a timestamp</a>.
278
- # @!attribute [rw] message_retention_duration
279
- # @return [Google::Protobuf::Duration]
280
- # How long to retain unacknowledged messages in the subscription's backlog,
281
- # from the moment a message is published.
282
- # If `retain_acked_messages` is true, then this also configures the retention
283
- # of acknowledged messages, and thus configures how far back in time a `Seek`
284
- # can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
285
- # minutes.
286
- # @!attribute [rw] labels
287
- # @return [Hash{String => String}]
288
- # See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
289
- # managing labels</a>.
290
- # @!attribute [rw] enable_message_ordering
291
- # @return [true, false]
292
- # If true, messages published with the same `ordering_key` in `PubsubMessage`
293
- # will be delivered to the subscribers in the order in which they
294
- # are received by the Pub/Sub system. Otherwise, they may be delivered in
295
- # any order.
296
- # <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
297
- # API might be changed in backward-incompatible ways and is not recommended
298
- # for production use. It is not subject to any SLA or deprecation policy.
299
- # @!attribute [rw] expiration_policy
300
- # @return [Google::Cloud::PubSub::V1::ExpirationPolicy]
301
- # A policy that specifies the conditions for this subscription's expiration.
302
- # A subscription is considered active as long as any connected subscriber is
303
- # successfully consuming messages from the subscription or is issuing
304
- # operations on the subscription. If `expiration_policy` is not set, a
305
- # *default policy* with `ttl` of 31 days will be used. The minimum allowed
306
- # value for `expiration_policy.ttl` is 1 day.
307
- # @!attribute [rw] filter
308
- # @return [String]
309
- # An expression written in the Cloud Pub/Sub filter language. If non-empty,
310
- # then only `PubsubMessage`s whose `attributes` field matches the filter are
311
- # delivered on this subscription. If empty, then no messages are filtered
312
- # out.
313
- # <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
314
- # API might be changed in backward-incompatible ways and is not recommended
315
- # for production use. It is not subject to any SLA or deprecation policy.
316
- # @!attribute [rw] dead_letter_policy
317
- # @return [Google::Cloud::PubSub::V1::DeadLetterPolicy]
318
- # A policy that specifies the conditions for dead lettering messages in
319
- # this subscription. If dead_letter_policy is not set, dead lettering
320
- # is disabled.
321
- #
322
- # The Cloud Pub/Sub service account associated with this subscriptions's
323
- # parent project (i.e.,
324
- # service-\\{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
325
- # permission to Acknowledge() messages on this subscription.
326
- # @!attribute [rw] retry_policy
327
- # @return [Google::Cloud::PubSub::V1::RetryPolicy]
328
- # A policy that specifies how Cloud Pub/Sub retries message delivery for this
329
- # subscription.
330
- #
331
- # If not set, the default retry policy is applied. This generally implies
332
- # that messages will be retried as soon as possible for healthy subscribers.
333
- # RetryPolicy will be triggered on NACKs or acknowledgement deadline
334
- # exceeded events for a given message.
335
- # <b>EXPERIMENTAL:</b> This API might be changed in backward-incompatible
336
- # ways and is not recommended for production use. It is not subject to any
337
- # SLA or deprecation policy.
338
- class Subscription; end
339
-
340
- # A policy that specifies how Cloud Pub/Sub retries message delivery.
341
- #
342
- # Retry delay will be exponential based on provided minimum and maximum
343
- # backoffs. https://en.wikipedia.org/wiki/Exponential_backoff.
344
- #
345
- # RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded
346
- # events for a given message.
347
- #
348
- # Retry Policy is implemented on a best effort basis. At times, the delay
349
- # between consecutive deliveries may not match the configuration. That is,
350
- # delay can be more or less than configured backoff.
351
- # @!attribute [rw] minimum_backoff
352
- # @return [Google::Protobuf::Duration]
353
- # The minimum delay between consecutive deliveries of a given message.
354
- # Value should be between 0 and 600 seconds. Defaults to 10 seconds.
355
- # @!attribute [rw] maximum_backoff
356
- # @return [Google::Protobuf::Duration]
357
- # The maximum delay between consecutive deliveries of a given message.
358
- # Value should be between 0 and 600 seconds. Defaults to 600 seconds.
359
- class RetryPolicy; end
360
-
361
- # Dead lettering is done on a best effort basis. The same message might be
362
- # dead lettered multiple times.
363
- #
364
- # If validation on any of the fields fails at subscription creation/updation,
365
- # the create/update subscription request will fail.
366
- # @!attribute [rw] dead_letter_topic
367
- # @return [String]
368
- # The name of the topic to which dead letter messages should be published.
369
- # Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service
370
- # account associated with the enclosing subscription's parent project (i.e.,
371
- # service-\\{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
372
- # permission to Publish() to this topic.
373
- #
374
- # The operation will fail if the topic does not exist.
375
- # Users should ensure that there is a subscription attached to this topic
376
- # since messages published to a topic with no subscriptions are lost.
377
- # @!attribute [rw] max_delivery_attempts
378
- # @return [Integer]
379
- # The maximum number of delivery attempts for any message. The value must be
380
- # between 5 and 100.
381
- #
382
- # The number of delivery attempts is defined as 1 + (the sum of number of
383
- # NACKs and number of times the acknowledgement deadline has been exceeded
384
- # for the message).
385
- #
386
- # A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
387
- # client libraries may automatically extend ack_deadlines.
388
- #
389
- # This field will be honored on a best effort basis.
390
- #
391
- # If this parameter is 0, a default value of 5 is used.
392
- class DeadLetterPolicy; end
393
-
394
- # A policy that specifies the conditions for resource expiration (i.e.,
395
- # automatic resource deletion).
396
- # @!attribute [rw] ttl
397
- # @return [Google::Protobuf::Duration]
398
- # Specifies the "time-to-live" duration for an associated resource. The
399
- # resource expires if it is not active for a period of `ttl`. The definition
400
- # of "activity" depends on the type of the associated resource. The minimum
401
- # and maximum allowed values for `ttl` depend on the type of the associated
402
- # resource, as well. If `ttl` is not set, the associated resource never
403
- # expires.
404
- class ExpirationPolicy; end
405
-
406
- # Configuration for a push delivery endpoint.
407
- # @!attribute [rw] push_endpoint
408
- # @return [String]
409
- # A URL locating the endpoint to which messages should be pushed.
410
- # For example, a Webhook endpoint might use `https://example.com/push`.
411
- # @!attribute [rw] attributes
412
- # @return [Hash{String => String}]
413
- # Endpoint configuration attributes that can be used to control different
414
- # aspects of the message delivery.
415
- #
416
- # The only currently supported attribute is `x-goog-version`, which you can
417
- # use to change the format of the pushed message. This attribute
418
- # indicates the version of the data expected by the endpoint. This
419
- # controls the shape of the pushed message (i.e., its fields and metadata).
420
- #
421
- # If not present during the `CreateSubscription` call, it will default to
422
- # the version of the Pub/Sub API used to make such call. If not present in a
423
- # `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
424
- # calls will always return a valid version, even if the subscription was
425
- # created without this attribute.
426
- #
427
- # The only supported values for the `x-goog-version` attribute are:
428
- #
429
- # * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
430
- # * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
431
- #
432
- # For example:
433
- # <pre><code>attributes { "x-goog-version": "v1" } </code></pre>
434
- # @!attribute [rw] oidc_token
435
- # @return [Google::Cloud::PubSub::V1::PushConfig::OidcToken]
436
- # If specified, Pub/Sub will generate and attach an OIDC JWT token as an
437
- # `Authorization` header in the HTTP request for every pushed message.
438
- class PushConfig
439
- # Contains information needed for generating an
440
- # [OpenID Connect
441
- # token](https://developers.google.com/identity/protocols/OpenIDConnect).
442
- # @!attribute [rw] service_account_email
443
- # @return [String]
444
- # [Service account
445
- # email](https://cloud.google.com/iam/docs/service-accounts)
446
- # to be used for generating the OIDC token. The caller (for
447
- # CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must
448
- # have the iam.serviceAccounts.actAs permission for the service account.
449
- # @!attribute [rw] audience
450
- # @return [String]
451
- # Audience to be used when generating OIDC token. The audience claim
452
- # identifies the recipients that the JWT is intended for. The audience
453
- # value is a single case-sensitive string. Having multiple values (array)
454
- # for the audience field is not supported. More info about the OIDC JWT
455
- # token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3
456
- # Note: if not specified, the Push endpoint URL will be used.
457
- class OidcToken; end
458
- end
459
-
460
- # A message and its corresponding acknowledgment ID.
461
- # @!attribute [rw] ack_id
462
- # @return [String]
463
- # This ID can be used to acknowledge the received message.
464
- # @!attribute [rw] message
465
- # @return [Google::Cloud::PubSub::V1::PubsubMessage]
466
- # The message.
467
- # @!attribute [rw] delivery_attempt
468
- # @return [Integer]
469
- # The approximate number of times that Cloud Pub/Sub has attempted to deliver
470
- # the associated message to a subscriber.
471
- #
472
- # More precisely, this is 1 + (number of NACKs) +
473
- # (number of ack_deadline exceeds) for this message.
474
- #
475
- # A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline
476
- # exceeds event is whenever a message is not acknowledged within
477
- # ack_deadline. Note that ack_deadline is initially
478
- # Subscription.ackDeadlineSeconds, but may get extended automatically by
479
- # the client library.
480
- #
481
- # Upon the first delivery of a given message, `delivery_attempt` will have a
482
- # value of 1. The value is calculated at best effort and is approximate.
483
- #
484
- # If a DeadLetterPolicy is not set on the subscription, this will be 0.
485
- class ReceivedMessage; end
486
-
487
- # Request for the GetSubscription method.
488
- # @!attribute [rw] subscription
489
- # @return [String]
490
- # Required. The name of the subscription to get.
491
- # Format is `projects/{project}/subscriptions/{sub}`.
492
- class GetSubscriptionRequest; end
493
-
494
- # Request for the UpdateSubscription method.
495
- # @!attribute [rw] subscription
496
- # @return [Google::Cloud::PubSub::V1::Subscription]
497
- # Required. The updated subscription object.
498
- # @!attribute [rw] update_mask
499
- # @return [Google::Protobuf::FieldMask]
500
- # Required. Indicates which fields in the provided subscription to update.
501
- # Must be specified and non-empty.
502
- class UpdateSubscriptionRequest; end
503
-
504
- # Request for the `ListSubscriptions` method.
505
- # @!attribute [rw] project
506
- # @return [String]
507
- # Required. The name of the project in which to list subscriptions.
508
- # Format is `projects/{project-id}`.
509
- # @!attribute [rw] page_size
510
- # @return [Integer]
511
- # Maximum number of subscriptions to return.
512
- # @!attribute [rw] page_token
513
- # @return [String]
514
- # The value returned by the last `ListSubscriptionsResponse`; indicates that
515
- # this is a continuation of a prior `ListSubscriptions` call, and that the
516
- # system should return the next page of data.
517
- class ListSubscriptionsRequest; end
518
-
519
- # Response for the `ListSubscriptions` method.
520
- # @!attribute [rw] subscriptions
521
- # @return [Array<Google::Cloud::PubSub::V1::Subscription>]
522
- # The subscriptions that match the request.
523
- # @!attribute [rw] next_page_token
524
- # @return [String]
525
- # If not empty, indicates that there may be more subscriptions that match
526
- # the request; this value should be passed in a new
527
- # `ListSubscriptionsRequest` to get more subscriptions.
528
- class ListSubscriptionsResponse; end
529
-
530
- # Request for the DeleteSubscription method.
531
- # @!attribute [rw] subscription
532
- # @return [String]
533
- # Required. The subscription to delete.
534
- # Format is `projects/{project}/subscriptions/{sub}`.
535
- class DeleteSubscriptionRequest; end
536
-
537
- # Request for the ModifyPushConfig method.
538
- # @!attribute [rw] subscription
539
- # @return [String]
540
- # Required. The name of the subscription.
541
- # Format is `projects/{project}/subscriptions/{sub}`.
542
- # @!attribute [rw] push_config
543
- # @return [Google::Cloud::PubSub::V1::PushConfig]
544
- # Required. The push configuration for future deliveries.
545
- #
546
- # An empty `pushConfig` indicates that the Pub/Sub system should
547
- # stop pushing messages from the given subscription and allow
548
- # messages to be pulled and acknowledged - effectively pausing
549
- # the subscription if `Pull` or `StreamingPull` is not called.
550
- class ModifyPushConfigRequest; end
551
-
552
- # Request for the `Pull` method.
553
- # @!attribute [rw] subscription
554
- # @return [String]
555
- # Required. The subscription from which messages should be pulled.
556
- # Format is `projects/{project}/subscriptions/{sub}`.
557
- # @!attribute [rw] return_immediately
558
- # @return [true, false]
559
- # Optional. If this field set to true, the system will respond immediately
560
- # even if it there are no messages available to return in the `Pull`
561
- # response. Otherwise, the system may wait (for a bounded amount of time)
562
- # until at least one message is available, rather than returning no messages.
563
- # Warning: setting this field to `true` is discouraged because it adversely
564
- # impacts the performance of `Pull` operations. We recommend that users do
565
- # not set this field.
566
- # @!attribute [rw] max_messages
567
- # @return [Integer]
568
- # Required. The maximum number of messages to return for this request. Must
569
- # be a positive integer. The Pub/Sub system may return fewer than the number
570
- # specified.
571
- class PullRequest; end
572
-
573
- # Response for the `Pull` method.
574
- # @!attribute [rw] received_messages
575
- # @return [Array<Google::Cloud::PubSub::V1::ReceivedMessage>]
576
- # Received Pub/Sub messages. The list will be empty if there are no more
577
- # messages available in the backlog. For JSON, the response can be entirely
578
- # empty. The Pub/Sub system may return fewer than the `maxMessages` requested
579
- # even if there are more messages available in the backlog.
580
- class PullResponse; end
581
-
582
- # Request for the ModifyAckDeadline method.
583
- # @!attribute [rw] subscription
584
- # @return [String]
585
- # Required. The name of the subscription.
586
- # Format is `projects/{project}/subscriptions/{sub}`.
587
- # @!attribute [rw] ack_ids
588
- # @return [Array<String>]
589
- # Required. List of acknowledgment IDs.
590
- # @!attribute [rw] ack_deadline_seconds
591
- # @return [Integer]
592
- # Required. The new ack deadline with respect to the time this request was
593
- # sent to the Pub/Sub system. For example, if the value is 10, the new ack
594
- # deadline will expire 10 seconds after the `ModifyAckDeadline` call was
595
- # made. Specifying zero might immediately make the message available for
596
- # delivery to another subscriber client. This typically results in an
597
- # increase in the rate of message redeliveries (that is, duplicates).
598
- # The minimum deadline you can specify is 0 seconds.
599
- # The maximum deadline you can specify is 600 seconds (10 minutes).
600
- class ModifyAckDeadlineRequest; end
601
-
602
- # Request for the Acknowledge method.
603
- # @!attribute [rw] subscription
604
- # @return [String]
605
- # Required. The subscription whose message is being acknowledged.
606
- # Format is `projects/{project}/subscriptions/{sub}`.
607
- # @!attribute [rw] ack_ids
608
- # @return [Array<String>]
609
- # Required. The acknowledgment ID for the messages being acknowledged that
610
- # was returned by the Pub/Sub system in the `Pull` response. Must not be
611
- # empty.
612
- class AcknowledgeRequest; end
613
-
614
- # Request for the `StreamingPull` streaming RPC method. This request is used to
615
- # establish the initial stream as well as to stream acknowledgements and ack
616
- # deadline modifications from the client to the server.
617
- # @!attribute [rw] subscription
618
- # @return [String]
619
- # Required. The subscription for which to initialize the new stream. This
620
- # must be provided in the first request on the stream, and must not be set in
621
- # subsequent requests from client to server.
622
- # Format is `projects/{project}/subscriptions/{sub}`.
623
- # @!attribute [rw] ack_ids
624
- # @return [Array<String>]
625
- # List of acknowledgement IDs for acknowledging previously received messages
626
- # (received on this stream or a different stream). If an ack ID has expired,
627
- # the corresponding message may be redelivered later. Acknowledging a message
628
- # more than once will not result in an error. If the acknowledgement ID is
629
- # malformed, the stream will be aborted with status `INVALID_ARGUMENT`.
630
- # @!attribute [rw] modify_deadline_seconds
631
- # @return [Array<Integer>]
632
- # The list of new ack deadlines for the IDs listed in
633
- # `modify_deadline_ack_ids`. The size of this list must be the same as the
634
- # size of `modify_deadline_ack_ids`. If it differs the stream will be aborted
635
- # with `INVALID_ARGUMENT`. Each element in this list is applied to the
636
- # element in the same position in `modify_deadline_ack_ids`. The new ack
637
- # deadline is with respect to the time this request was sent to the Pub/Sub
638
- # system. Must be >= 0. For example, if the value is 10, the new ack deadline
639
- # will expire 10 seconds after this request is received. If the value is 0,
640
- # the message is immediately made available for another streaming or
641
- # non-streaming pull request. If the value is < 0 (an error), the stream will
642
- # be aborted with status `INVALID_ARGUMENT`.
643
- # @!attribute [rw] modify_deadline_ack_ids
644
- # @return [Array<String>]
645
- # List of acknowledgement IDs whose deadline will be modified based on the
646
- # corresponding element in `modify_deadline_seconds`. This field can be used
647
- # to indicate that more time is needed to process a message by the
648
- # subscriber, or to make the message available for redelivery if the
649
- # processing was interrupted.
650
- # @!attribute [rw] stream_ack_deadline_seconds
651
- # @return [Integer]
652
- # Required. The ack deadline to use for the stream. This must be provided in
653
- # the first request on the stream, but it can also be updated on subsequent
654
- # requests from client to server. The minimum deadline you can specify is 10
655
- # seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
656
- # @!attribute [rw] client_id
657
- # @return [String]
658
- # A unique identifier that is used to distinguish client instances from each
659
- # other. Only needs to be provided on the initial request. When a stream
660
- # disconnects and reconnects for the same stream, the client_id should be set
661
- # to the same value so that state associated with the old stream can be
662
- # transferred to the new stream. The same client_id should not be used for
663
- # different client instances.
664
- class StreamingPullRequest; end
665
-
666
- # Response for the `StreamingPull` method. This response is used to stream
667
- # messages from the server to the client.
668
- # @!attribute [rw] received_messages
669
- # @return [Array<Google::Cloud::PubSub::V1::ReceivedMessage>]
670
- # Received Pub/Sub messages. This will not be empty.
671
- class StreamingPullResponse; end
672
-
673
- # Request for the `CreateSnapshot` method.
674
- # @!attribute [rw] name
675
- # @return [String]
676
- # Required. User-provided name for this snapshot. If the name is not provided
677
- # in the request, the server will assign a random name for this snapshot on
678
- # the same project as the subscription. Note that for REST API requests, you
679
- # must specify a name. See the <a
680
- # href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
681
- # name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
682
- # @!attribute [rw] subscription
683
- # @return [String]
684
- # Required. The subscription whose backlog the snapshot retains.
685
- # Specifically, the created snapshot is guaranteed to retain:
686
- # (a) The existing backlog on the subscription. More precisely, this is
687
- # defined as the messages in the subscription's backlog that are
688
- # unacknowledged upon the successful completion of the
689
- # `CreateSnapshot` request; as well as:
690
- # (b) Any messages published to the subscription's topic following the
691
- # successful completion of the CreateSnapshot request.
692
- # Format is `projects/{project}/subscriptions/{sub}`.
693
- # @!attribute [rw] labels
694
- # @return [Hash{String => String}]
695
- # See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
696
- # managing labels</a>.
697
- class CreateSnapshotRequest; end
698
-
699
- # Request for the UpdateSnapshot method.
700
- # @!attribute [rw] snapshot
701
- # @return [Google::Cloud::PubSub::V1::Snapshot]
702
- # Required. The updated snapshot object.
703
- # @!attribute [rw] update_mask
704
- # @return [Google::Protobuf::FieldMask]
705
- # Required. Indicates which fields in the provided snapshot to update.
706
- # Must be specified and non-empty.
707
- class UpdateSnapshotRequest; end
708
-
709
- # A snapshot resource. Snapshots are used in
710
- # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
711
- # operations, which allow
712
- # you to manage message acknowledgments in bulk. That is, you can set the
713
- # acknowledgment state of messages in an existing subscription to the state
714
- # captured by a snapshot.
715
- # @!attribute [rw] name
716
- # @return [String]
717
- # The name of the snapshot.
718
- # @!attribute [rw] topic
719
- # @return [String]
720
- # The name of the topic from which this snapshot is retaining messages.
721
- # @!attribute [rw] expire_time
722
- # @return [Google::Protobuf::Timestamp]
723
- # The snapshot is guaranteed to exist up until this time.
724
- # A newly-created snapshot expires no later than 7 days from the time of its
725
- # creation. Its exact lifetime is determined at creation by the existing
726
- # backlog in the source subscription. Specifically, the lifetime of the
727
- # snapshot is `7 days - (age of oldest unacked message in the subscription)`.
728
- # For example, consider a subscription whose oldest unacked message is 3 days
729
- # old. If a snapshot is created from this subscription, the snapshot -- which
730
- # will always capture this 3-day-old backlog as long as the snapshot
731
- # exists -- will expire in 4 days. The service will refuse to create a
732
- # snapshot that would expire in less than 1 hour after creation.
733
- # @!attribute [rw] labels
734
- # @return [Hash{String => String}]
735
- # See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
736
- # managing labels</a>.
737
- class Snapshot; end
738
-
739
- # Request for the GetSnapshot method.
740
- # @!attribute [rw] snapshot
741
- # @return [String]
742
- # Required. The name of the snapshot to get.
743
- # Format is `projects/{project}/snapshots/{snap}`.
744
- class GetSnapshotRequest; end
745
-
746
- # Request for the `ListSnapshots` method.
747
- # @!attribute [rw] project
748
- # @return [String]
749
- # Required. The name of the project in which to list snapshots.
750
- # Format is `projects/{project-id}`.
751
- # @!attribute [rw] page_size
752
- # @return [Integer]
753
- # Maximum number of snapshots to return.
754
- # @!attribute [rw] page_token
755
- # @return [String]
756
- # The value returned by the last `ListSnapshotsResponse`; indicates that this
757
- # is a continuation of a prior `ListSnapshots` call, and that the system
758
- # should return the next page of data.
759
- class ListSnapshotsRequest; end
760
-
761
- # Response for the `ListSnapshots` method.
762
- # @!attribute [rw] snapshots
763
- # @return [Array<Google::Cloud::PubSub::V1::Snapshot>]
764
- # The resulting snapshots.
765
- # @!attribute [rw] next_page_token
766
- # @return [String]
767
- # If not empty, indicates that there may be more snapshot that match the
768
- # request; this value should be passed in a new `ListSnapshotsRequest`.
769
- class ListSnapshotsResponse; end
770
-
771
- # Request for the `DeleteSnapshot` method.
772
- # @!attribute [rw] snapshot
773
- # @return [String]
774
- # Required. The name of the snapshot to delete.
775
- # Format is `projects/{project}/snapshots/{snap}`.
776
- class DeleteSnapshotRequest; end
777
-
778
- # Request for the `Seek` method.
779
- # @!attribute [rw] subscription
780
- # @return [String]
781
- # Required. The subscription to affect.
782
- # @!attribute [rw] time
783
- # @return [Google::Protobuf::Timestamp]
784
- # The time to seek to.
785
- # Messages retained in the subscription that were published before this
786
- # time are marked as acknowledged, and messages retained in the
787
- # subscription that were published after this time are marked as
788
- # unacknowledged. Note that this operation affects only those messages
789
- # retained in the subscription (configured by the combination of
790
- # `message_retention_duration` and `retain_acked_messages`). For example,
791
- # if `time` corresponds to a point before the message retention
792
- # window (or to a point before the system's notion of the subscription
793
- # creation time), only retained messages will be marked as unacknowledged,
794
- # and already-expunged messages will not be restored.
795
- # @!attribute [rw] snapshot
796
- # @return [String]
797
- # The snapshot to seek to. The snapshot's topic must be the same as that of
798
- # the provided subscription.
799
- # Format is `projects/{project}/snapshots/{snap}`.
800
- class SeekRequest; end
801
-
802
- # Response for the `Seek` method (this response is empty).
803
- class SeekResponse; end
804
- end
805
- end
806
- end
807
- end