google-cloud-pubsub-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +75 -0
- data/lib/google-cloud-pubsub-v1.rb +21 -0
- data/lib/google/cloud/pubsub/v1.rb +37 -0
- data/lib/google/cloud/pubsub/v1/iam_policy.rb +72 -0
- data/lib/google/cloud/pubsub/v1/iam_policy/client.rb +562 -0
- data/lib/google/cloud/pubsub/v1/iam_policy/credentials.rb +52 -0
- data/lib/google/cloud/pubsub/v1/publisher.rb +50 -0
- data/lib/google/cloud/pubsub/v1/publisher/client.rb +1093 -0
- data/lib/google/cloud/pubsub/v1/publisher/credentials.rb +52 -0
- data/lib/google/cloud/pubsub/v1/publisher/helpers.rb +23 -0
- data/lib/google/cloud/pubsub/v1/publisher/paths.rb +98 -0
- data/lib/google/cloud/pubsub/v1/subscriber.rb +51 -0
- data/lib/google/cloud/pubsub/v1/subscriber/client.rb +1861 -0
- data/lib/google/cloud/pubsub/v1/subscriber/credentials.rb +52 -0
- data/lib/google/cloud/pubsub/v1/subscriber/helpers.rb +23 -0
- data/lib/google/cloud/pubsub/v1/subscriber/paths.rb +115 -0
- data/lib/google/cloud/pubsub/v1/version.rb +28 -0
- data/lib/google/iam/v1/iam_policy_services_pb.rb +81 -0
- data/lib/google/pubsub/v1/pubsub_pb.rb +269 -0
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +213 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
- data/proto_docs/google/iam/v1/options.rb +40 -0
- data/proto_docs/google/iam/v1/policy.rb +248 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/pubsub/v1/pubsub.rb +1023 -0
- data/proto_docs/google/type/expr.rb +52 -0
- metadata +238 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module PubSub
|
24
|
+
module V1
|
25
|
+
module IAMPolicy
|
26
|
+
# Credentials for the IAMPolicy API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
30
|
+
"https://www.googleapis.com/auth/pubsub"
|
31
|
+
]
|
32
|
+
self.env_vars = [
|
33
|
+
"PUBSUB_CREDENTIALS",
|
34
|
+
"PUBSUB_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE",
|
37
|
+
"GCLOUD_KEYFILE",
|
38
|
+
"PUBSUB_CREDENTIALS_JSON",
|
39
|
+
"PUBSUB_KEYFILE_JSON",
|
40
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
41
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
42
|
+
"GCLOUD_KEYFILE_JSON"
|
43
|
+
]
|
44
|
+
self.paths = [
|
45
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
46
|
+
]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/pubsub/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/pubsub/v1/publisher/credentials"
|
26
|
+
require "google/cloud/pubsub/v1/publisher/paths"
|
27
|
+
require "google/cloud/pubsub/v1/publisher/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module PubSub
|
32
|
+
module V1
|
33
|
+
##
|
34
|
+
# The service that an application uses to manipulate topics, and to send
|
35
|
+
# messages to a topic.
|
36
|
+
#
|
37
|
+
# To load this service and instantiate a client:
|
38
|
+
#
|
39
|
+
# require "google/cloud/pubsub/v1/publisher"
|
40
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
|
41
|
+
#
|
42
|
+
module Publisher
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
helper_path = ::File.join __dir__, "publisher", "helpers.rb"
|
50
|
+
require "google/cloud/pubsub/v1/publisher/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,1093 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/pubsub/v1/pubsub_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module PubSub
|
25
|
+
module V1
|
26
|
+
module Publisher
|
27
|
+
##
|
28
|
+
# Client for the Publisher service.
|
29
|
+
#
|
30
|
+
# The service that an application uses to manipulate topics, and to send
|
31
|
+
# messages to a topic.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :publisher_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the Publisher Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::PubSub::V1::Publisher::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# ## Example
|
46
|
+
#
|
47
|
+
# To modify the configuration for all Publisher clients:
|
48
|
+
#
|
49
|
+
# ::Google::Cloud::PubSub::V1::Publisher::Client.configure do |config|
|
50
|
+
# config.timeout = 10.0
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Client client.
|
54
|
+
# @yieldparam config [Client::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Client::Configuration]
|
57
|
+
#
|
58
|
+
def self.configure
|
59
|
+
@configure ||= begin
|
60
|
+
namespace = ["Google", "Cloud", "PubSub", "V1"]
|
61
|
+
parent_config = while namespace.any?
|
62
|
+
parent_name = namespace.join "::"
|
63
|
+
parent_const = const_get parent_name
|
64
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
65
|
+
namespace.pop
|
66
|
+
end
|
67
|
+
default_config = Client::Configuration.new parent_config
|
68
|
+
|
69
|
+
default_config.rpcs.create_topic.timeout = 60.0
|
70
|
+
default_config.rpcs.create_topic.retry_policy = {
|
71
|
+
initial_delay: 0.1,
|
72
|
+
max_delay: 60.0,
|
73
|
+
multiplier: 1.3,
|
74
|
+
retry_codes: ["UNAVAILABLE"]
|
75
|
+
}
|
76
|
+
|
77
|
+
default_config.rpcs.update_topic.timeout = 60.0
|
78
|
+
default_config.rpcs.update_topic.retry_policy = {
|
79
|
+
initial_delay: 0.1,
|
80
|
+
max_delay: 60.0,
|
81
|
+
multiplier: 1.3,
|
82
|
+
retry_codes: ["UNAVAILABLE"]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config.rpcs.publish.timeout = 60.0
|
86
|
+
default_config.rpcs.publish.retry_policy = {
|
87
|
+
initial_delay: 0.1,
|
88
|
+
max_delay: 60.0,
|
89
|
+
multiplier: 1.3,
|
90
|
+
retry_codes: ["ABORTED", "CANCELLED", "INTERNAL", "RESOURCE_EXHAUSTED", "UNKNOWN", "UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
91
|
+
}
|
92
|
+
|
93
|
+
default_config.rpcs.get_topic.timeout = 60.0
|
94
|
+
default_config.rpcs.get_topic.retry_policy = {
|
95
|
+
initial_delay: 0.1,
|
96
|
+
max_delay: 60.0,
|
97
|
+
multiplier: 1.3,
|
98
|
+
retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
|
99
|
+
}
|
100
|
+
|
101
|
+
default_config.rpcs.list_topics.timeout = 60.0
|
102
|
+
default_config.rpcs.list_topics.retry_policy = {
|
103
|
+
initial_delay: 0.1,
|
104
|
+
max_delay: 60.0,
|
105
|
+
multiplier: 1.3,
|
106
|
+
retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
|
107
|
+
}
|
108
|
+
|
109
|
+
default_config.rpcs.list_topic_subscriptions.timeout = 60.0
|
110
|
+
default_config.rpcs.list_topic_subscriptions.retry_policy = {
|
111
|
+
initial_delay: 0.1,
|
112
|
+
max_delay: 60.0,
|
113
|
+
multiplier: 1.3,
|
114
|
+
retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
|
115
|
+
}
|
116
|
+
|
117
|
+
default_config.rpcs.list_topic_snapshots.timeout = 60.0
|
118
|
+
default_config.rpcs.list_topic_snapshots.retry_policy = {
|
119
|
+
initial_delay: 0.1,
|
120
|
+
max_delay: 60.0,
|
121
|
+
multiplier: 1.3,
|
122
|
+
retry_codes: ["UNKNOWN", "ABORTED", "UNAVAILABLE"]
|
123
|
+
}
|
124
|
+
|
125
|
+
default_config.rpcs.delete_topic.timeout = 60.0
|
126
|
+
default_config.rpcs.delete_topic.retry_policy = {
|
127
|
+
initial_delay: 0.1,
|
128
|
+
max_delay: 60.0,
|
129
|
+
multiplier: 1.3,
|
130
|
+
retry_codes: ["UNAVAILABLE"]
|
131
|
+
}
|
132
|
+
|
133
|
+
default_config.rpcs.detach_subscription.timeout = 60.0
|
134
|
+
default_config.rpcs.detach_subscription.retry_policy = {
|
135
|
+
initial_delay: 0.1,
|
136
|
+
max_delay: 60.0,
|
137
|
+
multiplier: 1.3,
|
138
|
+
retry_codes: ["UNAVAILABLE"]
|
139
|
+
}
|
140
|
+
|
141
|
+
default_config
|
142
|
+
end
|
143
|
+
yield @configure if block_given?
|
144
|
+
@configure
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# Configure the Publisher Client instance.
|
149
|
+
#
|
150
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
151
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
152
|
+
# should be made on {Client.configure}.
|
153
|
+
#
|
154
|
+
# See {::Google::Cloud::PubSub::V1::Publisher::Client::Configuration}
|
155
|
+
# for a description of the configuration fields.
|
156
|
+
#
|
157
|
+
# @yield [config] Configure the Client client.
|
158
|
+
# @yieldparam config [Client::Configuration]
|
159
|
+
#
|
160
|
+
# @return [Client::Configuration]
|
161
|
+
#
|
162
|
+
def configure
|
163
|
+
yield @config if block_given?
|
164
|
+
@config
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# Create a new Publisher client object.
|
169
|
+
#
|
170
|
+
# ## Examples
|
171
|
+
#
|
172
|
+
# To create a new Publisher client with the default
|
173
|
+
# configuration:
|
174
|
+
#
|
175
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
|
176
|
+
#
|
177
|
+
# To create a new Publisher client with a custom
|
178
|
+
# configuration:
|
179
|
+
#
|
180
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new do |config|
|
181
|
+
# config.timeout = 10.0
|
182
|
+
# end
|
183
|
+
#
|
184
|
+
# @yield [config] Configure the Publisher client.
|
185
|
+
# @yieldparam config [Client::Configuration]
|
186
|
+
#
|
187
|
+
def initialize
|
188
|
+
# These require statements are intentionally placed here to initialize
|
189
|
+
# the gRPC module only when it's required.
|
190
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
191
|
+
require "gapic/grpc"
|
192
|
+
require "google/pubsub/v1/pubsub_services_pb"
|
193
|
+
|
194
|
+
# Create the configuration object
|
195
|
+
@config = Configuration.new Client.configure
|
196
|
+
|
197
|
+
# Yield the configuration if needed
|
198
|
+
yield @config if block_given?
|
199
|
+
|
200
|
+
# Create credentials
|
201
|
+
credentials = @config.credentials
|
202
|
+
credentials ||= Credentials.default scope: @config.scope
|
203
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
204
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
205
|
+
end
|
206
|
+
@quota_project_id = @config.quota_project
|
207
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
208
|
+
|
209
|
+
@publisher_stub = ::Gapic::ServiceStub.new(
|
210
|
+
::Google::Cloud::PubSub::V1::Publisher::Stub,
|
211
|
+
credentials: credentials,
|
212
|
+
endpoint: @config.endpoint,
|
213
|
+
channel_args: @config.channel_args,
|
214
|
+
interceptors: @config.interceptors
|
215
|
+
)
|
216
|
+
end
|
217
|
+
|
218
|
+
# Service calls
|
219
|
+
|
220
|
+
##
|
221
|
+
# Creates the given topic with the given name. See the
|
222
|
+
# <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
|
223
|
+
# resource name rules</a>.
|
224
|
+
#
|
225
|
+
# @overload create_topic(request, options = nil)
|
226
|
+
# Pass arguments to `create_topic` via a request object, either of type
|
227
|
+
# {::Google::Cloud::PubSub::V1::Topic} or an equivalent Hash.
|
228
|
+
#
|
229
|
+
# @param request [::Google::Cloud::PubSub::V1::Topic, ::Hash]
|
230
|
+
# A request object representing the call parameters. Required. To specify no
|
231
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
232
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
233
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
234
|
+
#
|
235
|
+
# @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil)
|
236
|
+
# Pass arguments to `create_topic` via keyword arguments. Note that at
|
237
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
238
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
239
|
+
#
|
240
|
+
# @param name [::String]
|
241
|
+
# Required. The name of the topic. It must have the format
|
242
|
+
# `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
|
243
|
+
# and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
|
244
|
+
# underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
|
245
|
+
# signs (`%`). It must be between 3 and 255 characters in length, and it
|
246
|
+
# must not start with `"goog"`.
|
247
|
+
# @param labels [::Hash{::String => ::String}]
|
248
|
+
# See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
|
249
|
+
# managing labels</a>.
|
250
|
+
# @param message_storage_policy [::Google::Cloud::PubSub::V1::MessageStoragePolicy, ::Hash]
|
251
|
+
# Policy constraining the set of Google Cloud Platform regions where messages
|
252
|
+
# published to the topic may be stored. If not present, then no constraints
|
253
|
+
# are in effect.
|
254
|
+
# @param kms_key_name [::String]
|
255
|
+
# The resource name of the Cloud KMS CryptoKey to be used to protect access
|
256
|
+
# to messages published on this topic.
|
257
|
+
#
|
258
|
+
# The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
|
259
|
+
#
|
260
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
261
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
|
262
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
263
|
+
#
|
264
|
+
# @return [::Google::Cloud::PubSub::V1::Topic]
|
265
|
+
#
|
266
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
267
|
+
#
|
268
|
+
def create_topic request, options = nil
|
269
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
270
|
+
|
271
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::Topic
|
272
|
+
|
273
|
+
# Converts hash and nil to an options object
|
274
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
275
|
+
|
276
|
+
# Customize the options with defaults
|
277
|
+
metadata = @config.rpcs.create_topic.metadata.to_h
|
278
|
+
|
279
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
280
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
281
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
282
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
283
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
284
|
+
|
285
|
+
header_params = {
|
286
|
+
"name" => request.name
|
287
|
+
}
|
288
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
289
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
290
|
+
|
291
|
+
options.apply_defaults timeout: @config.rpcs.create_topic.timeout,
|
292
|
+
metadata: metadata,
|
293
|
+
retry_policy: @config.rpcs.create_topic.retry_policy
|
294
|
+
options.apply_defaults metadata: @config.metadata,
|
295
|
+
retry_policy: @config.retry_policy
|
296
|
+
|
297
|
+
@publisher_stub.call_rpc :create_topic, request, options: options do |response, operation|
|
298
|
+
yield response, operation if block_given?
|
299
|
+
return response
|
300
|
+
end
|
301
|
+
rescue ::GRPC::BadStatus => e
|
302
|
+
raise ::Google::Cloud::Error.from_error(e)
|
303
|
+
end
|
304
|
+
|
305
|
+
##
|
306
|
+
# Updates an existing topic. Note that certain properties of a
|
307
|
+
# topic are not modifiable.
|
308
|
+
#
|
309
|
+
# @overload update_topic(request, options = nil)
|
310
|
+
# Pass arguments to `update_topic` via a request object, either of type
|
311
|
+
# {::Google::Cloud::PubSub::V1::UpdateTopicRequest} or an equivalent Hash.
|
312
|
+
#
|
313
|
+
# @param request [::Google::Cloud::PubSub::V1::UpdateTopicRequest, ::Hash]
|
314
|
+
# A request object representing the call parameters. Required. To specify no
|
315
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
316
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
317
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
318
|
+
#
|
319
|
+
# @overload update_topic(topic: nil, update_mask: nil)
|
320
|
+
# Pass arguments to `update_topic` via keyword arguments. Note that at
|
321
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
322
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
323
|
+
#
|
324
|
+
# @param topic [::Google::Cloud::PubSub::V1::Topic, ::Hash]
|
325
|
+
# Required. The updated topic object.
|
326
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
327
|
+
# Required. Indicates which fields in the provided topic to update. Must be
|
328
|
+
# specified and non-empty. Note that if `update_mask` contains
|
329
|
+
# "message_storage_policy" but the `message_storage_policy` is not set in
|
330
|
+
# the `topic` provided above, then the updated value is determined by the
|
331
|
+
# policy configured at the project or organization level.
|
332
|
+
#
|
333
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
334
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
|
335
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
336
|
+
#
|
337
|
+
# @return [::Google::Cloud::PubSub::V1::Topic]
|
338
|
+
#
|
339
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
340
|
+
#
|
341
|
+
def update_topic request, options = nil
|
342
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
343
|
+
|
344
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::UpdateTopicRequest
|
345
|
+
|
346
|
+
# Converts hash and nil to an options object
|
347
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
348
|
+
|
349
|
+
# Customize the options with defaults
|
350
|
+
metadata = @config.rpcs.update_topic.metadata.to_h
|
351
|
+
|
352
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
353
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
354
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
355
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
356
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
357
|
+
|
358
|
+
header_params = {
|
359
|
+
"topic.name" => request.topic.name
|
360
|
+
}
|
361
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
362
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
363
|
+
|
364
|
+
options.apply_defaults timeout: @config.rpcs.update_topic.timeout,
|
365
|
+
metadata: metadata,
|
366
|
+
retry_policy: @config.rpcs.update_topic.retry_policy
|
367
|
+
options.apply_defaults metadata: @config.metadata,
|
368
|
+
retry_policy: @config.retry_policy
|
369
|
+
|
370
|
+
@publisher_stub.call_rpc :update_topic, request, options: options do |response, operation|
|
371
|
+
yield response, operation if block_given?
|
372
|
+
return response
|
373
|
+
end
|
374
|
+
rescue ::GRPC::BadStatus => e
|
375
|
+
raise ::Google::Cloud::Error.from_error(e)
|
376
|
+
end
|
377
|
+
|
378
|
+
##
|
379
|
+
# Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
|
380
|
+
# does not exist.
|
381
|
+
#
|
382
|
+
# @overload publish(request, options = nil)
|
383
|
+
# Pass arguments to `publish` via a request object, either of type
|
384
|
+
# {::Google::Cloud::PubSub::V1::PublishRequest} or an equivalent Hash.
|
385
|
+
#
|
386
|
+
# @param request [::Google::Cloud::PubSub::V1::PublishRequest, ::Hash]
|
387
|
+
# A request object representing the call parameters. Required. To specify no
|
388
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
389
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
390
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
391
|
+
#
|
392
|
+
# @overload publish(topic: nil, messages: nil)
|
393
|
+
# Pass arguments to `publish` via keyword arguments. Note that at
|
394
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
395
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
396
|
+
#
|
397
|
+
# @param topic [::String]
|
398
|
+
# Required. The messages in the request will be published on this topic.
|
399
|
+
# Format is `projects/{project}/topics/{topic}`.
|
400
|
+
# @param messages [::Array<::Google::Cloud::PubSub::V1::PubsubMessage, ::Hash>]
|
401
|
+
# Required. The messages to publish.
|
402
|
+
#
|
403
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
404
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::PublishResponse]
|
405
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
406
|
+
#
|
407
|
+
# @return [::Google::Cloud::PubSub::V1::PublishResponse]
|
408
|
+
#
|
409
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
410
|
+
#
|
411
|
+
def publish request, options = nil
|
412
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
413
|
+
|
414
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::PublishRequest
|
415
|
+
|
416
|
+
# Converts hash and nil to an options object
|
417
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
418
|
+
|
419
|
+
# Customize the options with defaults
|
420
|
+
metadata = @config.rpcs.publish.metadata.to_h
|
421
|
+
|
422
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
423
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
424
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
425
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
426
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
427
|
+
|
428
|
+
header_params = {
|
429
|
+
"topic" => request.topic
|
430
|
+
}
|
431
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
432
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
433
|
+
|
434
|
+
options.apply_defaults timeout: @config.rpcs.publish.timeout,
|
435
|
+
metadata: metadata,
|
436
|
+
retry_policy: @config.rpcs.publish.retry_policy
|
437
|
+
options.apply_defaults metadata: @config.metadata,
|
438
|
+
retry_policy: @config.retry_policy
|
439
|
+
|
440
|
+
@publisher_stub.call_rpc :publish, request, options: options do |response, operation|
|
441
|
+
yield response, operation if block_given?
|
442
|
+
return response
|
443
|
+
end
|
444
|
+
rescue ::GRPC::BadStatus => e
|
445
|
+
raise ::Google::Cloud::Error.from_error(e)
|
446
|
+
end
|
447
|
+
|
448
|
+
##
|
449
|
+
# Gets the configuration of a topic.
|
450
|
+
#
|
451
|
+
# @overload get_topic(request, options = nil)
|
452
|
+
# Pass arguments to `get_topic` via a request object, either of type
|
453
|
+
# {::Google::Cloud::PubSub::V1::GetTopicRequest} or an equivalent Hash.
|
454
|
+
#
|
455
|
+
# @param request [::Google::Cloud::PubSub::V1::GetTopicRequest, ::Hash]
|
456
|
+
# A request object representing the call parameters. Required. To specify no
|
457
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
458
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
459
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
460
|
+
#
|
461
|
+
# @overload get_topic(topic: nil)
|
462
|
+
# Pass arguments to `get_topic` via keyword arguments. Note that at
|
463
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
464
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
465
|
+
#
|
466
|
+
# @param topic [::String]
|
467
|
+
# Required. The name of the topic to get.
|
468
|
+
# Format is `projects/{project}/topics/{topic}`.
|
469
|
+
#
|
470
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
471
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
|
472
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
473
|
+
#
|
474
|
+
# @return [::Google::Cloud::PubSub::V1::Topic]
|
475
|
+
#
|
476
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
477
|
+
#
|
478
|
+
def get_topic request, options = nil
|
479
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
480
|
+
|
481
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::GetTopicRequest
|
482
|
+
|
483
|
+
# Converts hash and nil to an options object
|
484
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
485
|
+
|
486
|
+
# Customize the options with defaults
|
487
|
+
metadata = @config.rpcs.get_topic.metadata.to_h
|
488
|
+
|
489
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
490
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
491
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
492
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
493
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
494
|
+
|
495
|
+
header_params = {
|
496
|
+
"topic" => request.topic
|
497
|
+
}
|
498
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
499
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
500
|
+
|
501
|
+
options.apply_defaults timeout: @config.rpcs.get_topic.timeout,
|
502
|
+
metadata: metadata,
|
503
|
+
retry_policy: @config.rpcs.get_topic.retry_policy
|
504
|
+
options.apply_defaults metadata: @config.metadata,
|
505
|
+
retry_policy: @config.retry_policy
|
506
|
+
|
507
|
+
@publisher_stub.call_rpc :get_topic, request, options: options do |response, operation|
|
508
|
+
yield response, operation if block_given?
|
509
|
+
return response
|
510
|
+
end
|
511
|
+
rescue ::GRPC::BadStatus => e
|
512
|
+
raise ::Google::Cloud::Error.from_error(e)
|
513
|
+
end
|
514
|
+
|
515
|
+
##
|
516
|
+
# Lists matching topics.
|
517
|
+
#
|
518
|
+
# @overload list_topics(request, options = nil)
|
519
|
+
# Pass arguments to `list_topics` via a request object, either of type
|
520
|
+
# {::Google::Cloud::PubSub::V1::ListTopicsRequest} or an equivalent Hash.
|
521
|
+
#
|
522
|
+
# @param request [::Google::Cloud::PubSub::V1::ListTopicsRequest, ::Hash]
|
523
|
+
# A request object representing the call parameters. Required. To specify no
|
524
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
525
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
526
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
527
|
+
#
|
528
|
+
# @overload list_topics(project: nil, page_size: nil, page_token: nil)
|
529
|
+
# Pass arguments to `list_topics` via keyword arguments. Note that at
|
530
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
531
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
532
|
+
#
|
533
|
+
# @param project [::String]
|
534
|
+
# Required. The name of the project in which to list topics.
|
535
|
+
# Format is `projects/{project-id}`.
|
536
|
+
# @param page_size [::Integer]
|
537
|
+
# Maximum number of topics to return.
|
538
|
+
# @param page_token [::String]
|
539
|
+
# The value returned by the last `ListTopicsResponse`; indicates that this is
|
540
|
+
# a continuation of a prior `ListTopics` call, and that the system should
|
541
|
+
# return the next page of data.
|
542
|
+
#
|
543
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
544
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Topic>]
|
545
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
546
|
+
#
|
547
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Topic>]
|
548
|
+
#
|
549
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
550
|
+
#
|
551
|
+
def list_topics request, options = nil
|
552
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
553
|
+
|
554
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListTopicsRequest
|
555
|
+
|
556
|
+
# Converts hash and nil to an options object
|
557
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
558
|
+
|
559
|
+
# Customize the options with defaults
|
560
|
+
metadata = @config.rpcs.list_topics.metadata.to_h
|
561
|
+
|
562
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
563
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
564
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
565
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
566
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
567
|
+
|
568
|
+
header_params = {
|
569
|
+
"project" => request.project
|
570
|
+
}
|
571
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
572
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
573
|
+
|
574
|
+
options.apply_defaults timeout: @config.rpcs.list_topics.timeout,
|
575
|
+
metadata: metadata,
|
576
|
+
retry_policy: @config.rpcs.list_topics.retry_policy
|
577
|
+
options.apply_defaults metadata: @config.metadata,
|
578
|
+
retry_policy: @config.retry_policy
|
579
|
+
|
580
|
+
@publisher_stub.call_rpc :list_topics, request, options: options do |response, operation|
|
581
|
+
response = ::Gapic::PagedEnumerable.new @publisher_stub, :list_topics, request, response, operation, options
|
582
|
+
yield response, operation if block_given?
|
583
|
+
return response
|
584
|
+
end
|
585
|
+
rescue ::GRPC::BadStatus => e
|
586
|
+
raise ::Google::Cloud::Error.from_error(e)
|
587
|
+
end
|
588
|
+
|
589
|
+
##
|
590
|
+
# Lists the names of the attached subscriptions on this topic.
|
591
|
+
#
|
592
|
+
# @overload list_topic_subscriptions(request, options = nil)
|
593
|
+
# Pass arguments to `list_topic_subscriptions` via a request object, either of type
|
594
|
+
# {::Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest} or an equivalent Hash.
|
595
|
+
#
|
596
|
+
# @param request [::Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest, ::Hash]
|
597
|
+
# A request object representing the call parameters. Required. To specify no
|
598
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
599
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
600
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
601
|
+
#
|
602
|
+
# @overload list_topic_subscriptions(topic: nil, page_size: nil, page_token: nil)
|
603
|
+
# Pass arguments to `list_topic_subscriptions` via keyword arguments. Note that at
|
604
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
605
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
606
|
+
#
|
607
|
+
# @param topic [::String]
|
608
|
+
# Required. The name of the topic that subscriptions are attached to.
|
609
|
+
# Format is `projects/{project}/topics/{topic}`.
|
610
|
+
# @param page_size [::Integer]
|
611
|
+
# Maximum number of subscription names to return.
|
612
|
+
# @param page_token [::String]
|
613
|
+
# The value returned by the last `ListTopicSubscriptionsResponse`; indicates
|
614
|
+
# that this is a continuation of a prior `ListTopicSubscriptions` call, and
|
615
|
+
# that the system should return the next page of data.
|
616
|
+
#
|
617
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
618
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse]
|
619
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
620
|
+
#
|
621
|
+
# @return [::Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse]
|
622
|
+
#
|
623
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
624
|
+
#
|
625
|
+
def list_topic_subscriptions request, options = nil
|
626
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
627
|
+
|
628
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest
|
629
|
+
|
630
|
+
# Converts hash and nil to an options object
|
631
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
632
|
+
|
633
|
+
# Customize the options with defaults
|
634
|
+
metadata = @config.rpcs.list_topic_subscriptions.metadata.to_h
|
635
|
+
|
636
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
637
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
638
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
639
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
640
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
641
|
+
|
642
|
+
header_params = {
|
643
|
+
"topic" => request.topic
|
644
|
+
}
|
645
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
646
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
647
|
+
|
648
|
+
options.apply_defaults timeout: @config.rpcs.list_topic_subscriptions.timeout,
|
649
|
+
metadata: metadata,
|
650
|
+
retry_policy: @config.rpcs.list_topic_subscriptions.retry_policy
|
651
|
+
options.apply_defaults metadata: @config.metadata,
|
652
|
+
retry_policy: @config.retry_policy
|
653
|
+
|
654
|
+
@publisher_stub.call_rpc :list_topic_subscriptions, request, options: options do |response, operation|
|
655
|
+
yield response, operation if block_given?
|
656
|
+
return response
|
657
|
+
end
|
658
|
+
rescue ::GRPC::BadStatus => e
|
659
|
+
raise ::Google::Cloud::Error.from_error(e)
|
660
|
+
end
|
661
|
+
|
662
|
+
##
|
663
|
+
# Lists the names of the snapshots on this topic. Snapshots are used in
|
664
|
+
# <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
|
665
|
+
# operations, which allow
|
666
|
+
# you to manage message acknowledgments in bulk. That is, you can set the
|
667
|
+
# acknowledgment state of messages in an existing subscription to the state
|
668
|
+
# captured by a snapshot.
|
669
|
+
#
|
670
|
+
# @overload list_topic_snapshots(request, options = nil)
|
671
|
+
# Pass arguments to `list_topic_snapshots` via a request object, either of type
|
672
|
+
# {::Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest} or an equivalent Hash.
|
673
|
+
#
|
674
|
+
# @param request [::Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest, ::Hash]
|
675
|
+
# A request object representing the call parameters. Required. To specify no
|
676
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
677
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
678
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
679
|
+
#
|
680
|
+
# @overload list_topic_snapshots(topic: nil, page_size: nil, page_token: nil)
|
681
|
+
# Pass arguments to `list_topic_snapshots` via keyword arguments. Note that at
|
682
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
683
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
684
|
+
#
|
685
|
+
# @param topic [::String]
|
686
|
+
# Required. The name of the topic that snapshots are attached to.
|
687
|
+
# Format is `projects/{project}/topics/{topic}`.
|
688
|
+
# @param page_size [::Integer]
|
689
|
+
# Maximum number of snapshot names to return.
|
690
|
+
# @param page_token [::String]
|
691
|
+
# The value returned by the last `ListTopicSnapshotsResponse`; indicates
|
692
|
+
# that this is a continuation of a prior `ListTopicSnapshots` call, and
|
693
|
+
# that the system should return the next page of data.
|
694
|
+
#
|
695
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
696
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse]
|
697
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
698
|
+
#
|
699
|
+
# @return [::Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse]
|
700
|
+
#
|
701
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
702
|
+
#
|
703
|
+
def list_topic_snapshots request, options = nil
|
704
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
705
|
+
|
706
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest
|
707
|
+
|
708
|
+
# Converts hash and nil to an options object
|
709
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
710
|
+
|
711
|
+
# Customize the options with defaults
|
712
|
+
metadata = @config.rpcs.list_topic_snapshots.metadata.to_h
|
713
|
+
|
714
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
715
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
716
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
717
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
718
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
719
|
+
|
720
|
+
header_params = {
|
721
|
+
"topic" => request.topic
|
722
|
+
}
|
723
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
724
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
725
|
+
|
726
|
+
options.apply_defaults timeout: @config.rpcs.list_topic_snapshots.timeout,
|
727
|
+
metadata: metadata,
|
728
|
+
retry_policy: @config.rpcs.list_topic_snapshots.retry_policy
|
729
|
+
options.apply_defaults metadata: @config.metadata,
|
730
|
+
retry_policy: @config.retry_policy
|
731
|
+
|
732
|
+
@publisher_stub.call_rpc :list_topic_snapshots, request, options: options do |response, operation|
|
733
|
+
yield response, operation if block_given?
|
734
|
+
return response
|
735
|
+
end
|
736
|
+
rescue ::GRPC::BadStatus => e
|
737
|
+
raise ::Google::Cloud::Error.from_error(e)
|
738
|
+
end
|
739
|
+
|
740
|
+
##
|
741
|
+
# Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
|
742
|
+
# does not exist. After a topic is deleted, a new topic may be created with
|
743
|
+
# the same name; this is an entirely new topic with none of the old
|
744
|
+
# configuration or subscriptions. Existing subscriptions to this topic are
|
745
|
+
# not deleted, but their `topic` field is set to `_deleted-topic_`.
|
746
|
+
#
|
747
|
+
# @overload delete_topic(request, options = nil)
|
748
|
+
# Pass arguments to `delete_topic` via a request object, either of type
|
749
|
+
# {::Google::Cloud::PubSub::V1::DeleteTopicRequest} or an equivalent Hash.
|
750
|
+
#
|
751
|
+
# @param request [::Google::Cloud::PubSub::V1::DeleteTopicRequest, ::Hash]
|
752
|
+
# A request object representing the call parameters. Required. To specify no
|
753
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
754
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
755
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
756
|
+
#
|
757
|
+
# @overload delete_topic(topic: nil)
|
758
|
+
# Pass arguments to `delete_topic` via keyword arguments. Note that at
|
759
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
760
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
761
|
+
#
|
762
|
+
# @param topic [::String]
|
763
|
+
# Required. Name of the topic to delete.
|
764
|
+
# Format is `projects/{project}/topics/{topic}`.
|
765
|
+
#
|
766
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
767
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
768
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
769
|
+
#
|
770
|
+
# @return [::Google::Protobuf::Empty]
|
771
|
+
#
|
772
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
773
|
+
#
|
774
|
+
def delete_topic request, options = nil
|
775
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
776
|
+
|
777
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteTopicRequest
|
778
|
+
|
779
|
+
# Converts hash and nil to an options object
|
780
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
781
|
+
|
782
|
+
# Customize the options with defaults
|
783
|
+
metadata = @config.rpcs.delete_topic.metadata.to_h
|
784
|
+
|
785
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
786
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
787
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
788
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
789
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
790
|
+
|
791
|
+
header_params = {
|
792
|
+
"topic" => request.topic
|
793
|
+
}
|
794
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
795
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
796
|
+
|
797
|
+
options.apply_defaults timeout: @config.rpcs.delete_topic.timeout,
|
798
|
+
metadata: metadata,
|
799
|
+
retry_policy: @config.rpcs.delete_topic.retry_policy
|
800
|
+
options.apply_defaults metadata: @config.metadata,
|
801
|
+
retry_policy: @config.retry_policy
|
802
|
+
|
803
|
+
@publisher_stub.call_rpc :delete_topic, request, options: options do |response, operation|
|
804
|
+
yield response, operation if block_given?
|
805
|
+
return response
|
806
|
+
end
|
807
|
+
rescue ::GRPC::BadStatus => e
|
808
|
+
raise ::Google::Cloud::Error.from_error(e)
|
809
|
+
end
|
810
|
+
|
811
|
+
##
|
812
|
+
# Detaches a subscription from this topic. All messages retained in the
|
813
|
+
# subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
|
814
|
+
# will return FAILED_PRECONDITION. If the subscription is a push
|
815
|
+
# subscription, pushes to the endpoint will stop.
|
816
|
+
#
|
817
|
+
# @overload detach_subscription(request, options = nil)
|
818
|
+
# Pass arguments to `detach_subscription` via a request object, either of type
|
819
|
+
# {::Google::Cloud::PubSub::V1::DetachSubscriptionRequest} or an equivalent Hash.
|
820
|
+
#
|
821
|
+
# @param request [::Google::Cloud::PubSub::V1::DetachSubscriptionRequest, ::Hash]
|
822
|
+
# A request object representing the call parameters. Required. To specify no
|
823
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
824
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
825
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
826
|
+
#
|
827
|
+
# @overload detach_subscription(subscription: nil)
|
828
|
+
# Pass arguments to `detach_subscription` via keyword arguments. Note that at
|
829
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
830
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
831
|
+
#
|
832
|
+
# @param subscription [::String]
|
833
|
+
# Required. The subscription to detach.
|
834
|
+
# Format is `projects/{project}/subscriptions/{subscription}`.
|
835
|
+
#
|
836
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
837
|
+
# @yieldparam response [::Google::Cloud::PubSub::V1::DetachSubscriptionResponse]
|
838
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
839
|
+
#
|
840
|
+
# @return [::Google::Cloud::PubSub::V1::DetachSubscriptionResponse]
|
841
|
+
#
|
842
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
843
|
+
#
|
844
|
+
def detach_subscription request, options = nil
|
845
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
846
|
+
|
847
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DetachSubscriptionRequest
|
848
|
+
|
849
|
+
# Converts hash and nil to an options object
|
850
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
851
|
+
|
852
|
+
# Customize the options with defaults
|
853
|
+
metadata = @config.rpcs.detach_subscription.metadata.to_h
|
854
|
+
|
855
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
856
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
857
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
858
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
859
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
860
|
+
|
861
|
+
header_params = {
|
862
|
+
"subscription" => request.subscription
|
863
|
+
}
|
864
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
865
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
866
|
+
|
867
|
+
options.apply_defaults timeout: @config.rpcs.detach_subscription.timeout,
|
868
|
+
metadata: metadata,
|
869
|
+
retry_policy: @config.rpcs.detach_subscription.retry_policy
|
870
|
+
options.apply_defaults metadata: @config.metadata,
|
871
|
+
retry_policy: @config.retry_policy
|
872
|
+
|
873
|
+
@publisher_stub.call_rpc :detach_subscription, request, options: options do |response, operation|
|
874
|
+
yield response, operation if block_given?
|
875
|
+
return response
|
876
|
+
end
|
877
|
+
rescue ::GRPC::BadStatus => e
|
878
|
+
raise ::Google::Cloud::Error.from_error(e)
|
879
|
+
end
|
880
|
+
|
881
|
+
##
|
882
|
+
# Configuration class for the Publisher API.
|
883
|
+
#
|
884
|
+
# This class represents the configuration for Publisher,
|
885
|
+
# providing control over timeouts, retry behavior, logging, transport
|
886
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
887
|
+
# applied individually to specific RPCs. See
|
888
|
+
# {::Google::Cloud::PubSub::V1::Publisher::Client::Configuration::Rpcs}
|
889
|
+
# for a list of RPCs that can be configured independently.
|
890
|
+
#
|
891
|
+
# Configuration can be applied globally to all clients, or to a single client
|
892
|
+
# on construction.
|
893
|
+
#
|
894
|
+
# # Examples
|
895
|
+
#
|
896
|
+
# To modify the global config, setting the timeout for create_topic
|
897
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
898
|
+
#
|
899
|
+
# ::Google::Cloud::PubSub::V1::Publisher::Client.configure do |config|
|
900
|
+
# config.timeout = 10.0
|
901
|
+
# config.rpcs.create_topic.timeout = 20.0
|
902
|
+
# end
|
903
|
+
#
|
904
|
+
# To apply the above configuration only to a new client:
|
905
|
+
#
|
906
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new do |config|
|
907
|
+
# config.timeout = 10.0
|
908
|
+
# config.rpcs.create_topic.timeout = 20.0
|
909
|
+
# end
|
910
|
+
#
|
911
|
+
# @!attribute [rw] endpoint
|
912
|
+
# The hostname or hostname:port of the service endpoint.
|
913
|
+
# Defaults to `"pubsub.googleapis.com"`.
|
914
|
+
# @return [::String]
|
915
|
+
# @!attribute [rw] credentials
|
916
|
+
# Credentials to send with calls. You may provide any of the following types:
|
917
|
+
# * (`String`) The path to a service account key file in JSON format
|
918
|
+
# * (`Hash`) A service account key as a Hash
|
919
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
920
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
921
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
922
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
923
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
924
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
925
|
+
# * (`nil`) indicating no credentials
|
926
|
+
# @return [::Object]
|
927
|
+
# @!attribute [rw] scope
|
928
|
+
# The OAuth scopes
|
929
|
+
# @return [::Array<::String>]
|
930
|
+
# @!attribute [rw] lib_name
|
931
|
+
# The library name as recorded in instrumentation and logging
|
932
|
+
# @return [::String]
|
933
|
+
# @!attribute [rw] lib_version
|
934
|
+
# The library version as recorded in instrumentation and logging
|
935
|
+
# @return [::String]
|
936
|
+
# @!attribute [rw] channel_args
|
937
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
938
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
939
|
+
# @return [::Hash]
|
940
|
+
# @!attribute [rw] interceptors
|
941
|
+
# An array of interceptors that are run before calls are executed.
|
942
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
943
|
+
# @!attribute [rw] timeout
|
944
|
+
# The call timeout in seconds.
|
945
|
+
# @return [::Numeric]
|
946
|
+
# @!attribute [rw] metadata
|
947
|
+
# Additional gRPC headers to be sent with the call.
|
948
|
+
# @return [::Hash{::Symbol=>::String}]
|
949
|
+
# @!attribute [rw] retry_policy
|
950
|
+
# The retry policy. The value is a hash with the following keys:
|
951
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
952
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
953
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
954
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
955
|
+
# trigger a retry.
|
956
|
+
# @return [::Hash]
|
957
|
+
# @!attribute [rw] quota_project
|
958
|
+
# A separate project against which to charge quota.
|
959
|
+
# @return [::String]
|
960
|
+
#
|
961
|
+
class Configuration
|
962
|
+
extend ::Gapic::Config
|
963
|
+
|
964
|
+
config_attr :endpoint, "pubsub.googleapis.com", ::String
|
965
|
+
config_attr :credentials, nil do |value|
|
966
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
967
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
968
|
+
allowed.any? { |klass| klass === value }
|
969
|
+
end
|
970
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
971
|
+
config_attr :lib_name, nil, ::String, nil
|
972
|
+
config_attr :lib_version, nil, ::String, nil
|
973
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
974
|
+
config_attr :interceptors, nil, ::Array, nil
|
975
|
+
config_attr :timeout, nil, ::Numeric, nil
|
976
|
+
config_attr :metadata, nil, ::Hash, nil
|
977
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
978
|
+
config_attr :quota_project, nil, ::String, nil
|
979
|
+
|
980
|
+
# @private
|
981
|
+
def initialize parent_config = nil
|
982
|
+
@parent_config = parent_config unless parent_config.nil?
|
983
|
+
|
984
|
+
yield self if block_given?
|
985
|
+
end
|
986
|
+
|
987
|
+
##
|
988
|
+
# Configurations for individual RPCs
|
989
|
+
# @return [Rpcs]
|
990
|
+
#
|
991
|
+
def rpcs
|
992
|
+
@rpcs ||= begin
|
993
|
+
parent_rpcs = nil
|
994
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
995
|
+
Rpcs.new parent_rpcs
|
996
|
+
end
|
997
|
+
end
|
998
|
+
|
999
|
+
##
|
1000
|
+
# Configuration RPC class for the Publisher API.
|
1001
|
+
#
|
1002
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1003
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1004
|
+
# the following configuration fields:
|
1005
|
+
#
|
1006
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
1007
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1008
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1009
|
+
# include the following keys:
|
1010
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1011
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1012
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1013
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1014
|
+
# trigger a retry.
|
1015
|
+
#
|
1016
|
+
class Rpcs
|
1017
|
+
##
|
1018
|
+
# RPC-specific configuration for `create_topic`
|
1019
|
+
# @return [::Gapic::Config::Method]
|
1020
|
+
#
|
1021
|
+
attr_reader :create_topic
|
1022
|
+
##
|
1023
|
+
# RPC-specific configuration for `update_topic`
|
1024
|
+
# @return [::Gapic::Config::Method]
|
1025
|
+
#
|
1026
|
+
attr_reader :update_topic
|
1027
|
+
##
|
1028
|
+
# RPC-specific configuration for `publish`
|
1029
|
+
# @return [::Gapic::Config::Method]
|
1030
|
+
#
|
1031
|
+
attr_reader :publish
|
1032
|
+
##
|
1033
|
+
# RPC-specific configuration for `get_topic`
|
1034
|
+
# @return [::Gapic::Config::Method]
|
1035
|
+
#
|
1036
|
+
attr_reader :get_topic
|
1037
|
+
##
|
1038
|
+
# RPC-specific configuration for `list_topics`
|
1039
|
+
# @return [::Gapic::Config::Method]
|
1040
|
+
#
|
1041
|
+
attr_reader :list_topics
|
1042
|
+
##
|
1043
|
+
# RPC-specific configuration for `list_topic_subscriptions`
|
1044
|
+
# @return [::Gapic::Config::Method]
|
1045
|
+
#
|
1046
|
+
attr_reader :list_topic_subscriptions
|
1047
|
+
##
|
1048
|
+
# RPC-specific configuration for `list_topic_snapshots`
|
1049
|
+
# @return [::Gapic::Config::Method]
|
1050
|
+
#
|
1051
|
+
attr_reader :list_topic_snapshots
|
1052
|
+
##
|
1053
|
+
# RPC-specific configuration for `delete_topic`
|
1054
|
+
# @return [::Gapic::Config::Method]
|
1055
|
+
#
|
1056
|
+
attr_reader :delete_topic
|
1057
|
+
##
|
1058
|
+
# RPC-specific configuration for `detach_subscription`
|
1059
|
+
# @return [::Gapic::Config::Method]
|
1060
|
+
#
|
1061
|
+
attr_reader :detach_subscription
|
1062
|
+
|
1063
|
+
# @private
|
1064
|
+
def initialize parent_rpcs = nil
|
1065
|
+
create_topic_config = parent_rpcs&.create_topic if parent_rpcs&.respond_to? :create_topic
|
1066
|
+
@create_topic = ::Gapic::Config::Method.new create_topic_config
|
1067
|
+
update_topic_config = parent_rpcs&.update_topic if parent_rpcs&.respond_to? :update_topic
|
1068
|
+
@update_topic = ::Gapic::Config::Method.new update_topic_config
|
1069
|
+
publish_config = parent_rpcs&.publish if parent_rpcs&.respond_to? :publish
|
1070
|
+
@publish = ::Gapic::Config::Method.new publish_config
|
1071
|
+
get_topic_config = parent_rpcs&.get_topic if parent_rpcs&.respond_to? :get_topic
|
1072
|
+
@get_topic = ::Gapic::Config::Method.new get_topic_config
|
1073
|
+
list_topics_config = parent_rpcs&.list_topics if parent_rpcs&.respond_to? :list_topics
|
1074
|
+
@list_topics = ::Gapic::Config::Method.new list_topics_config
|
1075
|
+
list_topic_subscriptions_config = parent_rpcs&.list_topic_subscriptions if parent_rpcs&.respond_to? :list_topic_subscriptions
|
1076
|
+
@list_topic_subscriptions = ::Gapic::Config::Method.new list_topic_subscriptions_config
|
1077
|
+
list_topic_snapshots_config = parent_rpcs&.list_topic_snapshots if parent_rpcs&.respond_to? :list_topic_snapshots
|
1078
|
+
@list_topic_snapshots = ::Gapic::Config::Method.new list_topic_snapshots_config
|
1079
|
+
delete_topic_config = parent_rpcs&.delete_topic if parent_rpcs&.respond_to? :delete_topic
|
1080
|
+
@delete_topic = ::Gapic::Config::Method.new delete_topic_config
|
1081
|
+
detach_subscription_config = parent_rpcs&.detach_subscription if parent_rpcs&.respond_to? :detach_subscription
|
1082
|
+
@detach_subscription = ::Gapic::Config::Method.new detach_subscription_config
|
1083
|
+
|
1084
|
+
yield self if block_given?
|
1085
|
+
end
|
1086
|
+
end
|
1087
|
+
end
|
1088
|
+
end
|
1089
|
+
end
|
1090
|
+
end
|
1091
|
+
end
|
1092
|
+
end
|
1093
|
+
end
|