google-cloud-pubsub 1.10.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +41 -0
- data/OVERVIEW.md +26 -58
- data/lib/google-cloud-pubsub.rb +14 -13
- data/lib/google/cloud/pubsub.rb +15 -18
- data/lib/google/cloud/pubsub/async_publisher.rb +2 -3
- data/lib/google/cloud/pubsub/credentials.rb +2 -2
- data/lib/google/cloud/pubsub/message.rb +1 -1
- data/lib/google/cloud/pubsub/project.rb +1 -1
- data/lib/google/cloud/pubsub/received_message.rb +4 -4
- data/lib/google/cloud/pubsub/service.rb +102 -256
- data/lib/google/cloud/pubsub/subscriber.rb +3 -3
- data/lib/google/cloud/pubsub/subscriber/stream.rb +1 -2
- data/lib/google/cloud/pubsub/subscription.rb +19 -10
- data/lib/google/cloud/pubsub/subscription/push_config.rb +55 -31
- data/lib/google/cloud/pubsub/topic.rb +49 -15
- data/lib/google/cloud/pubsub/version.rb +1 -1
- metadata +8 -79
- data/lib/google/cloud/pubsub/v1.rb +0 -17
- data/lib/google/cloud/pubsub/v1/credentials.rb +0 -41
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -21
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb +0 -21
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -21
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -833
- data/lib/google/cloud/pubsub/v1/doc/google/type/expr.rb +0 -19
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -928
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -120
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1466
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -153
- data/lib/google/pubsub/v1/pubsub_pb.rb +0 -269
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -215
@@ -1,120 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"interfaces": {
|
3
|
-
"google.pubsub.v1.Publisher": {
|
4
|
-
"retry_codes": {
|
5
|
-
"idempotent": [
|
6
|
-
"ABORTED",
|
7
|
-
"UNAVAILABLE",
|
8
|
-
"UNKNOWN"
|
9
|
-
],
|
10
|
-
"non_idempotent2": [],
|
11
|
-
"non_idempotent": [
|
12
|
-
"UNAVAILABLE"
|
13
|
-
],
|
14
|
-
"idempotent2": [
|
15
|
-
"DEADLINE_EXCEEDED",
|
16
|
-
"UNAVAILABLE"
|
17
|
-
],
|
18
|
-
"none": [],
|
19
|
-
"publish": [
|
20
|
-
"ABORTED",
|
21
|
-
"CANCELLED",
|
22
|
-
"DEADLINE_EXCEEDED",
|
23
|
-
"INTERNAL",
|
24
|
-
"RESOURCE_EXHAUSTED",
|
25
|
-
"UNAVAILABLE",
|
26
|
-
"UNKNOWN"
|
27
|
-
]
|
28
|
-
},
|
29
|
-
"retry_params": {
|
30
|
-
"default": {
|
31
|
-
"initial_retry_delay_millis": 100,
|
32
|
-
"retry_delay_multiplier": 1.3,
|
33
|
-
"max_retry_delay_millis": 60000,
|
34
|
-
"initial_rpc_timeout_millis": 60000,
|
35
|
-
"rpc_timeout_multiplier": 1.0,
|
36
|
-
"max_rpc_timeout_millis": 60000,
|
37
|
-
"total_timeout_millis": 600000
|
38
|
-
},
|
39
|
-
"messaging": {
|
40
|
-
"initial_retry_delay_millis": 100,
|
41
|
-
"retry_delay_multiplier": 1.3,
|
42
|
-
"max_retry_delay_millis": 60000,
|
43
|
-
"initial_rpc_timeout_millis": 5000,
|
44
|
-
"rpc_timeout_multiplier": 1.3,
|
45
|
-
"max_rpc_timeout_millis": 60000,
|
46
|
-
"total_timeout_millis": 60000
|
47
|
-
}
|
48
|
-
},
|
49
|
-
"methods": {
|
50
|
-
"CreateTopic": {
|
51
|
-
"timeout_millis": 60000,
|
52
|
-
"retry_codes_name": "non_idempotent",
|
53
|
-
"retry_params_name": "default"
|
54
|
-
},
|
55
|
-
"UpdateTopic": {
|
56
|
-
"timeout_millis": 60000,
|
57
|
-
"retry_codes_name": "non_idempotent",
|
58
|
-
"retry_params_name": "default"
|
59
|
-
},
|
60
|
-
"Publish": {
|
61
|
-
"timeout_millis": 20000,
|
62
|
-
"retry_codes_name": "publish",
|
63
|
-
"retry_params_name": "messaging",
|
64
|
-
"bundling": {
|
65
|
-
"element_count_threshold": 100,
|
66
|
-
"element_count_limit": 1000,
|
67
|
-
"request_byte_threshold": 1048576,
|
68
|
-
"request_byte_limit": 10485760,
|
69
|
-
"delay_threshold_millis": 10
|
70
|
-
}
|
71
|
-
},
|
72
|
-
"GetTopic": {
|
73
|
-
"timeout_millis": 60000,
|
74
|
-
"retry_codes_name": "idempotent",
|
75
|
-
"retry_params_name": "default"
|
76
|
-
},
|
77
|
-
"ListTopics": {
|
78
|
-
"timeout_millis": 60000,
|
79
|
-
"retry_codes_name": "idempotent",
|
80
|
-
"retry_params_name": "default"
|
81
|
-
},
|
82
|
-
"ListTopicSubscriptions": {
|
83
|
-
"timeout_millis": 60000,
|
84
|
-
"retry_codes_name": "idempotent",
|
85
|
-
"retry_params_name": "default"
|
86
|
-
},
|
87
|
-
"ListTopicSnapshots": {
|
88
|
-
"timeout_millis": 60000,
|
89
|
-
"retry_codes_name": "idempotent2",
|
90
|
-
"retry_params_name": "default"
|
91
|
-
},
|
92
|
-
"DeleteTopic": {
|
93
|
-
"timeout_millis": 60000,
|
94
|
-
"retry_codes_name": "non_idempotent",
|
95
|
-
"retry_params_name": "default"
|
96
|
-
},
|
97
|
-
"SetIamPolicy": {
|
98
|
-
"timeout_millis": 60000,
|
99
|
-
"retry_codes_name": "non_idempotent",
|
100
|
-
"retry_params_name": "default"
|
101
|
-
},
|
102
|
-
"GetIamPolicy": {
|
103
|
-
"timeout_millis": 60000,
|
104
|
-
"retry_codes_name": "idempotent",
|
105
|
-
"retry_params_name": "default"
|
106
|
-
},
|
107
|
-
"TestIamPermissions": {
|
108
|
-
"timeout_millis": 60000,
|
109
|
-
"retry_codes_name": "non_idempotent",
|
110
|
-
"retry_params_name": "default"
|
111
|
-
},
|
112
|
-
"DetachSubscription": {
|
113
|
-
"timeout_millis": 60000,
|
114
|
-
"retry_codes_name": "non_idempotent2",
|
115
|
-
"retry_params_name": "default"
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
@@ -1,1466 +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
|
-
# EDITING INSTRUCTIONS
|
16
|
-
# This file was generated from the file
|
17
|
-
# https://github.com/googleapis/googleapis/blob/master/google/pubsub/v1/pubsub.proto,
|
18
|
-
# and updates to that file get reflected here through a refresh process.
|
19
|
-
# For the short term, the refresh process will only be runnable by Google
|
20
|
-
# engineers.
|
21
|
-
|
22
|
-
|
23
|
-
require "json"
|
24
|
-
require "pathname"
|
25
|
-
|
26
|
-
require "google/gax"
|
27
|
-
|
28
|
-
require "google/iam/v1/iam_policy_pb"
|
29
|
-
require "google/pubsub/v1/pubsub_pb"
|
30
|
-
require "google/cloud/pubsub/v1/credentials"
|
31
|
-
require "google/cloud/pubsub/version"
|
32
|
-
|
33
|
-
module Google
|
34
|
-
module Cloud
|
35
|
-
module PubSub
|
36
|
-
module V1
|
37
|
-
# The service that an application uses to manipulate subscriptions and to
|
38
|
-
# consume messages from a subscription via the `Pull` method or by
|
39
|
-
# establishing a bi-directional stream using the `StreamingPull` method.
|
40
|
-
#
|
41
|
-
# @!attribute [r] iam_policy_stub
|
42
|
-
# @return [Google::Iam::V1::IAMPolicy::Stub]
|
43
|
-
# @!attribute [r] subscriber_stub
|
44
|
-
# @return [Google::Cloud::PubSub::V1::Subscriber::Stub]
|
45
|
-
class SubscriberClient
|
46
|
-
# @private
|
47
|
-
attr_reader :iam_policy_stub, :subscriber_stub
|
48
|
-
|
49
|
-
# The default address of the service.
|
50
|
-
SERVICE_ADDRESS = "pubsub.googleapis.com".freeze
|
51
|
-
|
52
|
-
# The default port of the service.
|
53
|
-
DEFAULT_SERVICE_PORT = 443
|
54
|
-
|
55
|
-
# The default set of gRPC interceptors.
|
56
|
-
GRPC_INTERCEPTORS = []
|
57
|
-
|
58
|
-
DEFAULT_TIMEOUT = 30
|
59
|
-
|
60
|
-
PAGE_DESCRIPTORS = {
|
61
|
-
"list_subscriptions" => Google::Gax::PageDescriptor.new(
|
62
|
-
"page_token",
|
63
|
-
"next_page_token",
|
64
|
-
"subscriptions"),
|
65
|
-
"list_snapshots" => Google::Gax::PageDescriptor.new(
|
66
|
-
"page_token",
|
67
|
-
"next_page_token",
|
68
|
-
"snapshots")
|
69
|
-
}.freeze
|
70
|
-
|
71
|
-
private_constant :PAGE_DESCRIPTORS
|
72
|
-
|
73
|
-
# The scopes needed to make gRPC calls to all of the methods defined in
|
74
|
-
# this service.
|
75
|
-
ALL_SCOPES = [
|
76
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
77
|
-
"https://www.googleapis.com/auth/pubsub"
|
78
|
-
].freeze
|
79
|
-
|
80
|
-
|
81
|
-
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
82
|
-
"projects/{project}"
|
83
|
-
)
|
84
|
-
|
85
|
-
private_constant :PROJECT_PATH_TEMPLATE
|
86
|
-
|
87
|
-
SNAPSHOT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
88
|
-
"projects/{project}/snapshots/{snapshot}"
|
89
|
-
)
|
90
|
-
|
91
|
-
private_constant :SNAPSHOT_PATH_TEMPLATE
|
92
|
-
|
93
|
-
SUBSCRIPTION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
94
|
-
"projects/{project}/subscriptions/{subscription}"
|
95
|
-
)
|
96
|
-
|
97
|
-
private_constant :SUBSCRIPTION_PATH_TEMPLATE
|
98
|
-
|
99
|
-
TOPIC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
100
|
-
"projects/{project}/topics/{topic}"
|
101
|
-
)
|
102
|
-
|
103
|
-
private_constant :TOPIC_PATH_TEMPLATE
|
104
|
-
|
105
|
-
# Returns a fully-qualified project resource name string.
|
106
|
-
# @param project [String]
|
107
|
-
# @return [String]
|
108
|
-
def self.project_path project
|
109
|
-
PROJECT_PATH_TEMPLATE.render(
|
110
|
-
:"project" => project
|
111
|
-
)
|
112
|
-
end
|
113
|
-
|
114
|
-
# Returns a fully-qualified snapshot resource name string.
|
115
|
-
# @param project [String]
|
116
|
-
# @param snapshot [String]
|
117
|
-
# @return [String]
|
118
|
-
def self.snapshot_path project, snapshot
|
119
|
-
SNAPSHOT_PATH_TEMPLATE.render(
|
120
|
-
:"project" => project,
|
121
|
-
:"snapshot" => snapshot
|
122
|
-
)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Returns a fully-qualified subscription resource name string.
|
126
|
-
# @param project [String]
|
127
|
-
# @param subscription [String]
|
128
|
-
# @return [String]
|
129
|
-
def self.subscription_path project, subscription
|
130
|
-
SUBSCRIPTION_PATH_TEMPLATE.render(
|
131
|
-
:"project" => project,
|
132
|
-
:"subscription" => subscription
|
133
|
-
)
|
134
|
-
end
|
135
|
-
|
136
|
-
# Returns a fully-qualified topic resource name string.
|
137
|
-
# @param project [String]
|
138
|
-
# @param topic [String]
|
139
|
-
# @return [String]
|
140
|
-
def self.topic_path project, topic
|
141
|
-
TOPIC_PATH_TEMPLATE.render(
|
142
|
-
:"project" => project,
|
143
|
-
:"topic" => topic
|
144
|
-
)
|
145
|
-
end
|
146
|
-
|
147
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
148
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
149
|
-
# be many types.
|
150
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
151
|
-
# authenticating requests made by this client.
|
152
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
153
|
-
# credentials for this client.
|
154
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
155
|
-
# credentials for this client.
|
156
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
157
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
158
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
159
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
160
|
-
# metadata for requests, generally, to give OAuth credentials.
|
161
|
-
# @param scopes [Array<String>]
|
162
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
163
|
-
# an updater_proc is supplied.
|
164
|
-
# @param client_config [Hash]
|
165
|
-
# A Hash for call options for each method. See
|
166
|
-
# Google::Gax#construct_settings for the structure of
|
167
|
-
# this data. Falls back to the default config if not specified
|
168
|
-
# or the specified config is missing data points.
|
169
|
-
# @param timeout [Numeric]
|
170
|
-
# The default timeout, in seconds, for calls made through this client.
|
171
|
-
# @param metadata [Hash]
|
172
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
173
|
-
# @param service_address [String]
|
174
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
175
|
-
# @param service_port [Integer]
|
176
|
-
# Override for the service port, or `nil` to leave as the default.
|
177
|
-
# @param exception_transformer [Proc]
|
178
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
179
|
-
# custom error handling.
|
180
|
-
def initialize \
|
181
|
-
credentials: nil,
|
182
|
-
scopes: ALL_SCOPES,
|
183
|
-
client_config: {},
|
184
|
-
timeout: DEFAULT_TIMEOUT,
|
185
|
-
metadata: nil,
|
186
|
-
service_address: nil,
|
187
|
-
service_port: nil,
|
188
|
-
exception_transformer: nil,
|
189
|
-
lib_name: nil,
|
190
|
-
lib_version: ""
|
191
|
-
# These require statements are intentionally placed here to initialize
|
192
|
-
# the gRPC module only when it's required.
|
193
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
194
|
-
require "google/gax/grpc"
|
195
|
-
require "google/iam/v1/iam_policy_services_pb"
|
196
|
-
require "google/pubsub/v1/pubsub_services_pb"
|
197
|
-
|
198
|
-
credentials ||= Google::Cloud::PubSub::V1::Credentials.default
|
199
|
-
|
200
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
201
|
-
updater_proc = Google::Cloud::PubSub::V1::Credentials.new(credentials).updater_proc
|
202
|
-
end
|
203
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
204
|
-
channel = credentials
|
205
|
-
end
|
206
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
207
|
-
chan_creds = credentials
|
208
|
-
end
|
209
|
-
if credentials.is_a?(Proc)
|
210
|
-
updater_proc = credentials
|
211
|
-
end
|
212
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
213
|
-
updater_proc = credentials.updater_proc
|
214
|
-
end
|
215
|
-
|
216
|
-
package_version = Google::Cloud::PubSub::VERSION
|
217
|
-
|
218
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
219
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
220
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
221
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
222
|
-
google_api_client.freeze
|
223
|
-
|
224
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
225
|
-
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
226
|
-
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
227
|
-
end
|
228
|
-
headers.merge!(metadata) unless metadata.nil?
|
229
|
-
client_config_file = Pathname.new(__dir__).join(
|
230
|
-
"subscriber_client_config.json"
|
231
|
-
)
|
232
|
-
defaults = client_config_file.open do |f|
|
233
|
-
Google::Gax.construct_settings(
|
234
|
-
"google.pubsub.v1.Subscriber",
|
235
|
-
JSON.parse(f.read),
|
236
|
-
client_config,
|
237
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
238
|
-
timeout,
|
239
|
-
page_descriptors: PAGE_DESCRIPTORS,
|
240
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
241
|
-
metadata: headers
|
242
|
-
)
|
243
|
-
end
|
244
|
-
|
245
|
-
# Allow overriding the service path/port in subclasses.
|
246
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
247
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
248
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
249
|
-
@iam_policy_stub = Google::Gax::Grpc.create_stub(
|
250
|
-
service_path,
|
251
|
-
port,
|
252
|
-
chan_creds: chan_creds,
|
253
|
-
channel: channel,
|
254
|
-
updater_proc: updater_proc,
|
255
|
-
scopes: scopes,
|
256
|
-
interceptors: interceptors,
|
257
|
-
&Google::Iam::V1::IAMPolicy::Stub.method(:new)
|
258
|
-
)
|
259
|
-
@subscriber_stub = Google::Gax::Grpc.create_stub(
|
260
|
-
service_path,
|
261
|
-
port,
|
262
|
-
chan_creds: chan_creds,
|
263
|
-
channel: channel,
|
264
|
-
updater_proc: updater_proc,
|
265
|
-
scopes: scopes,
|
266
|
-
interceptors: interceptors,
|
267
|
-
&Google::Cloud::PubSub::V1::Subscriber::Stub.method(:new)
|
268
|
-
)
|
269
|
-
|
270
|
-
@create_subscription = Google::Gax.create_api_call(
|
271
|
-
@subscriber_stub.method(:create_subscription),
|
272
|
-
defaults["create_subscription"],
|
273
|
-
exception_transformer: exception_transformer,
|
274
|
-
params_extractor: proc do |request|
|
275
|
-
{'name' => request.name}
|
276
|
-
end
|
277
|
-
)
|
278
|
-
@get_subscription = Google::Gax.create_api_call(
|
279
|
-
@subscriber_stub.method(:get_subscription),
|
280
|
-
defaults["get_subscription"],
|
281
|
-
exception_transformer: exception_transformer,
|
282
|
-
params_extractor: proc do |request|
|
283
|
-
{'subscription' => request.subscription}
|
284
|
-
end
|
285
|
-
)
|
286
|
-
@update_subscription = Google::Gax.create_api_call(
|
287
|
-
@subscriber_stub.method(:update_subscription),
|
288
|
-
defaults["update_subscription"],
|
289
|
-
exception_transformer: exception_transformer,
|
290
|
-
params_extractor: proc do |request|
|
291
|
-
{'subscription.name' => request.subscription.name}
|
292
|
-
end
|
293
|
-
)
|
294
|
-
@list_subscriptions = Google::Gax.create_api_call(
|
295
|
-
@subscriber_stub.method(:list_subscriptions),
|
296
|
-
defaults["list_subscriptions"],
|
297
|
-
exception_transformer: exception_transformer,
|
298
|
-
params_extractor: proc do |request|
|
299
|
-
{'project' => request.project}
|
300
|
-
end
|
301
|
-
)
|
302
|
-
@delete_subscription = Google::Gax.create_api_call(
|
303
|
-
@subscriber_stub.method(:delete_subscription),
|
304
|
-
defaults["delete_subscription"],
|
305
|
-
exception_transformer: exception_transformer,
|
306
|
-
params_extractor: proc do |request|
|
307
|
-
{'subscription' => request.subscription}
|
308
|
-
end
|
309
|
-
)
|
310
|
-
@get_snapshot = Google::Gax.create_api_call(
|
311
|
-
@subscriber_stub.method(:get_snapshot),
|
312
|
-
defaults["get_snapshot"],
|
313
|
-
exception_transformer: exception_transformer,
|
314
|
-
params_extractor: proc do |request|
|
315
|
-
{'snapshot' => request.snapshot}
|
316
|
-
end
|
317
|
-
)
|
318
|
-
@modify_ack_deadline = Google::Gax.create_api_call(
|
319
|
-
@subscriber_stub.method(:modify_ack_deadline),
|
320
|
-
defaults["modify_ack_deadline"],
|
321
|
-
exception_transformer: exception_transformer,
|
322
|
-
params_extractor: proc do |request|
|
323
|
-
{'subscription' => request.subscription}
|
324
|
-
end
|
325
|
-
)
|
326
|
-
@acknowledge = Google::Gax.create_api_call(
|
327
|
-
@subscriber_stub.method(:acknowledge),
|
328
|
-
defaults["acknowledge"],
|
329
|
-
exception_transformer: exception_transformer,
|
330
|
-
params_extractor: proc do |request|
|
331
|
-
{'subscription' => request.subscription}
|
332
|
-
end
|
333
|
-
)
|
334
|
-
@pull = Google::Gax.create_api_call(
|
335
|
-
@subscriber_stub.method(:pull),
|
336
|
-
defaults["pull"],
|
337
|
-
exception_transformer: exception_transformer,
|
338
|
-
params_extractor: proc do |request|
|
339
|
-
{'subscription' => request.subscription}
|
340
|
-
end
|
341
|
-
)
|
342
|
-
@streaming_pull = Google::Gax.create_api_call(
|
343
|
-
@subscriber_stub.method(:streaming_pull),
|
344
|
-
defaults["streaming_pull"],
|
345
|
-
exception_transformer: exception_transformer
|
346
|
-
)
|
347
|
-
@modify_push_config = Google::Gax.create_api_call(
|
348
|
-
@subscriber_stub.method(:modify_push_config),
|
349
|
-
defaults["modify_push_config"],
|
350
|
-
exception_transformer: exception_transformer,
|
351
|
-
params_extractor: proc do |request|
|
352
|
-
{'subscription' => request.subscription}
|
353
|
-
end
|
354
|
-
)
|
355
|
-
@list_snapshots = Google::Gax.create_api_call(
|
356
|
-
@subscriber_stub.method(:list_snapshots),
|
357
|
-
defaults["list_snapshots"],
|
358
|
-
exception_transformer: exception_transformer,
|
359
|
-
params_extractor: proc do |request|
|
360
|
-
{'project' => request.project}
|
361
|
-
end
|
362
|
-
)
|
363
|
-
@create_snapshot = Google::Gax.create_api_call(
|
364
|
-
@subscriber_stub.method(:create_snapshot),
|
365
|
-
defaults["create_snapshot"],
|
366
|
-
exception_transformer: exception_transformer,
|
367
|
-
params_extractor: proc do |request|
|
368
|
-
{'name' => request.name}
|
369
|
-
end
|
370
|
-
)
|
371
|
-
@update_snapshot = Google::Gax.create_api_call(
|
372
|
-
@subscriber_stub.method(:update_snapshot),
|
373
|
-
defaults["update_snapshot"],
|
374
|
-
exception_transformer: exception_transformer,
|
375
|
-
params_extractor: proc do |request|
|
376
|
-
{'snapshot.name' => request.snapshot.name}
|
377
|
-
end
|
378
|
-
)
|
379
|
-
@delete_snapshot = Google::Gax.create_api_call(
|
380
|
-
@subscriber_stub.method(:delete_snapshot),
|
381
|
-
defaults["delete_snapshot"],
|
382
|
-
exception_transformer: exception_transformer,
|
383
|
-
params_extractor: proc do |request|
|
384
|
-
{'snapshot' => request.snapshot}
|
385
|
-
end
|
386
|
-
)
|
387
|
-
@seek = Google::Gax.create_api_call(
|
388
|
-
@subscriber_stub.method(:seek),
|
389
|
-
defaults["seek"],
|
390
|
-
exception_transformer: exception_transformer,
|
391
|
-
params_extractor: proc do |request|
|
392
|
-
{'subscription' => request.subscription}
|
393
|
-
end
|
394
|
-
)
|
395
|
-
@set_iam_policy = Google::Gax.create_api_call(
|
396
|
-
@iam_policy_stub.method(:set_iam_policy),
|
397
|
-
defaults["set_iam_policy"],
|
398
|
-
exception_transformer: exception_transformer,
|
399
|
-
params_extractor: proc do |request|
|
400
|
-
{'resource' => request.resource}
|
401
|
-
end
|
402
|
-
)
|
403
|
-
@get_iam_policy = Google::Gax.create_api_call(
|
404
|
-
@iam_policy_stub.method(:get_iam_policy),
|
405
|
-
defaults["get_iam_policy"],
|
406
|
-
exception_transformer: exception_transformer,
|
407
|
-
params_extractor: proc do |request|
|
408
|
-
{'resource' => request.resource}
|
409
|
-
end
|
410
|
-
)
|
411
|
-
@test_iam_permissions = Google::Gax.create_api_call(
|
412
|
-
@iam_policy_stub.method(:test_iam_permissions),
|
413
|
-
defaults["test_iam_permissions"],
|
414
|
-
exception_transformer: exception_transformer,
|
415
|
-
params_extractor: proc do |request|
|
416
|
-
{'resource' => request.resource}
|
417
|
-
end
|
418
|
-
)
|
419
|
-
end
|
420
|
-
|
421
|
-
# Service calls
|
422
|
-
|
423
|
-
# Creates a subscription to a given topic. See the
|
424
|
-
# <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
|
425
|
-
# resource name rules</a>.
|
426
|
-
# If the subscription already exists, returns `ALREADY_EXISTS`.
|
427
|
-
# If the corresponding topic doesn't exist, returns `NOT_FOUND`.
|
428
|
-
#
|
429
|
-
# If the name is not provided in the request, the server will assign a random
|
430
|
-
# name for this subscription on the same project as the topic, conforming
|
431
|
-
# to the
|
432
|
-
# [resource name
|
433
|
-
# format](https://cloud.google.com/pubsub/docs/admin#resource_names). The
|
434
|
-
# generated name is populated in the returned Subscription object. Note that
|
435
|
-
# for REST API requests, you must specify a name in the request.
|
436
|
-
#
|
437
|
-
# @param name [String]
|
438
|
-
# Required. The name of the subscription. It must have the format
|
439
|
-
# `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
|
440
|
-
# start with a letter, and contain only letters (`[A-Za-z]`), numbers
|
441
|
-
# (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
|
442
|
-
# plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
|
443
|
-
# in length, and it must not start with `"goog"`.
|
444
|
-
# @param topic [String]
|
445
|
-
# Required. The name of the topic from which this subscription is receiving
|
446
|
-
# messages. Format is `projects/{project}/topics/{topic}`. The value of this
|
447
|
-
# field will be `_deleted-topic_` if the topic has been deleted.
|
448
|
-
# @param push_config [Google::Cloud::PubSub::V1::PushConfig | Hash]
|
449
|
-
# If push delivery is used with this subscription, this field is
|
450
|
-
# used to configure it. An empty `pushConfig` signifies that the subscriber
|
451
|
-
# will pull and ack messages using API methods.
|
452
|
-
# A hash of the same form as `Google::Cloud::PubSub::V1::PushConfig`
|
453
|
-
# can also be provided.
|
454
|
-
# @param ack_deadline_seconds [Integer]
|
455
|
-
# The approximate amount of time (on a best-effort basis) Pub/Sub waits for
|
456
|
-
# the subscriber to acknowledge receipt before resending the message. In the
|
457
|
-
# interval after the message is delivered and before it is acknowledged, it
|
458
|
-
# is considered to be <i>outstanding</i>. During that time period, the
|
459
|
-
# message will not be redelivered (on a best-effort basis).
|
460
|
-
#
|
461
|
-
# For pull subscriptions, this value is used as the initial value for the ack
|
462
|
-
# deadline. To override this value for a given message, call
|
463
|
-
# `ModifyAckDeadline` with the corresponding `ack_id` if using
|
464
|
-
# non-streaming pull or send the `ack_id` in a
|
465
|
-
# `StreamingModifyAckDeadlineRequest` if using streaming pull.
|
466
|
-
# The minimum custom deadline you can specify is 10 seconds.
|
467
|
-
# The maximum custom deadline you can specify is 600 seconds (10 minutes).
|
468
|
-
# If this parameter is 0, a default value of 10 seconds is used.
|
469
|
-
#
|
470
|
-
# For push delivery, this value is also used to set the request timeout for
|
471
|
-
# the call to the push endpoint.
|
472
|
-
#
|
473
|
-
# If the subscriber never acknowledges the message, the Pub/Sub
|
474
|
-
# system will eventually redeliver the message.
|
475
|
-
# @param retain_acked_messages [true, false]
|
476
|
-
# Indicates whether to retain acknowledged messages. If true, then
|
477
|
-
# messages are not expunged from the subscription's backlog, even if they are
|
478
|
-
# acknowledged, until they fall out of the `message_retention_duration`
|
479
|
-
# window. This must be true if you would like to
|
480
|
-
# <a
|
481
|
-
# href="https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time">
|
482
|
-
# Seek to a timestamp</a>.
|
483
|
-
# @param message_retention_duration [Google::Protobuf::Duration | Hash]
|
484
|
-
# How long to retain unacknowledged messages in the subscription's backlog,
|
485
|
-
# from the moment a message is published.
|
486
|
-
# If `retain_acked_messages` is true, then this also configures the retention
|
487
|
-
# of acknowledged messages, and thus configures how far back in time a `Seek`
|
488
|
-
# can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
|
489
|
-
# minutes.
|
490
|
-
# A hash of the same form as `Google::Protobuf::Duration`
|
491
|
-
# can also be provided.
|
492
|
-
# @param labels [Hash{String => String}]
|
493
|
-
# See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
|
494
|
-
# managing labels</a>.
|
495
|
-
# @param enable_message_ordering [true, false]
|
496
|
-
# If true, messages published with the same `ordering_key` in `PubsubMessage`
|
497
|
-
# will be delivered to the subscribers in the order in which they
|
498
|
-
# are received by the Pub/Sub system. Otherwise, they may be delivered in
|
499
|
-
# any order.
|
500
|
-
# <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
|
501
|
-
# API might be changed in backward-incompatible ways and is not recommended
|
502
|
-
# for production use. It is not subject to any SLA or deprecation policy.
|
503
|
-
# @param expiration_policy [Google::Cloud::PubSub::V1::ExpirationPolicy | Hash]
|
504
|
-
# A policy that specifies the conditions for this subscription's expiration.
|
505
|
-
# A subscription is considered active as long as any connected subscriber is
|
506
|
-
# successfully consuming messages from the subscription or is issuing
|
507
|
-
# operations on the subscription. If `expiration_policy` is not set, a
|
508
|
-
# *default policy* with `ttl` of 31 days will be used. The minimum allowed
|
509
|
-
# value for `expiration_policy.ttl` is 1 day.
|
510
|
-
# A hash of the same form as `Google::Cloud::PubSub::V1::ExpirationPolicy`
|
511
|
-
# can also be provided.
|
512
|
-
# @param filter [String]
|
513
|
-
# An expression written in the Pub/Sub [filter
|
514
|
-
# language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
|
515
|
-
# then only `PubsubMessage`s whose `attributes` field matches the filter are
|
516
|
-
# delivered on this subscription. If empty, then no messages are filtered
|
517
|
-
# out.
|
518
|
-
# @param dead_letter_policy [Google::Cloud::PubSub::V1::DeadLetterPolicy | Hash]
|
519
|
-
# A policy that specifies the conditions for dead lettering messages in
|
520
|
-
# this subscription. If dead_letter_policy is not set, dead lettering
|
521
|
-
# is disabled.
|
522
|
-
#
|
523
|
-
# The Cloud Pub/Sub service account associated with this subscriptions's
|
524
|
-
# parent project (i.e.,
|
525
|
-
# service-\\{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
|
526
|
-
# permission to Acknowledge() messages on this subscription.
|
527
|
-
# A hash of the same form as `Google::Cloud::PubSub::V1::DeadLetterPolicy`
|
528
|
-
# can also be provided.
|
529
|
-
# @param retry_policy [Google::Cloud::PubSub::V1::RetryPolicy | Hash]
|
530
|
-
# A policy that specifies how Pub/Sub retries message delivery for this
|
531
|
-
# subscription.
|
532
|
-
#
|
533
|
-
# If not set, the default retry policy is applied. This generally implies
|
534
|
-
# that messages will be retried as soon as possible for healthy subscribers.
|
535
|
-
# RetryPolicy will be triggered on NACKs or acknowledgement deadline
|
536
|
-
# exceeded events for a given message.
|
537
|
-
# A hash of the same form as `Google::Cloud::PubSub::V1::RetryPolicy`
|
538
|
-
# can also be provided.
|
539
|
-
# @param detached [true, false]
|
540
|
-
# Indicates whether the subscription is detached from its topic. Detached
|
541
|
-
# subscriptions don't receive messages from their topic and don't retain any
|
542
|
-
# backlog. `Pull` and `StreamingPull` requests will return
|
543
|
-
# FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
|
544
|
-
# the endpoint will not be made.
|
545
|
-
# @param options [Google::Gax::CallOptions]
|
546
|
-
# Overrides the default settings for this call, e.g, timeout,
|
547
|
-
# retries, etc.
|
548
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
549
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::Subscription]
|
550
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
551
|
-
# @return [Google::Cloud::PubSub::V1::Subscription]
|
552
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
553
|
-
# @example
|
554
|
-
# require "google/cloud/pubsub"
|
555
|
-
#
|
556
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
557
|
-
# formatted_name = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
558
|
-
# formatted_topic = Google::Cloud::PubSub::V1::SubscriberClient.topic_path("[PROJECT]", "[TOPIC]")
|
559
|
-
# response = subscriber_client.create_subscription(formatted_name, formatted_topic)
|
560
|
-
|
561
|
-
def create_subscription \
|
562
|
-
name,
|
563
|
-
topic,
|
564
|
-
push_config: nil,
|
565
|
-
ack_deadline_seconds: nil,
|
566
|
-
retain_acked_messages: nil,
|
567
|
-
message_retention_duration: nil,
|
568
|
-
labels: nil,
|
569
|
-
enable_message_ordering: nil,
|
570
|
-
expiration_policy: nil,
|
571
|
-
filter: nil,
|
572
|
-
dead_letter_policy: nil,
|
573
|
-
retry_policy: nil,
|
574
|
-
detached: nil,
|
575
|
-
options: nil,
|
576
|
-
&block
|
577
|
-
req = {
|
578
|
-
name: name,
|
579
|
-
topic: topic,
|
580
|
-
push_config: push_config,
|
581
|
-
ack_deadline_seconds: ack_deadline_seconds,
|
582
|
-
retain_acked_messages: retain_acked_messages,
|
583
|
-
message_retention_duration: message_retention_duration,
|
584
|
-
labels: labels,
|
585
|
-
enable_message_ordering: enable_message_ordering,
|
586
|
-
expiration_policy: expiration_policy,
|
587
|
-
filter: filter,
|
588
|
-
dead_letter_policy: dead_letter_policy,
|
589
|
-
retry_policy: retry_policy,
|
590
|
-
detached: detached
|
591
|
-
}.delete_if { |_, v| v.nil? }
|
592
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::Subscription)
|
593
|
-
@create_subscription.call(req, options, &block)
|
594
|
-
end
|
595
|
-
|
596
|
-
# Gets the configuration details of a subscription.
|
597
|
-
#
|
598
|
-
# @param subscription [String]
|
599
|
-
# Required. The name of the subscription to get.
|
600
|
-
# Format is `projects/{project}/subscriptions/{sub}`.
|
601
|
-
# @param options [Google::Gax::CallOptions]
|
602
|
-
# Overrides the default settings for this call, e.g, timeout,
|
603
|
-
# retries, etc.
|
604
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
605
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::Subscription]
|
606
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
607
|
-
# @return [Google::Cloud::PubSub::V1::Subscription]
|
608
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
609
|
-
# @example
|
610
|
-
# require "google/cloud/pubsub"
|
611
|
-
#
|
612
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
613
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
614
|
-
# response = subscriber_client.get_subscription(formatted_subscription)
|
615
|
-
|
616
|
-
def get_subscription \
|
617
|
-
subscription,
|
618
|
-
options: nil,
|
619
|
-
&block
|
620
|
-
req = {
|
621
|
-
subscription: subscription
|
622
|
-
}.delete_if { |_, v| v.nil? }
|
623
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::GetSubscriptionRequest)
|
624
|
-
@get_subscription.call(req, options, &block)
|
625
|
-
end
|
626
|
-
|
627
|
-
# Updates an existing subscription. Note that certain properties of a
|
628
|
-
# subscription, such as its topic, are not modifiable.
|
629
|
-
#
|
630
|
-
# @param subscription [Google::Cloud::PubSub::V1::Subscription | Hash]
|
631
|
-
# Required. The updated subscription object.
|
632
|
-
# A hash of the same form as `Google::Cloud::PubSub::V1::Subscription`
|
633
|
-
# can also be provided.
|
634
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
635
|
-
# Required. Indicates which fields in the provided subscription to update.
|
636
|
-
# Must be specified and non-empty.
|
637
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
638
|
-
# can also be provided.
|
639
|
-
# @param options [Google::Gax::CallOptions]
|
640
|
-
# Overrides the default settings for this call, e.g, timeout,
|
641
|
-
# retries, etc.
|
642
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
643
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::Subscription]
|
644
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
645
|
-
# @return [Google::Cloud::PubSub::V1::Subscription]
|
646
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
647
|
-
# @example
|
648
|
-
# require "google/cloud/pubsub"
|
649
|
-
#
|
650
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
651
|
-
# ack_deadline_seconds = 42
|
652
|
-
# subscription = { ack_deadline_seconds: ack_deadline_seconds }
|
653
|
-
# paths_element = "ack_deadline_seconds"
|
654
|
-
# paths = [paths_element]
|
655
|
-
# update_mask = { paths: paths }
|
656
|
-
# response = subscriber_client.update_subscription(subscription, update_mask)
|
657
|
-
|
658
|
-
def update_subscription \
|
659
|
-
subscription,
|
660
|
-
update_mask,
|
661
|
-
options: nil,
|
662
|
-
&block
|
663
|
-
req = {
|
664
|
-
subscription: subscription,
|
665
|
-
update_mask: update_mask
|
666
|
-
}.delete_if { |_, v| v.nil? }
|
667
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::UpdateSubscriptionRequest)
|
668
|
-
@update_subscription.call(req, options, &block)
|
669
|
-
end
|
670
|
-
|
671
|
-
# Lists matching subscriptions.
|
672
|
-
#
|
673
|
-
# @param project [String]
|
674
|
-
# Required. The name of the project in which to list subscriptions.
|
675
|
-
# Format is `projects/{project-id}`.
|
676
|
-
# @param page_size [Integer]
|
677
|
-
# The maximum number of resources contained in the underlying API
|
678
|
-
# response. If page streaming is performed per-resource, this
|
679
|
-
# parameter does not affect the return value. If page streaming is
|
680
|
-
# performed per-page, this determines the maximum number of
|
681
|
-
# resources in a page.
|
682
|
-
# @param options [Google::Gax::CallOptions]
|
683
|
-
# Overrides the default settings for this call, e.g, timeout,
|
684
|
-
# retries, etc.
|
685
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
686
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Subscription>]
|
687
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
688
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Subscription>]
|
689
|
-
# An enumerable of Google::Cloud::PubSub::V1::Subscription instances.
|
690
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
691
|
-
# operations such as per-page iteration or access to the response
|
692
|
-
# object.
|
693
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
694
|
-
# @example
|
695
|
-
# require "google/cloud/pubsub"
|
696
|
-
#
|
697
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
698
|
-
# formatted_project = Google::Cloud::PubSub::V1::SubscriberClient.project_path("[PROJECT]")
|
699
|
-
#
|
700
|
-
# # Iterate over all results.
|
701
|
-
# subscriber_client.list_subscriptions(formatted_project).each do |element|
|
702
|
-
# # Process element.
|
703
|
-
# end
|
704
|
-
#
|
705
|
-
# # Or iterate over results one page at a time.
|
706
|
-
# subscriber_client.list_subscriptions(formatted_project).each_page do |page|
|
707
|
-
# # Process each page at a time.
|
708
|
-
# page.each do |element|
|
709
|
-
# # Process element.
|
710
|
-
# end
|
711
|
-
# end
|
712
|
-
|
713
|
-
def list_subscriptions \
|
714
|
-
project,
|
715
|
-
page_size: nil,
|
716
|
-
options: nil,
|
717
|
-
&block
|
718
|
-
req = {
|
719
|
-
project: project,
|
720
|
-
page_size: page_size
|
721
|
-
}.delete_if { |_, v| v.nil? }
|
722
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ListSubscriptionsRequest)
|
723
|
-
@list_subscriptions.call(req, options, &block)
|
724
|
-
end
|
725
|
-
|
726
|
-
# Deletes an existing subscription. All messages retained in the subscription
|
727
|
-
# are immediately dropped. Calls to `Pull` after deletion will return
|
728
|
-
# `NOT_FOUND`. After a subscription is deleted, a new one may be created with
|
729
|
-
# the same name, but the new one has no association with the old
|
730
|
-
# subscription or its topic unless the same topic is specified.
|
731
|
-
#
|
732
|
-
# @param subscription [String]
|
733
|
-
# Required. The subscription to delete.
|
734
|
-
# Format is `projects/{project}/subscriptions/{sub}`.
|
735
|
-
# @param options [Google::Gax::CallOptions]
|
736
|
-
# Overrides the default settings for this call, e.g, timeout,
|
737
|
-
# retries, etc.
|
738
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
739
|
-
# @yieldparam result []
|
740
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
741
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
742
|
-
# @example
|
743
|
-
# require "google/cloud/pubsub"
|
744
|
-
#
|
745
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
746
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
747
|
-
# subscriber_client.delete_subscription(formatted_subscription)
|
748
|
-
|
749
|
-
def delete_subscription \
|
750
|
-
subscription,
|
751
|
-
options: nil,
|
752
|
-
&block
|
753
|
-
req = {
|
754
|
-
subscription: subscription
|
755
|
-
}.delete_if { |_, v| v.nil? }
|
756
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::DeleteSubscriptionRequest)
|
757
|
-
@delete_subscription.call(req, options, &block)
|
758
|
-
nil
|
759
|
-
end
|
760
|
-
|
761
|
-
# Gets the configuration details of a snapshot. Snapshots are used in
|
762
|
-
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
763
|
-
# operations, which allow you to manage message acknowledgments in bulk. That
|
764
|
-
# is, you can set the acknowledgment state of messages in an existing
|
765
|
-
# subscription to the state captured by a snapshot.
|
766
|
-
#
|
767
|
-
# @param snapshot [String]
|
768
|
-
# Required. The name of the snapshot to get.
|
769
|
-
# Format is `projects/{project}/snapshots/{snap}`.
|
770
|
-
# @param options [Google::Gax::CallOptions]
|
771
|
-
# Overrides the default settings for this call, e.g, timeout,
|
772
|
-
# retries, etc.
|
773
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
774
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::Snapshot]
|
775
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
776
|
-
# @return [Google::Cloud::PubSub::V1::Snapshot]
|
777
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
778
|
-
# @example
|
779
|
-
# require "google/cloud/pubsub"
|
780
|
-
#
|
781
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
782
|
-
# formatted_snapshot = Google::Cloud::PubSub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
783
|
-
# response = subscriber_client.get_snapshot(formatted_snapshot)
|
784
|
-
|
785
|
-
def get_snapshot \
|
786
|
-
snapshot,
|
787
|
-
options: nil,
|
788
|
-
&block
|
789
|
-
req = {
|
790
|
-
snapshot: snapshot
|
791
|
-
}.delete_if { |_, v| v.nil? }
|
792
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::GetSnapshotRequest)
|
793
|
-
@get_snapshot.call(req, options, &block)
|
794
|
-
end
|
795
|
-
|
796
|
-
# Modifies the ack deadline for a specific message. This method is useful
|
797
|
-
# to indicate that more time is needed to process a message by the
|
798
|
-
# subscriber, or to make the message available for redelivery if the
|
799
|
-
# processing was interrupted. Note that this does not modify the
|
800
|
-
# subscription-level `ackDeadlineSeconds` used for subsequent messages.
|
801
|
-
#
|
802
|
-
# @param subscription [String]
|
803
|
-
# Required. The name of the subscription.
|
804
|
-
# Format is `projects/{project}/subscriptions/{sub}`.
|
805
|
-
# @param ack_ids [Array<String>]
|
806
|
-
# Required. List of acknowledgment IDs.
|
807
|
-
# @param ack_deadline_seconds [Integer]
|
808
|
-
# Required. The new ack deadline with respect to the time this request was
|
809
|
-
# sent to the Pub/Sub system. For example, if the value is 10, the new ack
|
810
|
-
# deadline will expire 10 seconds after the `ModifyAckDeadline` call was
|
811
|
-
# made. Specifying zero might immediately make the message available for
|
812
|
-
# delivery to another subscriber client. This typically results in an
|
813
|
-
# increase in the rate of message redeliveries (that is, duplicates).
|
814
|
-
# The minimum deadline you can specify is 0 seconds.
|
815
|
-
# The maximum deadline you can specify is 600 seconds (10 minutes).
|
816
|
-
# @param options [Google::Gax::CallOptions]
|
817
|
-
# Overrides the default settings for this call, e.g, timeout,
|
818
|
-
# retries, etc.
|
819
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
820
|
-
# @yieldparam result []
|
821
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
822
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
823
|
-
# @example
|
824
|
-
# require "google/cloud/pubsub"
|
825
|
-
#
|
826
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
827
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
828
|
-
#
|
829
|
-
# # TODO: Initialize `ack_ids`:
|
830
|
-
# ack_ids = []
|
831
|
-
#
|
832
|
-
# # TODO: Initialize `ack_deadline_seconds`:
|
833
|
-
# ack_deadline_seconds = 0
|
834
|
-
# subscriber_client.modify_ack_deadline(formatted_subscription, ack_ids, ack_deadline_seconds)
|
835
|
-
|
836
|
-
def modify_ack_deadline \
|
837
|
-
subscription,
|
838
|
-
ack_ids,
|
839
|
-
ack_deadline_seconds,
|
840
|
-
options: nil,
|
841
|
-
&block
|
842
|
-
req = {
|
843
|
-
subscription: subscription,
|
844
|
-
ack_ids: ack_ids,
|
845
|
-
ack_deadline_seconds: ack_deadline_seconds
|
846
|
-
}.delete_if { |_, v| v.nil? }
|
847
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest)
|
848
|
-
@modify_ack_deadline.call(req, options, &block)
|
849
|
-
nil
|
850
|
-
end
|
851
|
-
|
852
|
-
# Acknowledges the messages associated with the `ack_ids` in the
|
853
|
-
# `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages
|
854
|
-
# from the subscription.
|
855
|
-
#
|
856
|
-
# Acknowledging a message whose ack deadline has expired may succeed,
|
857
|
-
# but such a message may be redelivered later. Acknowledging a message more
|
858
|
-
# than once will not result in an error.
|
859
|
-
#
|
860
|
-
# @param subscription [String]
|
861
|
-
# Required. The subscription whose message is being acknowledged.
|
862
|
-
# Format is `projects/{project}/subscriptions/{sub}`.
|
863
|
-
# @param ack_ids [Array<String>]
|
864
|
-
# Required. The acknowledgment ID for the messages being acknowledged that
|
865
|
-
# was returned by the Pub/Sub system in the `Pull` response. Must not be
|
866
|
-
# empty.
|
867
|
-
# @param options [Google::Gax::CallOptions]
|
868
|
-
# Overrides the default settings for this call, e.g, timeout,
|
869
|
-
# retries, etc.
|
870
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
871
|
-
# @yieldparam result []
|
872
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
873
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
874
|
-
# @example
|
875
|
-
# require "google/cloud/pubsub"
|
876
|
-
#
|
877
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
878
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
879
|
-
#
|
880
|
-
# # TODO: Initialize `ack_ids`:
|
881
|
-
# ack_ids = []
|
882
|
-
# subscriber_client.acknowledge(formatted_subscription, ack_ids)
|
883
|
-
|
884
|
-
def acknowledge \
|
885
|
-
subscription,
|
886
|
-
ack_ids,
|
887
|
-
options: nil,
|
888
|
-
&block
|
889
|
-
req = {
|
890
|
-
subscription: subscription,
|
891
|
-
ack_ids: ack_ids
|
892
|
-
}.delete_if { |_, v| v.nil? }
|
893
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::AcknowledgeRequest)
|
894
|
-
@acknowledge.call(req, options, &block)
|
895
|
-
nil
|
896
|
-
end
|
897
|
-
|
898
|
-
# Pulls messages from the server. The server may return `UNAVAILABLE` if
|
899
|
-
# there are too many concurrent pull requests pending for the given
|
900
|
-
# subscription.
|
901
|
-
#
|
902
|
-
# @param subscription [String]
|
903
|
-
# Required. The subscription from which messages should be pulled.
|
904
|
-
# Format is `projects/{project}/subscriptions/{sub}`.
|
905
|
-
# @param max_messages [Integer]
|
906
|
-
# Required. The maximum number of messages to return for this request. Must
|
907
|
-
# be a positive integer. The Pub/Sub system may return fewer than the number
|
908
|
-
# specified.
|
909
|
-
# @param return_immediately [true, false]
|
910
|
-
# Optional. If this field set to true, the system will respond immediately
|
911
|
-
# even if it there are no messages available to return in the `Pull`
|
912
|
-
# response. Otherwise, the system may wait (for a bounded amount of time)
|
913
|
-
# until at least one message is available, rather than returning no messages.
|
914
|
-
# Warning: setting this field to `true` is discouraged because it adversely
|
915
|
-
# impacts the performance of `Pull` operations. We recommend that users do
|
916
|
-
# not set this field.
|
917
|
-
# @param options [Google::Gax::CallOptions]
|
918
|
-
# Overrides the default settings for this call, e.g, timeout,
|
919
|
-
# retries, etc.
|
920
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
921
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::PullResponse]
|
922
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
923
|
-
# @return [Google::Cloud::PubSub::V1::PullResponse]
|
924
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
925
|
-
# @example
|
926
|
-
# require "google/cloud/pubsub"
|
927
|
-
#
|
928
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
929
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
930
|
-
#
|
931
|
-
# # TODO: Initialize `max_messages`:
|
932
|
-
# max_messages = 0
|
933
|
-
# response = subscriber_client.pull(formatted_subscription, max_messages)
|
934
|
-
|
935
|
-
def pull \
|
936
|
-
subscription,
|
937
|
-
max_messages,
|
938
|
-
return_immediately: nil,
|
939
|
-
options: nil,
|
940
|
-
&block
|
941
|
-
req = {
|
942
|
-
subscription: subscription,
|
943
|
-
max_messages: max_messages,
|
944
|
-
return_immediately: return_immediately
|
945
|
-
}.delete_if { |_, v| v.nil? }
|
946
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::PullRequest)
|
947
|
-
@pull.call(req, options, &block)
|
948
|
-
end
|
949
|
-
|
950
|
-
# Establishes a stream with the server, which sends messages down to the
|
951
|
-
# client. The client streams acknowledgements and ack deadline modifications
|
952
|
-
# back to the server. The server will close the stream and return the status
|
953
|
-
# on any error. The server may close the stream with status `UNAVAILABLE` to
|
954
|
-
# reassign server-side resources, in which case, the client should
|
955
|
-
# re-establish the stream. Flow control can be achieved by configuring the
|
956
|
-
# underlying RPC channel.
|
957
|
-
#
|
958
|
-
# @param reqs [Enumerable<Google::Cloud::PubSub::V1::StreamingPullRequest>]
|
959
|
-
# The input requests.
|
960
|
-
# @param options [Google::Gax::CallOptions]
|
961
|
-
# Overrides the default settings for this call, e.g, timeout,
|
962
|
-
# retries, etc.
|
963
|
-
# @return [Enumerable<Google::Cloud::PubSub::V1::StreamingPullResponse>]
|
964
|
-
# An enumerable of Google::Cloud::PubSub::V1::StreamingPullResponse instances.
|
965
|
-
#
|
966
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
967
|
-
#
|
968
|
-
# @note
|
969
|
-
# EXPERIMENTAL:
|
970
|
-
# Streaming requests are still undergoing review.
|
971
|
-
# This method interface might change in the future.
|
972
|
-
#
|
973
|
-
# @example
|
974
|
-
# require "google/cloud/pubsub"
|
975
|
-
#
|
976
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
977
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
978
|
-
#
|
979
|
-
# # TODO: Initialize `stream_ack_deadline_seconds`:
|
980
|
-
# stream_ack_deadline_seconds = 0
|
981
|
-
# request = { subscription: formatted_subscription, stream_ack_deadline_seconds: stream_ack_deadline_seconds }
|
982
|
-
# requests = [request]
|
983
|
-
# subscriber_client.streaming_pull(requests).each do |element|
|
984
|
-
# # Process element.
|
985
|
-
# end
|
986
|
-
|
987
|
-
def streaming_pull reqs, options: nil
|
988
|
-
request_protos = reqs.lazy.map do |req|
|
989
|
-
Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::StreamingPullRequest)
|
990
|
-
end
|
991
|
-
@streaming_pull.call(request_protos, options)
|
992
|
-
end
|
993
|
-
|
994
|
-
# Modifies the `PushConfig` for a specified subscription.
|
995
|
-
#
|
996
|
-
# This may be used to change a push subscription to a pull one (signified by
|
997
|
-
# an empty `PushConfig`) or vice versa, or change the endpoint URL and other
|
998
|
-
# attributes of a push subscription. Messages will accumulate for delivery
|
999
|
-
# continuously through the call regardless of changes to the `PushConfig`.
|
1000
|
-
#
|
1001
|
-
# @param subscription [String]
|
1002
|
-
# Required. The name of the subscription.
|
1003
|
-
# Format is `projects/{project}/subscriptions/{sub}`.
|
1004
|
-
# @param push_config [Google::Cloud::PubSub::V1::PushConfig | Hash]
|
1005
|
-
# Required. The push configuration for future deliveries.
|
1006
|
-
#
|
1007
|
-
# An empty `pushConfig` indicates that the Pub/Sub system should
|
1008
|
-
# stop pushing messages from the given subscription and allow
|
1009
|
-
# messages to be pulled and acknowledged - effectively pausing
|
1010
|
-
# the subscription if `Pull` or `StreamingPull` is not called.
|
1011
|
-
# A hash of the same form as `Google::Cloud::PubSub::V1::PushConfig`
|
1012
|
-
# can also be provided.
|
1013
|
-
# @param options [Google::Gax::CallOptions]
|
1014
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1015
|
-
# retries, etc.
|
1016
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1017
|
-
# @yieldparam result []
|
1018
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1019
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1020
|
-
# @example
|
1021
|
-
# require "google/cloud/pubsub"
|
1022
|
-
#
|
1023
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1024
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1025
|
-
#
|
1026
|
-
# # TODO: Initialize `push_config`:
|
1027
|
-
# push_config = {}
|
1028
|
-
# subscriber_client.modify_push_config(formatted_subscription, push_config)
|
1029
|
-
|
1030
|
-
def modify_push_config \
|
1031
|
-
subscription,
|
1032
|
-
push_config,
|
1033
|
-
options: nil,
|
1034
|
-
&block
|
1035
|
-
req = {
|
1036
|
-
subscription: subscription,
|
1037
|
-
push_config: push_config
|
1038
|
-
}.delete_if { |_, v| v.nil? }
|
1039
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ModifyPushConfigRequest)
|
1040
|
-
@modify_push_config.call(req, options, &block)
|
1041
|
-
nil
|
1042
|
-
end
|
1043
|
-
|
1044
|
-
# Lists the existing snapshots. Snapshots are used in
|
1045
|
-
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
1046
|
-
# operations, which allow
|
1047
|
-
# you to manage message acknowledgments in bulk. That is, you can set the
|
1048
|
-
# acknowledgment state of messages in an existing subscription to the state
|
1049
|
-
# captured by a snapshot.
|
1050
|
-
#
|
1051
|
-
# @param project [String]
|
1052
|
-
# Required. The name of the project in which to list snapshots.
|
1053
|
-
# Format is `projects/{project-id}`.
|
1054
|
-
# @param page_size [Integer]
|
1055
|
-
# The maximum number of resources contained in the underlying API
|
1056
|
-
# response. If page streaming is performed per-resource, this
|
1057
|
-
# parameter does not affect the return value. If page streaming is
|
1058
|
-
# performed per-page, this determines the maximum number of
|
1059
|
-
# resources in a page.
|
1060
|
-
# @param options [Google::Gax::CallOptions]
|
1061
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1062
|
-
# retries, etc.
|
1063
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1064
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Snapshot>]
|
1065
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1066
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Snapshot>]
|
1067
|
-
# An enumerable of Google::Cloud::PubSub::V1::Snapshot instances.
|
1068
|
-
# See Google::Gax::PagedEnumerable documentation for other
|
1069
|
-
# operations such as per-page iteration or access to the response
|
1070
|
-
# object.
|
1071
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1072
|
-
# @example
|
1073
|
-
# require "google/cloud/pubsub"
|
1074
|
-
#
|
1075
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1076
|
-
# formatted_project = Google::Cloud::PubSub::V1::SubscriberClient.project_path("[PROJECT]")
|
1077
|
-
#
|
1078
|
-
# # Iterate over all results.
|
1079
|
-
# subscriber_client.list_snapshots(formatted_project).each do |element|
|
1080
|
-
# # Process element.
|
1081
|
-
# end
|
1082
|
-
#
|
1083
|
-
# # Or iterate over results one page at a time.
|
1084
|
-
# subscriber_client.list_snapshots(formatted_project).each_page do |page|
|
1085
|
-
# # Process each page at a time.
|
1086
|
-
# page.each do |element|
|
1087
|
-
# # Process element.
|
1088
|
-
# end
|
1089
|
-
# end
|
1090
|
-
|
1091
|
-
def list_snapshots \
|
1092
|
-
project,
|
1093
|
-
page_size: nil,
|
1094
|
-
options: nil,
|
1095
|
-
&block
|
1096
|
-
req = {
|
1097
|
-
project: project,
|
1098
|
-
page_size: page_size
|
1099
|
-
}.delete_if { |_, v| v.nil? }
|
1100
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ListSnapshotsRequest)
|
1101
|
-
@list_snapshots.call(req, options, &block)
|
1102
|
-
end
|
1103
|
-
|
1104
|
-
# Creates a snapshot from the requested subscription. Snapshots are used in
|
1105
|
-
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
1106
|
-
# operations, which allow
|
1107
|
-
# you to manage message acknowledgments in bulk. That is, you can set the
|
1108
|
-
# acknowledgment state of messages in an existing subscription to the state
|
1109
|
-
# captured by a snapshot.
|
1110
|
-
# <br><br>If the snapshot already exists, returns `ALREADY_EXISTS`.
|
1111
|
-
# If the requested subscription doesn't exist, returns `NOT_FOUND`.
|
1112
|
-
# If the backlog in the subscription is too old -- and the resulting snapshot
|
1113
|
-
# would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
|
1114
|
-
# See also the `Snapshot.expire_time` field. If the name is not provided in
|
1115
|
-
# the request, the server will assign a random
|
1116
|
-
# name for this snapshot on the same project as the subscription, conforming
|
1117
|
-
# to the
|
1118
|
-
# [resource name
|
1119
|
-
# format](https://cloud.google.com/pubsub/docs/admin#resource_names). The
|
1120
|
-
# generated name is populated in the returned Snapshot object. Note that for
|
1121
|
-
# REST API requests, you must specify a name in the request.
|
1122
|
-
#
|
1123
|
-
# @param name [String]
|
1124
|
-
# Required. User-provided name for this snapshot. If the name is not provided
|
1125
|
-
# in the request, the server will assign a random name for this snapshot on
|
1126
|
-
# the same project as the subscription. Note that for REST API requests, you
|
1127
|
-
# must specify a name. See the <a
|
1128
|
-
# href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
|
1129
|
-
# name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
|
1130
|
-
# @param subscription [String]
|
1131
|
-
# Required. The subscription whose backlog the snapshot retains.
|
1132
|
-
# Specifically, the created snapshot is guaranteed to retain:
|
1133
|
-
# (a) The existing backlog on the subscription. More precisely, this is
|
1134
|
-
# defined as the messages in the subscription's backlog that are
|
1135
|
-
# unacknowledged upon the successful completion of the
|
1136
|
-
# `CreateSnapshot` request; as well as:
|
1137
|
-
# (b) Any messages published to the subscription's topic following the
|
1138
|
-
# successful completion of the CreateSnapshot request.
|
1139
|
-
# Format is `projects/{project}/subscriptions/{sub}`.
|
1140
|
-
# @param labels [Hash{String => String}]
|
1141
|
-
# See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
|
1142
|
-
# managing labels</a>.
|
1143
|
-
# @param options [Google::Gax::CallOptions]
|
1144
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1145
|
-
# retries, etc.
|
1146
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1147
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::Snapshot]
|
1148
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1149
|
-
# @return [Google::Cloud::PubSub::V1::Snapshot]
|
1150
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1151
|
-
# @example
|
1152
|
-
# require "google/cloud/pubsub"
|
1153
|
-
#
|
1154
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1155
|
-
# formatted_name = Google::Cloud::PubSub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
1156
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1157
|
-
# response = subscriber_client.create_snapshot(formatted_name, formatted_subscription)
|
1158
|
-
|
1159
|
-
def create_snapshot \
|
1160
|
-
name,
|
1161
|
-
subscription,
|
1162
|
-
labels: nil,
|
1163
|
-
options: nil,
|
1164
|
-
&block
|
1165
|
-
req = {
|
1166
|
-
name: name,
|
1167
|
-
subscription: subscription,
|
1168
|
-
labels: labels
|
1169
|
-
}.delete_if { |_, v| v.nil? }
|
1170
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::CreateSnapshotRequest)
|
1171
|
-
@create_snapshot.call(req, options, &block)
|
1172
|
-
end
|
1173
|
-
|
1174
|
-
# Updates an existing snapshot. Snapshots are used in
|
1175
|
-
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
1176
|
-
# operations, which allow
|
1177
|
-
# you to manage message acknowledgments in bulk. That is, you can set the
|
1178
|
-
# acknowledgment state of messages in an existing subscription to the state
|
1179
|
-
# captured by a snapshot.
|
1180
|
-
#
|
1181
|
-
# @param snapshot [Google::Cloud::PubSub::V1::Snapshot | Hash]
|
1182
|
-
# Required. The updated snapshot object.
|
1183
|
-
# A hash of the same form as `Google::Cloud::PubSub::V1::Snapshot`
|
1184
|
-
# can also be provided.
|
1185
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
1186
|
-
# Required. Indicates which fields in the provided snapshot to update.
|
1187
|
-
# Must be specified and non-empty.
|
1188
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
1189
|
-
# can also be provided.
|
1190
|
-
# @param options [Google::Gax::CallOptions]
|
1191
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1192
|
-
# retries, etc.
|
1193
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1194
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::Snapshot]
|
1195
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1196
|
-
# @return [Google::Cloud::PubSub::V1::Snapshot]
|
1197
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1198
|
-
# @example
|
1199
|
-
# require "google/cloud/pubsub"
|
1200
|
-
#
|
1201
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1202
|
-
# seconds = 123456
|
1203
|
-
# expire_time = { seconds: seconds }
|
1204
|
-
# snapshot = { expire_time: expire_time }
|
1205
|
-
# paths_element = "expire_time"
|
1206
|
-
# paths = [paths_element]
|
1207
|
-
# update_mask = { paths: paths }
|
1208
|
-
# response = subscriber_client.update_snapshot(snapshot, update_mask)
|
1209
|
-
|
1210
|
-
def update_snapshot \
|
1211
|
-
snapshot,
|
1212
|
-
update_mask,
|
1213
|
-
options: nil,
|
1214
|
-
&block
|
1215
|
-
req = {
|
1216
|
-
snapshot: snapshot,
|
1217
|
-
update_mask: update_mask
|
1218
|
-
}.delete_if { |_, v| v.nil? }
|
1219
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::UpdateSnapshotRequest)
|
1220
|
-
@update_snapshot.call(req, options, &block)
|
1221
|
-
end
|
1222
|
-
|
1223
|
-
# Removes an existing snapshot. Snapshots are used in
|
1224
|
-
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
1225
|
-
# operations, which allow
|
1226
|
-
# you to manage message acknowledgments in bulk. That is, you can set the
|
1227
|
-
# acknowledgment state of messages in an existing subscription to the state
|
1228
|
-
# captured by a snapshot.<br><br>
|
1229
|
-
# When the snapshot is deleted, all messages retained in the snapshot
|
1230
|
-
# are immediately dropped. After a snapshot is deleted, a new one may be
|
1231
|
-
# created with the same name, but the new one has no association with the old
|
1232
|
-
# snapshot or its subscription, unless the same subscription is specified.
|
1233
|
-
#
|
1234
|
-
# @param snapshot [String]
|
1235
|
-
# Required. The name of the snapshot to delete.
|
1236
|
-
# Format is `projects/{project}/snapshots/{snap}`.
|
1237
|
-
# @param options [Google::Gax::CallOptions]
|
1238
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1239
|
-
# retries, etc.
|
1240
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1241
|
-
# @yieldparam result []
|
1242
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1243
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1244
|
-
# @example
|
1245
|
-
# require "google/cloud/pubsub"
|
1246
|
-
#
|
1247
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1248
|
-
# formatted_snapshot = Google::Cloud::PubSub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
1249
|
-
# subscriber_client.delete_snapshot(formatted_snapshot)
|
1250
|
-
|
1251
|
-
def delete_snapshot \
|
1252
|
-
snapshot,
|
1253
|
-
options: nil,
|
1254
|
-
&block
|
1255
|
-
req = {
|
1256
|
-
snapshot: snapshot
|
1257
|
-
}.delete_if { |_, v| v.nil? }
|
1258
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::DeleteSnapshotRequest)
|
1259
|
-
@delete_snapshot.call(req, options, &block)
|
1260
|
-
nil
|
1261
|
-
end
|
1262
|
-
|
1263
|
-
# Seeks an existing subscription to a point in time or to a given snapshot,
|
1264
|
-
# whichever is provided in the request. Snapshots are used in
|
1265
|
-
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
1266
|
-
# operations, which allow
|
1267
|
-
# you to manage message acknowledgments in bulk. That is, you can set the
|
1268
|
-
# acknowledgment state of messages in an existing subscription to the state
|
1269
|
-
# captured by a snapshot. Note that both the subscription and the snapshot
|
1270
|
-
# must be on the same topic.
|
1271
|
-
#
|
1272
|
-
# @param subscription [String]
|
1273
|
-
# Required. The subscription to affect.
|
1274
|
-
# @param time [Google::Protobuf::Timestamp | Hash]
|
1275
|
-
# The time to seek to.
|
1276
|
-
# Messages retained in the subscription that were published before this
|
1277
|
-
# time are marked as acknowledged, and messages retained in the
|
1278
|
-
# subscription that were published after this time are marked as
|
1279
|
-
# unacknowledged. Note that this operation affects only those messages
|
1280
|
-
# retained in the subscription (configured by the combination of
|
1281
|
-
# `message_retention_duration` and `retain_acked_messages`). For example,
|
1282
|
-
# if `time` corresponds to a point before the message retention
|
1283
|
-
# window (or to a point before the system's notion of the subscription
|
1284
|
-
# creation time), only retained messages will be marked as unacknowledged,
|
1285
|
-
# and already-expunged messages will not be restored.
|
1286
|
-
# A hash of the same form as `Google::Protobuf::Timestamp`
|
1287
|
-
# can also be provided.
|
1288
|
-
# @param snapshot [String]
|
1289
|
-
# The snapshot to seek to. The snapshot's topic must be the same as that of
|
1290
|
-
# the provided subscription.
|
1291
|
-
# Format is `projects/{project}/snapshots/{snap}`.
|
1292
|
-
# @param options [Google::Gax::CallOptions]
|
1293
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1294
|
-
# retries, etc.
|
1295
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1296
|
-
# @yieldparam result [Google::Cloud::PubSub::V1::SeekResponse]
|
1297
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1298
|
-
# @return [Google::Cloud::PubSub::V1::SeekResponse]
|
1299
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1300
|
-
# @example
|
1301
|
-
# require "google/cloud/pubsub"
|
1302
|
-
#
|
1303
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1304
|
-
# formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1305
|
-
# response = subscriber_client.seek(formatted_subscription)
|
1306
|
-
|
1307
|
-
def seek \
|
1308
|
-
subscription,
|
1309
|
-
time: nil,
|
1310
|
-
snapshot: nil,
|
1311
|
-
options: nil,
|
1312
|
-
&block
|
1313
|
-
req = {
|
1314
|
-
subscription: subscription,
|
1315
|
-
time: time,
|
1316
|
-
snapshot: snapshot
|
1317
|
-
}.delete_if { |_, v| v.nil? }
|
1318
|
-
req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::SeekRequest)
|
1319
|
-
@seek.call(req, options, &block)
|
1320
|
-
end
|
1321
|
-
|
1322
|
-
# Sets the access control policy on the specified resource. Replaces
|
1323
|
-
# any existing policy.
|
1324
|
-
#
|
1325
|
-
# Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
|
1326
|
-
# errors.
|
1327
|
-
#
|
1328
|
-
# @param resource [String]
|
1329
|
-
# REQUIRED: The resource for which the policy is being specified.
|
1330
|
-
# See the operation documentation for the appropriate value for this field.
|
1331
|
-
# @param policy [Google::Iam::V1::Policy | Hash]
|
1332
|
-
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
1333
|
-
# the policy is limited to a few 10s of KB. An empty policy is a
|
1334
|
-
# valid policy but certain Cloud Platform services (such as Projects)
|
1335
|
-
# might reject them.
|
1336
|
-
# A hash of the same form as `Google::Iam::V1::Policy`
|
1337
|
-
# can also be provided.
|
1338
|
-
# @param options [Google::Gax::CallOptions]
|
1339
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1340
|
-
# retries, etc.
|
1341
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1342
|
-
# @yieldparam result [Google::Iam::V1::Policy]
|
1343
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1344
|
-
# @return [Google::Iam::V1::Policy]
|
1345
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1346
|
-
# @example
|
1347
|
-
# require "google/cloud/pubsub"
|
1348
|
-
#
|
1349
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1350
|
-
#
|
1351
|
-
# # TODO: Initialize `resource`:
|
1352
|
-
# resource = ''
|
1353
|
-
#
|
1354
|
-
# # TODO: Initialize `policy`:
|
1355
|
-
# policy = {}
|
1356
|
-
# response = subscriber_client.set_iam_policy(resource, policy)
|
1357
|
-
|
1358
|
-
def set_iam_policy \
|
1359
|
-
resource,
|
1360
|
-
policy,
|
1361
|
-
options: nil,
|
1362
|
-
&block
|
1363
|
-
req = {
|
1364
|
-
resource: resource,
|
1365
|
-
policy: policy
|
1366
|
-
}.delete_if { |_, v| v.nil? }
|
1367
|
-
req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
|
1368
|
-
@set_iam_policy.call(req, options, &block)
|
1369
|
-
end
|
1370
|
-
|
1371
|
-
# Gets the access control policy for a resource. Returns an empty policy
|
1372
|
-
# if the resource exists and does not have a policy set.
|
1373
|
-
#
|
1374
|
-
# @param resource [String]
|
1375
|
-
# REQUIRED: The resource for which the policy is being requested.
|
1376
|
-
# See the operation documentation for the appropriate value for this field.
|
1377
|
-
# @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
|
1378
|
-
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
1379
|
-
# `GetIamPolicy`. This field is only used by Cloud IAM.
|
1380
|
-
# A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
|
1381
|
-
# can also be provided.
|
1382
|
-
# @param options [Google::Gax::CallOptions]
|
1383
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1384
|
-
# retries, etc.
|
1385
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1386
|
-
# @yieldparam result [Google::Iam::V1::Policy]
|
1387
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1388
|
-
# @return [Google::Iam::V1::Policy]
|
1389
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1390
|
-
# @example
|
1391
|
-
# require "google/cloud/pubsub"
|
1392
|
-
#
|
1393
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1394
|
-
#
|
1395
|
-
# # TODO: Initialize `resource`:
|
1396
|
-
# resource = ''
|
1397
|
-
# response = subscriber_client.get_iam_policy(resource)
|
1398
|
-
|
1399
|
-
def get_iam_policy \
|
1400
|
-
resource,
|
1401
|
-
options_: nil,
|
1402
|
-
options: nil,
|
1403
|
-
&block
|
1404
|
-
req = {
|
1405
|
-
resource: resource,
|
1406
|
-
options: options_
|
1407
|
-
}.delete_if { |_, v| v.nil? }
|
1408
|
-
req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
|
1409
|
-
@get_iam_policy.call(req, options, &block)
|
1410
|
-
end
|
1411
|
-
|
1412
|
-
# Returns permissions that a caller has on the specified resource. If the
|
1413
|
-
# resource does not exist, this will return an empty set of
|
1414
|
-
# permissions, not a `NOT_FOUND` error.
|
1415
|
-
#
|
1416
|
-
# Note: This operation is designed to be used for building
|
1417
|
-
# permission-aware UIs and command-line tools, not for authorization
|
1418
|
-
# checking. This operation may "fail open" without warning.
|
1419
|
-
#
|
1420
|
-
# @param resource [String]
|
1421
|
-
# REQUIRED: The resource for which the policy detail is being requested.
|
1422
|
-
# See the operation documentation for the appropriate value for this field.
|
1423
|
-
# @param permissions [Array<String>]
|
1424
|
-
# The set of permissions to check for the `resource`. Permissions with
|
1425
|
-
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
1426
|
-
# information see
|
1427
|
-
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
1428
|
-
# @param options [Google::Gax::CallOptions]
|
1429
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1430
|
-
# retries, etc.
|
1431
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1432
|
-
# @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
|
1433
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1434
|
-
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
1435
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1436
|
-
# @example
|
1437
|
-
# require "google/cloud/pubsub"
|
1438
|
-
#
|
1439
|
-
# subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
|
1440
|
-
#
|
1441
|
-
# # TODO: Initialize `resource`:
|
1442
|
-
# resource = ''
|
1443
|
-
#
|
1444
|
-
# # TODO: Initialize `permissions`:
|
1445
|
-
# permissions = []
|
1446
|
-
# response = subscriber_client.test_iam_permissions(resource, permissions)
|
1447
|
-
|
1448
|
-
def test_iam_permissions \
|
1449
|
-
resource,
|
1450
|
-
permissions,
|
1451
|
-
options: nil,
|
1452
|
-
&block
|
1453
|
-
req = {
|
1454
|
-
resource: resource,
|
1455
|
-
permissions: permissions
|
1456
|
-
}.delete_if { |_, v| v.nil? }
|
1457
|
-
req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
|
1458
|
-
@test_iam_permissions.call(req, options, &block)
|
1459
|
-
end
|
1460
|
-
end
|
1461
|
-
end
|
1462
|
-
end
|
1463
|
-
|
1464
|
-
Pubsub = PubSub unless const_defined? :Pubsub
|
1465
|
-
end
|
1466
|
-
end
|