google-cloud-pubsub 1.8.0 → 2.1.1

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