google-cloud-pubsub-v1 1.15.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/google/cloud/pubsub/v1/bindings_override.rb +158 -0
- data/lib/google/cloud/pubsub/v1/rest.rb +40 -0
- data/lib/google/cloud/pubsub/v1/schema_service/client.rb +3 -1
- data/lib/google/cloud/pubsub/v1/schema_service/credentials.rb +1 -1
- data/lib/google/cloud/pubsub/v1/schema_service/paths.rb +1 -1
- data/lib/google/cloud/pubsub/v1/schema_service/rest/client.rb +1348 -0
- data/lib/google/cloud/pubsub/v1/schema_service/rest/service_stub.rb +696 -0
- data/lib/google/cloud/pubsub/v1/schema_service/rest.rb +53 -0
- data/lib/google/cloud/pubsub/v1/schema_service.rb +7 -1
- data/lib/google/cloud/pubsub/v1/subscription_admin/client.rb +9 -5
- data/lib/google/cloud/pubsub/v1/subscription_admin/credentials.rb +1 -1
- data/lib/google/cloud/pubsub/v1/subscription_admin/paths.rb +1 -1
- data/lib/google/cloud/pubsub/v1/subscription_admin/rest/client.rb +2035 -0
- data/lib/google/cloud/pubsub/v1/subscription_admin/rest/service_stub.rb +1005 -0
- data/lib/google/cloud/pubsub/v1/subscription_admin/rest.rb +55 -0
- data/lib/google/cloud/pubsub/v1/subscription_admin.rb +7 -1
- data/lib/google/cloud/pubsub/v1/topic_admin/client.rb +6 -3
- data/lib/google/cloud/pubsub/v1/topic_admin/credentials.rb +1 -1
- data/lib/google/cloud/pubsub/v1/topic_admin/paths.rb +1 -1
- data/lib/google/cloud/pubsub/v1/topic_admin/rest/client.rb +1274 -0
- data/lib/google/cloud/pubsub/v1/topic_admin/rest/service_stub.rb +633 -0
- data/lib/google/cloud/pubsub/v1/topic_admin/rest.rb +54 -0
- data/lib/google/cloud/pubsub/v1/topic_admin.rb +7 -1
- data/lib/google/cloud/pubsub/v1/version.rb +1 -1
- data/lib/google/cloud/pubsub/v1.rb +6 -1
- data/lib/google/pubsub/v1/pubsub_pb.rb +4 -1
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +1 -1
- data/lib/google/pubsub/v1/schema_pb.rb +2 -1
- data/lib/google/pubsub/v1/schema_services_pb.rb +1 -1
- data/lib/google-cloud-pubsub-v1.rb +1 -1
- data/proto_docs/google/api/client.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +1 -1
- data/proto_docs/google/api/launch_stage.rb +1 -1
- data/proto_docs/google/api/resource.rb +1 -1
- data/proto_docs/google/protobuf/duration.rb +1 -1
- data/proto_docs/google/protobuf/empty.rb +1 -1
- data/proto_docs/google/protobuf/field_mask.rb +1 -1
- data/proto_docs/google/protobuf/timestamp.rb +8 -7
- data/proto_docs/google/pubsub/v1/pubsub.rb +101 -25
- data/proto_docs/google/pubsub/v1/schema.rb +18 -1
- metadata +18 -8
- data/proto_docs/google/type/expr.rb +0 -75
|
@@ -0,0 +1,1274 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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
|
+
require "google/cloud/pubsub/v1/topic_admin/rest/service_stub"
|
|
22
|
+
require "google/iam/v1/rest"
|
|
23
|
+
|
|
24
|
+
module Google
|
|
25
|
+
module Cloud
|
|
26
|
+
module PubSub
|
|
27
|
+
module V1
|
|
28
|
+
module TopicAdmin
|
|
29
|
+
module Rest
|
|
30
|
+
##
|
|
31
|
+
# REST client for the TopicAdmin service.
|
|
32
|
+
#
|
|
33
|
+
# The service that an application uses to manipulate topics, and to send
|
|
34
|
+
# messages to a topic.
|
|
35
|
+
#
|
|
36
|
+
class Client
|
|
37
|
+
# @private
|
|
38
|
+
API_VERSION = ""
|
|
39
|
+
|
|
40
|
+
# @private
|
|
41
|
+
DEFAULT_ENDPOINT_TEMPLATE = "pubsub.$UNIVERSE_DOMAIN$"
|
|
42
|
+
|
|
43
|
+
include Paths
|
|
44
|
+
|
|
45
|
+
# @private
|
|
46
|
+
attr_reader :topic_admin_stub
|
|
47
|
+
|
|
48
|
+
##
|
|
49
|
+
# Configure the TopicAdmin Client class.
|
|
50
|
+
#
|
|
51
|
+
# See {::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client::Configuration}
|
|
52
|
+
# for a description of the configuration fields.
|
|
53
|
+
#
|
|
54
|
+
# @example
|
|
55
|
+
#
|
|
56
|
+
# # Modify the configuration for all TopicAdmin clients
|
|
57
|
+
# ::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.configure do |config|
|
|
58
|
+
# config.timeout = 10.0
|
|
59
|
+
# end
|
|
60
|
+
#
|
|
61
|
+
# @yield [config] Configure the Client client.
|
|
62
|
+
# @yieldparam config [Client::Configuration]
|
|
63
|
+
#
|
|
64
|
+
# @return [Client::Configuration]
|
|
65
|
+
#
|
|
66
|
+
def self.configure
|
|
67
|
+
@configure ||= begin
|
|
68
|
+
namespace = ["Google", "Cloud", "PubSub", "V1"]
|
|
69
|
+
parent_config = while namespace.any?
|
|
70
|
+
parent_name = namespace.join "::"
|
|
71
|
+
parent_const = const_get parent_name
|
|
72
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
73
|
+
namespace.pop
|
|
74
|
+
end
|
|
75
|
+
default_config = Client::Configuration.new parent_config
|
|
76
|
+
|
|
77
|
+
default_config.rpcs.create_topic.timeout = 60.0
|
|
78
|
+
default_config.rpcs.create_topic.retry_policy = {
|
|
79
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
default_config.rpcs.update_topic.timeout = 60.0
|
|
83
|
+
default_config.rpcs.update_topic.retry_policy = {
|
|
84
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
default_config.rpcs.publish.timeout = 60.0
|
|
88
|
+
default_config.rpcs.publish.retry_policy = {
|
|
89
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 4, retry_codes: [10, 1, 13, 8, 2, 14, 4]
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
default_config.rpcs.get_topic.timeout = 60.0
|
|
93
|
+
default_config.rpcs.get_topic.retry_policy = {
|
|
94
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
default_config.rpcs.list_topics.timeout = 60.0
|
|
98
|
+
default_config.rpcs.list_topics.retry_policy = {
|
|
99
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
default_config.rpcs.list_topic_subscriptions.timeout = 60.0
|
|
103
|
+
default_config.rpcs.list_topic_subscriptions.retry_policy = {
|
|
104
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
default_config.rpcs.list_topic_snapshots.timeout = 60.0
|
|
108
|
+
default_config.rpcs.list_topic_snapshots.retry_policy = {
|
|
109
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
default_config.rpcs.delete_topic.timeout = 60.0
|
|
113
|
+
default_config.rpcs.delete_topic.retry_policy = {
|
|
114
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
default_config.rpcs.detach_subscription.timeout = 60.0
|
|
118
|
+
default_config.rpcs.detach_subscription.retry_policy = {
|
|
119
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
default_config
|
|
123
|
+
end
|
|
124
|
+
yield @configure if block_given?
|
|
125
|
+
@configure
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
##
|
|
129
|
+
# Configure the TopicAdmin Client instance.
|
|
130
|
+
#
|
|
131
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
132
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
133
|
+
# should be made on {Client.configure}.
|
|
134
|
+
#
|
|
135
|
+
# See {::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client::Configuration}
|
|
136
|
+
# for a description of the configuration fields.
|
|
137
|
+
#
|
|
138
|
+
# @yield [config] Configure the Client client.
|
|
139
|
+
# @yieldparam config [Client::Configuration]
|
|
140
|
+
#
|
|
141
|
+
# @return [Client::Configuration]
|
|
142
|
+
#
|
|
143
|
+
def configure
|
|
144
|
+
yield @config if block_given?
|
|
145
|
+
@config
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
##
|
|
149
|
+
# The effective universe domain
|
|
150
|
+
#
|
|
151
|
+
# @return [String]
|
|
152
|
+
#
|
|
153
|
+
def universe_domain
|
|
154
|
+
@topic_admin_stub.universe_domain
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
##
|
|
158
|
+
# Create a new TopicAdmin REST client object.
|
|
159
|
+
#
|
|
160
|
+
# @example
|
|
161
|
+
#
|
|
162
|
+
# # Create a client using the default configuration
|
|
163
|
+
# client = ::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
164
|
+
#
|
|
165
|
+
# # Create a client using a custom configuration
|
|
166
|
+
# client = ::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new do |config|
|
|
167
|
+
# config.timeout = 10.0
|
|
168
|
+
# end
|
|
169
|
+
#
|
|
170
|
+
# @yield [config] Configure the TopicAdmin client.
|
|
171
|
+
# @yieldparam config [Client::Configuration]
|
|
172
|
+
#
|
|
173
|
+
def initialize
|
|
174
|
+
# Create the configuration object
|
|
175
|
+
@config = Configuration.new Client.configure
|
|
176
|
+
|
|
177
|
+
# Yield the configuration if needed
|
|
178
|
+
yield @config if block_given?
|
|
179
|
+
|
|
180
|
+
# Create credentials
|
|
181
|
+
credentials = @config.credentials
|
|
182
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
183
|
+
# but only if the default endpoint does not have a region prefix.
|
|
184
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
185
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
186
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
187
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
188
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
189
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
190
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
@quota_project_id = @config.quota_project
|
|
194
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
195
|
+
|
|
196
|
+
@topic_admin_stub = ::Google::Cloud::PubSub::V1::TopicAdmin::Rest::ServiceStub.new(
|
|
197
|
+
endpoint: @config.endpoint,
|
|
198
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
199
|
+
universe_domain: @config.universe_domain,
|
|
200
|
+
credentials: credentials,
|
|
201
|
+
logger: @config.logger
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
@topic_admin_stub.logger(stub: true)&.info do |entry|
|
|
205
|
+
entry.set_system_name
|
|
206
|
+
entry.set_service
|
|
207
|
+
entry.message = "Created client for #{entry.service}"
|
|
208
|
+
entry.set_credentials_fields credentials
|
|
209
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
210
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
211
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
|
215
|
+
config.credentials = credentials
|
|
216
|
+
config.quota_project = @quota_project_id
|
|
217
|
+
config.endpoint = @topic_admin_stub.endpoint
|
|
218
|
+
config.universe_domain = @topic_admin_stub.universe_domain
|
|
219
|
+
config.bindings_override = @config.bindings_override
|
|
220
|
+
config.logger = @topic_admin_stub.logger if config.respond_to? :logger=
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
##
|
|
225
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
|
226
|
+
#
|
|
227
|
+
# @return [Google::Iam::V1::IAMPolicy::Rest::Client]
|
|
228
|
+
#
|
|
229
|
+
attr_reader :iam_policy_client
|
|
230
|
+
|
|
231
|
+
##
|
|
232
|
+
# The logger used for request/response debug logging.
|
|
233
|
+
#
|
|
234
|
+
# @return [Logger]
|
|
235
|
+
#
|
|
236
|
+
def logger
|
|
237
|
+
@topic_admin_stub.logger
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Service calls
|
|
241
|
+
|
|
242
|
+
##
|
|
243
|
+
# Creates the given topic with the given name. See the [resource name rules]
|
|
244
|
+
# (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
|
|
245
|
+
#
|
|
246
|
+
# @overload create_topic(request, options = nil)
|
|
247
|
+
# Pass arguments to `create_topic` via a request object, either of type
|
|
248
|
+
# {::Google::Cloud::PubSub::V1::Topic} or an equivalent Hash.
|
|
249
|
+
#
|
|
250
|
+
# @param request [::Google::Cloud::PubSub::V1::Topic, ::Hash]
|
|
251
|
+
# A request object representing the call parameters. Required. To specify no
|
|
252
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
253
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
254
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
255
|
+
#
|
|
256
|
+
# @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil, schema_settings: nil, satisfies_pzs: nil, message_retention_duration: nil, ingestion_data_source_settings: nil, message_transforms: nil, tags: nil)
|
|
257
|
+
# Pass arguments to `create_topic` via keyword arguments. Note that at
|
|
258
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
259
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
260
|
+
#
|
|
261
|
+
# @param name [::String]
|
|
262
|
+
# Required. Identifier. The name of the topic. It must have the format
|
|
263
|
+
# `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
|
|
264
|
+
# and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
|
|
265
|
+
# underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
|
|
266
|
+
# signs (`%`). It must be between 3 and 255 characters in length, and it
|
|
267
|
+
# must not start with `"goog"`.
|
|
268
|
+
# @param labels [::Hash{::String => ::String}]
|
|
269
|
+
# Optional. See [Creating and managing labels]
|
|
270
|
+
# (https://cloud.google.com/pubsub/docs/labels).
|
|
271
|
+
# @param message_storage_policy [::Google::Cloud::PubSub::V1::MessageStoragePolicy, ::Hash]
|
|
272
|
+
# Optional. Policy constraining the set of Google Cloud Platform regions
|
|
273
|
+
# where messages published to the topic may be stored. If not present, then
|
|
274
|
+
# no constraints are in effect.
|
|
275
|
+
# @param kms_key_name [::String]
|
|
276
|
+
# Optional. The resource name of the Cloud KMS CryptoKey to be used to
|
|
277
|
+
# protect access to messages published on this topic.
|
|
278
|
+
#
|
|
279
|
+
# The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
|
|
280
|
+
# @param schema_settings [::Google::Cloud::PubSub::V1::SchemaSettings, ::Hash]
|
|
281
|
+
# Optional. Settings for validating messages published against a schema.
|
|
282
|
+
# @param satisfies_pzs [::Boolean]
|
|
283
|
+
# Optional. Reserved for future use. This field is set only in responses from
|
|
284
|
+
# the server; it is ignored if it is set in any requests.
|
|
285
|
+
# @param message_retention_duration [::Google::Protobuf::Duration, ::Hash]
|
|
286
|
+
# Optional. Indicates the minimum duration to retain a message after it is
|
|
287
|
+
# published to the topic. If this field is set, messages published to the
|
|
288
|
+
# topic in the last `message_retention_duration` are always available to
|
|
289
|
+
# subscribers. For instance, it allows any attached subscription to [seek to
|
|
290
|
+
# a
|
|
291
|
+
# timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
|
|
292
|
+
# that is up to `message_retention_duration` in the past. If this field is
|
|
293
|
+
# not set, message retention is controlled by settings on individual
|
|
294
|
+
# subscriptions. Cannot be more than 31 days or less than 10 minutes.
|
|
295
|
+
# @param ingestion_data_source_settings [::Google::Cloud::PubSub::V1::IngestionDataSourceSettings, ::Hash]
|
|
296
|
+
# Optional. Settings for ingestion from a data source into this topic.
|
|
297
|
+
# @param message_transforms [::Array<::Google::Cloud::PubSub::V1::MessageTransform, ::Hash>]
|
|
298
|
+
# Optional. Transforms to be applied to messages published to the topic.
|
|
299
|
+
# Transforms are applied in the order specified.
|
|
300
|
+
# @param tags [::Hash{::String => ::String}]
|
|
301
|
+
# Optional. Input only. Immutable. Tag keys/values directly bound to this
|
|
302
|
+
# resource. For example:
|
|
303
|
+
# "123/environment": "production",
|
|
304
|
+
# "123/costCenter": "marketing"
|
|
305
|
+
# See
|
|
306
|
+
# https://\\{$universe.dns_names.final_documentation_domain}/pubsub/docs/tags
|
|
307
|
+
# for more information on using tags with Pub/Sub resources.
|
|
308
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
309
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Topic]
|
|
310
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
311
|
+
#
|
|
312
|
+
# @return [::Google::Cloud::PubSub::V1::Topic]
|
|
313
|
+
#
|
|
314
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
315
|
+
#
|
|
316
|
+
# @example Basic example
|
|
317
|
+
# require "google/cloud/pubsub/v1"
|
|
318
|
+
#
|
|
319
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
320
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
321
|
+
#
|
|
322
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
323
|
+
# request = Google::Cloud::PubSub::V1::Topic.new
|
|
324
|
+
#
|
|
325
|
+
# # Call the create_topic method.
|
|
326
|
+
# result = client.create_topic request
|
|
327
|
+
#
|
|
328
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Topic.
|
|
329
|
+
# p result
|
|
330
|
+
#
|
|
331
|
+
def create_topic request, options = nil
|
|
332
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
333
|
+
|
|
334
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::Topic
|
|
335
|
+
|
|
336
|
+
# Converts hash and nil to an options object
|
|
337
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
338
|
+
|
|
339
|
+
# Customize the options with defaults
|
|
340
|
+
call_metadata = @config.rpcs.create_topic.metadata.to_h
|
|
341
|
+
|
|
342
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
343
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
344
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
345
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
346
|
+
transports_version_send: [:rest]
|
|
347
|
+
|
|
348
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
349
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
350
|
+
|
|
351
|
+
options.apply_defaults timeout: @config.rpcs.create_topic.timeout,
|
|
352
|
+
metadata: call_metadata,
|
|
353
|
+
retry_policy: @config.rpcs.create_topic.retry_policy
|
|
354
|
+
|
|
355
|
+
options.apply_defaults timeout: @config.timeout,
|
|
356
|
+
metadata: @config.metadata,
|
|
357
|
+
retry_policy: @config.retry_policy
|
|
358
|
+
|
|
359
|
+
@topic_admin_stub.create_topic request, options do |result, operation|
|
|
360
|
+
yield result, operation if block_given?
|
|
361
|
+
end
|
|
362
|
+
rescue ::Gapic::Rest::Error => e
|
|
363
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
##
|
|
367
|
+
# Updates an existing topic by updating the fields specified in the update
|
|
368
|
+
# mask. Note that certain properties of a topic are not modifiable.
|
|
369
|
+
#
|
|
370
|
+
# @overload update_topic(request, options = nil)
|
|
371
|
+
# Pass arguments to `update_topic` via a request object, either of type
|
|
372
|
+
# {::Google::Cloud::PubSub::V1::UpdateTopicRequest} or an equivalent Hash.
|
|
373
|
+
#
|
|
374
|
+
# @param request [::Google::Cloud::PubSub::V1::UpdateTopicRequest, ::Hash]
|
|
375
|
+
# A request object representing the call parameters. Required. To specify no
|
|
376
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
377
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
378
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
379
|
+
#
|
|
380
|
+
# @overload update_topic(topic: nil, update_mask: nil)
|
|
381
|
+
# Pass arguments to `update_topic` via keyword arguments. Note that at
|
|
382
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
383
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
384
|
+
#
|
|
385
|
+
# @param topic [::Google::Cloud::PubSub::V1::Topic, ::Hash]
|
|
386
|
+
# Required. The updated topic object.
|
|
387
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
|
388
|
+
# Required. Indicates which fields in the provided topic to update. Must be
|
|
389
|
+
# specified and non-empty. Note that if `update_mask` contains
|
|
390
|
+
# "message_storage_policy" but the `message_storage_policy` is not set in
|
|
391
|
+
# the `topic` provided above, then the updated value is determined by the
|
|
392
|
+
# policy configured at the project or organization level.
|
|
393
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
394
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Topic]
|
|
395
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
396
|
+
#
|
|
397
|
+
# @return [::Google::Cloud::PubSub::V1::Topic]
|
|
398
|
+
#
|
|
399
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
400
|
+
#
|
|
401
|
+
# @example Basic example
|
|
402
|
+
# require "google/cloud/pubsub/v1"
|
|
403
|
+
#
|
|
404
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
405
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
406
|
+
#
|
|
407
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
408
|
+
# request = Google::Cloud::PubSub::V1::UpdateTopicRequest.new
|
|
409
|
+
#
|
|
410
|
+
# # Call the update_topic method.
|
|
411
|
+
# result = client.update_topic request
|
|
412
|
+
#
|
|
413
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Topic.
|
|
414
|
+
# p result
|
|
415
|
+
#
|
|
416
|
+
def update_topic request, options = nil
|
|
417
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
418
|
+
|
|
419
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::UpdateTopicRequest
|
|
420
|
+
|
|
421
|
+
# Converts hash and nil to an options object
|
|
422
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
423
|
+
|
|
424
|
+
# Customize the options with defaults
|
|
425
|
+
call_metadata = @config.rpcs.update_topic.metadata.to_h
|
|
426
|
+
|
|
427
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
428
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
429
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
430
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
431
|
+
transports_version_send: [:rest]
|
|
432
|
+
|
|
433
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
434
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
435
|
+
|
|
436
|
+
options.apply_defaults timeout: @config.rpcs.update_topic.timeout,
|
|
437
|
+
metadata: call_metadata,
|
|
438
|
+
retry_policy: @config.rpcs.update_topic.retry_policy
|
|
439
|
+
|
|
440
|
+
options.apply_defaults timeout: @config.timeout,
|
|
441
|
+
metadata: @config.metadata,
|
|
442
|
+
retry_policy: @config.retry_policy
|
|
443
|
+
|
|
444
|
+
@topic_admin_stub.update_topic request, options do |result, operation|
|
|
445
|
+
yield result, operation if block_given?
|
|
446
|
+
end
|
|
447
|
+
rescue ::Gapic::Rest::Error => e
|
|
448
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
##
|
|
452
|
+
# Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
|
|
453
|
+
# does not exist.
|
|
454
|
+
#
|
|
455
|
+
# @overload publish(request, options = nil)
|
|
456
|
+
# Pass arguments to `publish` via a request object, either of type
|
|
457
|
+
# {::Google::Cloud::PubSub::V1::PublishRequest} or an equivalent Hash.
|
|
458
|
+
#
|
|
459
|
+
# @param request [::Google::Cloud::PubSub::V1::PublishRequest, ::Hash]
|
|
460
|
+
# A request object representing the call parameters. Required. To specify no
|
|
461
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
462
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
463
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
464
|
+
#
|
|
465
|
+
# @overload publish(topic: nil, messages: nil)
|
|
466
|
+
# Pass arguments to `publish` via keyword arguments. Note that at
|
|
467
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
468
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
469
|
+
#
|
|
470
|
+
# @param topic [::String]
|
|
471
|
+
# Required. The messages in the request will be published on this topic.
|
|
472
|
+
# Format is `projects/{project}/topics/{topic}`.
|
|
473
|
+
# @param messages [::Array<::Google::Cloud::PubSub::V1::PubsubMessage, ::Hash>]
|
|
474
|
+
# Required. The messages to publish.
|
|
475
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
476
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::PublishResponse]
|
|
477
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
478
|
+
#
|
|
479
|
+
# @return [::Google::Cloud::PubSub::V1::PublishResponse]
|
|
480
|
+
#
|
|
481
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
482
|
+
#
|
|
483
|
+
# @example Basic example
|
|
484
|
+
# require "google/cloud/pubsub/v1"
|
|
485
|
+
#
|
|
486
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
487
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
488
|
+
#
|
|
489
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
490
|
+
# request = Google::Cloud::PubSub::V1::PublishRequest.new
|
|
491
|
+
#
|
|
492
|
+
# # Call the publish method.
|
|
493
|
+
# result = client.publish request
|
|
494
|
+
#
|
|
495
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::PublishResponse.
|
|
496
|
+
# p result
|
|
497
|
+
#
|
|
498
|
+
def publish request, options = nil
|
|
499
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
500
|
+
|
|
501
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::PublishRequest
|
|
502
|
+
|
|
503
|
+
# Converts hash and nil to an options object
|
|
504
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
505
|
+
|
|
506
|
+
# Customize the options with defaults
|
|
507
|
+
call_metadata = @config.rpcs.publish.metadata.to_h
|
|
508
|
+
|
|
509
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
510
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
511
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
512
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
513
|
+
transports_version_send: [:rest]
|
|
514
|
+
|
|
515
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
516
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
517
|
+
|
|
518
|
+
options.apply_defaults timeout: @config.rpcs.publish.timeout,
|
|
519
|
+
metadata: call_metadata,
|
|
520
|
+
retry_policy: @config.rpcs.publish.retry_policy
|
|
521
|
+
|
|
522
|
+
options.apply_defaults timeout: @config.timeout,
|
|
523
|
+
metadata: @config.metadata,
|
|
524
|
+
retry_policy: @config.retry_policy
|
|
525
|
+
|
|
526
|
+
@topic_admin_stub.publish request, options do |result, operation|
|
|
527
|
+
yield result, operation if block_given?
|
|
528
|
+
end
|
|
529
|
+
rescue ::Gapic::Rest::Error => e
|
|
530
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
531
|
+
end
|
|
532
|
+
|
|
533
|
+
##
|
|
534
|
+
# Gets the configuration of a topic.
|
|
535
|
+
#
|
|
536
|
+
# @overload get_topic(request, options = nil)
|
|
537
|
+
# Pass arguments to `get_topic` via a request object, either of type
|
|
538
|
+
# {::Google::Cloud::PubSub::V1::GetTopicRequest} or an equivalent Hash.
|
|
539
|
+
#
|
|
540
|
+
# @param request [::Google::Cloud::PubSub::V1::GetTopicRequest, ::Hash]
|
|
541
|
+
# A request object representing the call parameters. Required. To specify no
|
|
542
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
543
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
544
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
545
|
+
#
|
|
546
|
+
# @overload get_topic(topic: nil)
|
|
547
|
+
# Pass arguments to `get_topic` via keyword arguments. Note that at
|
|
548
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
549
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
550
|
+
#
|
|
551
|
+
# @param topic [::String]
|
|
552
|
+
# Required. The name of the topic to get.
|
|
553
|
+
# Format is `projects/{project}/topics/{topic}`.
|
|
554
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
555
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Topic]
|
|
556
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
557
|
+
#
|
|
558
|
+
# @return [::Google::Cloud::PubSub::V1::Topic]
|
|
559
|
+
#
|
|
560
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
561
|
+
#
|
|
562
|
+
# @example Basic example
|
|
563
|
+
# require "google/cloud/pubsub/v1"
|
|
564
|
+
#
|
|
565
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
566
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
567
|
+
#
|
|
568
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
569
|
+
# request = Google::Cloud::PubSub::V1::GetTopicRequest.new
|
|
570
|
+
#
|
|
571
|
+
# # Call the get_topic method.
|
|
572
|
+
# result = client.get_topic request
|
|
573
|
+
#
|
|
574
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Topic.
|
|
575
|
+
# p result
|
|
576
|
+
#
|
|
577
|
+
def get_topic request, options = nil
|
|
578
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
579
|
+
|
|
580
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::GetTopicRequest
|
|
581
|
+
|
|
582
|
+
# Converts hash and nil to an options object
|
|
583
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
584
|
+
|
|
585
|
+
# Customize the options with defaults
|
|
586
|
+
call_metadata = @config.rpcs.get_topic.metadata.to_h
|
|
587
|
+
|
|
588
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
589
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
590
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
591
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
592
|
+
transports_version_send: [:rest]
|
|
593
|
+
|
|
594
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
595
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
596
|
+
|
|
597
|
+
options.apply_defaults timeout: @config.rpcs.get_topic.timeout,
|
|
598
|
+
metadata: call_metadata,
|
|
599
|
+
retry_policy: @config.rpcs.get_topic.retry_policy
|
|
600
|
+
|
|
601
|
+
options.apply_defaults timeout: @config.timeout,
|
|
602
|
+
metadata: @config.metadata,
|
|
603
|
+
retry_policy: @config.retry_policy
|
|
604
|
+
|
|
605
|
+
@topic_admin_stub.get_topic request, options do |result, operation|
|
|
606
|
+
yield result, operation if block_given?
|
|
607
|
+
end
|
|
608
|
+
rescue ::Gapic::Rest::Error => e
|
|
609
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
##
|
|
613
|
+
# Lists matching topics.
|
|
614
|
+
#
|
|
615
|
+
# @overload list_topics(request, options = nil)
|
|
616
|
+
# Pass arguments to `list_topics` via a request object, either of type
|
|
617
|
+
# {::Google::Cloud::PubSub::V1::ListTopicsRequest} or an equivalent Hash.
|
|
618
|
+
#
|
|
619
|
+
# @param request [::Google::Cloud::PubSub::V1::ListTopicsRequest, ::Hash]
|
|
620
|
+
# A request object representing the call parameters. Required. To specify no
|
|
621
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
622
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
623
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
624
|
+
#
|
|
625
|
+
# @overload list_topics(project: nil, page_size: nil, page_token: nil)
|
|
626
|
+
# Pass arguments to `list_topics` via keyword arguments. Note that at
|
|
627
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
628
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
629
|
+
#
|
|
630
|
+
# @param project [::String]
|
|
631
|
+
# Required. The name of the project in which to list topics.
|
|
632
|
+
# Format is `projects/{project-id}`.
|
|
633
|
+
# @param page_size [::Integer]
|
|
634
|
+
# Optional. Maximum number of topics to return.
|
|
635
|
+
# @param page_token [::String]
|
|
636
|
+
# Optional. The value returned by the last `ListTopicsResponse`; indicates
|
|
637
|
+
# that this is a continuation of a prior `ListTopics` call, and that the
|
|
638
|
+
# system should return the next page of data.
|
|
639
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
640
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Topic>]
|
|
641
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
642
|
+
#
|
|
643
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Topic>]
|
|
644
|
+
#
|
|
645
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
646
|
+
#
|
|
647
|
+
# @example Basic example
|
|
648
|
+
# require "google/cloud/pubsub/v1"
|
|
649
|
+
#
|
|
650
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
651
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
652
|
+
#
|
|
653
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
654
|
+
# request = Google::Cloud::PubSub::V1::ListTopicsRequest.new
|
|
655
|
+
#
|
|
656
|
+
# # Call the list_topics method.
|
|
657
|
+
# result = client.list_topics request
|
|
658
|
+
#
|
|
659
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
660
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
661
|
+
# result.each do |item|
|
|
662
|
+
# # Each element is of type ::Google::Cloud::PubSub::V1::Topic.
|
|
663
|
+
# p item
|
|
664
|
+
# end
|
|
665
|
+
#
|
|
666
|
+
def list_topics request, options = nil
|
|
667
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
668
|
+
|
|
669
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListTopicsRequest
|
|
670
|
+
|
|
671
|
+
# Converts hash and nil to an options object
|
|
672
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
673
|
+
|
|
674
|
+
# Customize the options with defaults
|
|
675
|
+
call_metadata = @config.rpcs.list_topics.metadata.to_h
|
|
676
|
+
|
|
677
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
678
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
679
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
680
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
681
|
+
transports_version_send: [:rest]
|
|
682
|
+
|
|
683
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
684
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
685
|
+
|
|
686
|
+
options.apply_defaults timeout: @config.rpcs.list_topics.timeout,
|
|
687
|
+
metadata: call_metadata,
|
|
688
|
+
retry_policy: @config.rpcs.list_topics.retry_policy
|
|
689
|
+
|
|
690
|
+
options.apply_defaults timeout: @config.timeout,
|
|
691
|
+
metadata: @config.metadata,
|
|
692
|
+
retry_policy: @config.retry_policy
|
|
693
|
+
|
|
694
|
+
@topic_admin_stub.list_topics request, options do |result, operation|
|
|
695
|
+
result = ::Gapic::Rest::PagedEnumerable.new @topic_admin_stub, :list_topics, "topics", request, result, options
|
|
696
|
+
yield result, operation if block_given?
|
|
697
|
+
throw :response, result
|
|
698
|
+
end
|
|
699
|
+
rescue ::Gapic::Rest::Error => e
|
|
700
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
701
|
+
end
|
|
702
|
+
|
|
703
|
+
##
|
|
704
|
+
# Lists the names of the attached subscriptions on this topic.
|
|
705
|
+
#
|
|
706
|
+
# @overload list_topic_subscriptions(request, options = nil)
|
|
707
|
+
# Pass arguments to `list_topic_subscriptions` via a request object, either of type
|
|
708
|
+
# {::Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest} or an equivalent Hash.
|
|
709
|
+
#
|
|
710
|
+
# @param request [::Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest, ::Hash]
|
|
711
|
+
# A request object representing the call parameters. Required. To specify no
|
|
712
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
713
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
714
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
715
|
+
#
|
|
716
|
+
# @overload list_topic_subscriptions(topic: nil, page_size: nil, page_token: nil)
|
|
717
|
+
# Pass arguments to `list_topic_subscriptions` via keyword arguments. Note that at
|
|
718
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
719
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
720
|
+
#
|
|
721
|
+
# @param topic [::String]
|
|
722
|
+
# Required. The name of the topic that subscriptions are attached to.
|
|
723
|
+
# Format is `projects/{project}/topics/{topic}`.
|
|
724
|
+
# @param page_size [::Integer]
|
|
725
|
+
# Optional. Maximum number of subscription names to return.
|
|
726
|
+
# @param page_token [::String]
|
|
727
|
+
# Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
|
|
728
|
+
# indicates that this is a continuation of a prior `ListTopicSubscriptions`
|
|
729
|
+
# call, and that the system should return the next page of data.
|
|
730
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
731
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse]
|
|
732
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
733
|
+
#
|
|
734
|
+
# @return [::Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse]
|
|
735
|
+
#
|
|
736
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
737
|
+
#
|
|
738
|
+
# @example Basic example
|
|
739
|
+
# require "google/cloud/pubsub/v1"
|
|
740
|
+
#
|
|
741
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
742
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
743
|
+
#
|
|
744
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
745
|
+
# request = Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest.new
|
|
746
|
+
#
|
|
747
|
+
# # Call the list_topic_subscriptions method.
|
|
748
|
+
# result = client.list_topic_subscriptions request
|
|
749
|
+
#
|
|
750
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse.
|
|
751
|
+
# p result
|
|
752
|
+
#
|
|
753
|
+
def list_topic_subscriptions request, options = nil
|
|
754
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
755
|
+
|
|
756
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest
|
|
757
|
+
|
|
758
|
+
# Converts hash and nil to an options object
|
|
759
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
760
|
+
|
|
761
|
+
# Customize the options with defaults
|
|
762
|
+
call_metadata = @config.rpcs.list_topic_subscriptions.metadata.to_h
|
|
763
|
+
|
|
764
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
765
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
766
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
767
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
768
|
+
transports_version_send: [:rest]
|
|
769
|
+
|
|
770
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
771
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
772
|
+
|
|
773
|
+
options.apply_defaults timeout: @config.rpcs.list_topic_subscriptions.timeout,
|
|
774
|
+
metadata: call_metadata,
|
|
775
|
+
retry_policy: @config.rpcs.list_topic_subscriptions.retry_policy
|
|
776
|
+
|
|
777
|
+
options.apply_defaults timeout: @config.timeout,
|
|
778
|
+
metadata: @config.metadata,
|
|
779
|
+
retry_policy: @config.retry_policy
|
|
780
|
+
|
|
781
|
+
@topic_admin_stub.list_topic_subscriptions request, options do |result, operation|
|
|
782
|
+
yield result, operation if block_given?
|
|
783
|
+
end
|
|
784
|
+
rescue ::Gapic::Rest::Error => e
|
|
785
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
786
|
+
end
|
|
787
|
+
|
|
788
|
+
##
|
|
789
|
+
# Lists the names of the snapshots on this topic. Snapshots are used in
|
|
790
|
+
# [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
|
|
791
|
+
# which allow you to manage message acknowledgments in bulk. That is, you can
|
|
792
|
+
# set the acknowledgment state of messages in an existing subscription to the
|
|
793
|
+
# state captured by a snapshot.
|
|
794
|
+
#
|
|
795
|
+
# @overload list_topic_snapshots(request, options = nil)
|
|
796
|
+
# Pass arguments to `list_topic_snapshots` via a request object, either of type
|
|
797
|
+
# {::Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest} or an equivalent Hash.
|
|
798
|
+
#
|
|
799
|
+
# @param request [::Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest, ::Hash]
|
|
800
|
+
# A request object representing the call parameters. Required. To specify no
|
|
801
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
802
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
803
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
804
|
+
#
|
|
805
|
+
# @overload list_topic_snapshots(topic: nil, page_size: nil, page_token: nil)
|
|
806
|
+
# Pass arguments to `list_topic_snapshots` via keyword arguments. Note that at
|
|
807
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
808
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
809
|
+
#
|
|
810
|
+
# @param topic [::String]
|
|
811
|
+
# Required. The name of the topic that snapshots are attached to.
|
|
812
|
+
# Format is `projects/{project}/topics/{topic}`.
|
|
813
|
+
# @param page_size [::Integer]
|
|
814
|
+
# Optional. Maximum number of snapshot names to return.
|
|
815
|
+
# @param page_token [::String]
|
|
816
|
+
# Optional. The value returned by the last `ListTopicSnapshotsResponse`;
|
|
817
|
+
# indicates that this is a continuation of a prior `ListTopicSnapshots` call,
|
|
818
|
+
# and that the system should return the next page of data.
|
|
819
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
820
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse]
|
|
821
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
822
|
+
#
|
|
823
|
+
# @return [::Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse]
|
|
824
|
+
#
|
|
825
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
826
|
+
#
|
|
827
|
+
# @example Basic example
|
|
828
|
+
# require "google/cloud/pubsub/v1"
|
|
829
|
+
#
|
|
830
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
831
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
832
|
+
#
|
|
833
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
834
|
+
# request = Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest.new
|
|
835
|
+
#
|
|
836
|
+
# # Call the list_topic_snapshots method.
|
|
837
|
+
# result = client.list_topic_snapshots request
|
|
838
|
+
#
|
|
839
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse.
|
|
840
|
+
# p result
|
|
841
|
+
#
|
|
842
|
+
def list_topic_snapshots request, options = nil
|
|
843
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
844
|
+
|
|
845
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest
|
|
846
|
+
|
|
847
|
+
# Converts hash and nil to an options object
|
|
848
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
849
|
+
|
|
850
|
+
# Customize the options with defaults
|
|
851
|
+
call_metadata = @config.rpcs.list_topic_snapshots.metadata.to_h
|
|
852
|
+
|
|
853
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
854
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
855
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
856
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
857
|
+
transports_version_send: [:rest]
|
|
858
|
+
|
|
859
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
860
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
861
|
+
|
|
862
|
+
options.apply_defaults timeout: @config.rpcs.list_topic_snapshots.timeout,
|
|
863
|
+
metadata: call_metadata,
|
|
864
|
+
retry_policy: @config.rpcs.list_topic_snapshots.retry_policy
|
|
865
|
+
|
|
866
|
+
options.apply_defaults timeout: @config.timeout,
|
|
867
|
+
metadata: @config.metadata,
|
|
868
|
+
retry_policy: @config.retry_policy
|
|
869
|
+
|
|
870
|
+
@topic_admin_stub.list_topic_snapshots request, options do |result, operation|
|
|
871
|
+
yield result, operation if block_given?
|
|
872
|
+
end
|
|
873
|
+
rescue ::Gapic::Rest::Error => e
|
|
874
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
875
|
+
end
|
|
876
|
+
|
|
877
|
+
##
|
|
878
|
+
# Deletes the topic with the given name. Returns `NOT_FOUND` if the topic
|
|
879
|
+
# does not exist. After a topic is deleted, a new topic may be created with
|
|
880
|
+
# the same name; this is an entirely new topic with none of the old
|
|
881
|
+
# configuration or subscriptions. Existing subscriptions to this topic are
|
|
882
|
+
# not deleted, but their `topic` field is set to `_deleted-topic_`.
|
|
883
|
+
#
|
|
884
|
+
# @overload delete_topic(request, options = nil)
|
|
885
|
+
# Pass arguments to `delete_topic` via a request object, either of type
|
|
886
|
+
# {::Google::Cloud::PubSub::V1::DeleteTopicRequest} or an equivalent Hash.
|
|
887
|
+
#
|
|
888
|
+
# @param request [::Google::Cloud::PubSub::V1::DeleteTopicRequest, ::Hash]
|
|
889
|
+
# A request object representing the call parameters. Required. To specify no
|
|
890
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
891
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
892
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
893
|
+
#
|
|
894
|
+
# @overload delete_topic(topic: nil)
|
|
895
|
+
# Pass arguments to `delete_topic` via keyword arguments. Note that at
|
|
896
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
897
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
898
|
+
#
|
|
899
|
+
# @param topic [::String]
|
|
900
|
+
# Required. Name of the topic to delete.
|
|
901
|
+
# Format is `projects/{project}/topics/{topic}`.
|
|
902
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
903
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
|
904
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
905
|
+
#
|
|
906
|
+
# @return [::Google::Protobuf::Empty]
|
|
907
|
+
#
|
|
908
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
909
|
+
#
|
|
910
|
+
# @example Basic example
|
|
911
|
+
# require "google/cloud/pubsub/v1"
|
|
912
|
+
#
|
|
913
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
914
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
915
|
+
#
|
|
916
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
917
|
+
# request = Google::Cloud::PubSub::V1::DeleteTopicRequest.new
|
|
918
|
+
#
|
|
919
|
+
# # Call the delete_topic method.
|
|
920
|
+
# result = client.delete_topic request
|
|
921
|
+
#
|
|
922
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
|
923
|
+
# p result
|
|
924
|
+
#
|
|
925
|
+
def delete_topic request, options = nil
|
|
926
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
927
|
+
|
|
928
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteTopicRequest
|
|
929
|
+
|
|
930
|
+
# Converts hash and nil to an options object
|
|
931
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
932
|
+
|
|
933
|
+
# Customize the options with defaults
|
|
934
|
+
call_metadata = @config.rpcs.delete_topic.metadata.to_h
|
|
935
|
+
|
|
936
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
937
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
938
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
939
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
940
|
+
transports_version_send: [:rest]
|
|
941
|
+
|
|
942
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
943
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
944
|
+
|
|
945
|
+
options.apply_defaults timeout: @config.rpcs.delete_topic.timeout,
|
|
946
|
+
metadata: call_metadata,
|
|
947
|
+
retry_policy: @config.rpcs.delete_topic.retry_policy
|
|
948
|
+
|
|
949
|
+
options.apply_defaults timeout: @config.timeout,
|
|
950
|
+
metadata: @config.metadata,
|
|
951
|
+
retry_policy: @config.retry_policy
|
|
952
|
+
|
|
953
|
+
@topic_admin_stub.delete_topic request, options do |result, operation|
|
|
954
|
+
yield result, operation if block_given?
|
|
955
|
+
end
|
|
956
|
+
rescue ::Gapic::Rest::Error => e
|
|
957
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
958
|
+
end
|
|
959
|
+
|
|
960
|
+
##
|
|
961
|
+
# Detaches a subscription from this topic. All messages retained in the
|
|
962
|
+
# subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
|
|
963
|
+
# will return FAILED_PRECONDITION. If the subscription is a push
|
|
964
|
+
# subscription, pushes to the endpoint will stop.
|
|
965
|
+
#
|
|
966
|
+
# @overload detach_subscription(request, options = nil)
|
|
967
|
+
# Pass arguments to `detach_subscription` via a request object, either of type
|
|
968
|
+
# {::Google::Cloud::PubSub::V1::DetachSubscriptionRequest} or an equivalent Hash.
|
|
969
|
+
#
|
|
970
|
+
# @param request [::Google::Cloud::PubSub::V1::DetachSubscriptionRequest, ::Hash]
|
|
971
|
+
# A request object representing the call parameters. Required. To specify no
|
|
972
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
973
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
974
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
975
|
+
#
|
|
976
|
+
# @overload detach_subscription(subscription: nil)
|
|
977
|
+
# Pass arguments to `detach_subscription` via keyword arguments. Note that at
|
|
978
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
979
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
980
|
+
#
|
|
981
|
+
# @param subscription [::String]
|
|
982
|
+
# Required. The subscription to detach.
|
|
983
|
+
# Format is `projects/{project}/subscriptions/{subscription}`.
|
|
984
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
985
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::DetachSubscriptionResponse]
|
|
986
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
987
|
+
#
|
|
988
|
+
# @return [::Google::Cloud::PubSub::V1::DetachSubscriptionResponse]
|
|
989
|
+
#
|
|
990
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
991
|
+
#
|
|
992
|
+
# @example Basic example
|
|
993
|
+
# require "google/cloud/pubsub/v1"
|
|
994
|
+
#
|
|
995
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
996
|
+
# client = Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new
|
|
997
|
+
#
|
|
998
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
999
|
+
# request = Google::Cloud::PubSub::V1::DetachSubscriptionRequest.new
|
|
1000
|
+
#
|
|
1001
|
+
# # Call the detach_subscription method.
|
|
1002
|
+
# result = client.detach_subscription request
|
|
1003
|
+
#
|
|
1004
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::DetachSubscriptionResponse.
|
|
1005
|
+
# p result
|
|
1006
|
+
#
|
|
1007
|
+
def detach_subscription request, options = nil
|
|
1008
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
1009
|
+
|
|
1010
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DetachSubscriptionRequest
|
|
1011
|
+
|
|
1012
|
+
# Converts hash and nil to an options object
|
|
1013
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
1014
|
+
|
|
1015
|
+
# Customize the options with defaults
|
|
1016
|
+
call_metadata = @config.rpcs.detach_subscription.metadata.to_h
|
|
1017
|
+
|
|
1018
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
1019
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
1020
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
1021
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
1022
|
+
transports_version_send: [:rest]
|
|
1023
|
+
|
|
1024
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
1025
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
1026
|
+
|
|
1027
|
+
options.apply_defaults timeout: @config.rpcs.detach_subscription.timeout,
|
|
1028
|
+
metadata: call_metadata,
|
|
1029
|
+
retry_policy: @config.rpcs.detach_subscription.retry_policy
|
|
1030
|
+
|
|
1031
|
+
options.apply_defaults timeout: @config.timeout,
|
|
1032
|
+
metadata: @config.metadata,
|
|
1033
|
+
retry_policy: @config.retry_policy
|
|
1034
|
+
|
|
1035
|
+
@topic_admin_stub.detach_subscription request, options do |result, operation|
|
|
1036
|
+
yield result, operation if block_given?
|
|
1037
|
+
end
|
|
1038
|
+
rescue ::Gapic::Rest::Error => e
|
|
1039
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
1040
|
+
end
|
|
1041
|
+
|
|
1042
|
+
##
|
|
1043
|
+
# Configuration class for the TopicAdmin REST API.
|
|
1044
|
+
#
|
|
1045
|
+
# This class represents the configuration for TopicAdmin REST,
|
|
1046
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
1047
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
1048
|
+
# applied individually to specific RPCs. See
|
|
1049
|
+
# {::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client::Configuration::Rpcs}
|
|
1050
|
+
# for a list of RPCs that can be configured independently.
|
|
1051
|
+
#
|
|
1052
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
1053
|
+
# on construction.
|
|
1054
|
+
#
|
|
1055
|
+
# @example
|
|
1056
|
+
#
|
|
1057
|
+
# # Modify the global config, setting the timeout for
|
|
1058
|
+
# # create_topic to 20 seconds,
|
|
1059
|
+
# # and all remaining timeouts to 10 seconds.
|
|
1060
|
+
# ::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.configure do |config|
|
|
1061
|
+
# config.timeout = 10.0
|
|
1062
|
+
# config.rpcs.create_topic.timeout = 20.0
|
|
1063
|
+
# end
|
|
1064
|
+
#
|
|
1065
|
+
# # Apply the above configuration only to a new client.
|
|
1066
|
+
# client = ::Google::Cloud::PubSub::V1::TopicAdmin::Rest::Client.new do |config|
|
|
1067
|
+
# config.timeout = 10.0
|
|
1068
|
+
# config.rpcs.create_topic.timeout = 20.0
|
|
1069
|
+
# end
|
|
1070
|
+
#
|
|
1071
|
+
# @!attribute [rw] endpoint
|
|
1072
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
1073
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
1074
|
+
# @return [::String,nil]
|
|
1075
|
+
# @!attribute [rw] credentials
|
|
1076
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
1077
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
1078
|
+
# * (`Hash`) A service account key as a Hash
|
|
1079
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
1080
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
1081
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
1082
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
1083
|
+
# * (`nil`) indicating no credentials
|
|
1084
|
+
#
|
|
1085
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
1086
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
1087
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
1088
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
1089
|
+
# For more information, refer to [Validate credential configurations from external
|
|
1090
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
1091
|
+
# @return [::Object]
|
|
1092
|
+
# @!attribute [rw] scope
|
|
1093
|
+
# The OAuth scopes
|
|
1094
|
+
# @return [::Array<::String>]
|
|
1095
|
+
# @!attribute [rw] lib_name
|
|
1096
|
+
# The library name as recorded in instrumentation and logging
|
|
1097
|
+
# @return [::String]
|
|
1098
|
+
# @!attribute [rw] lib_version
|
|
1099
|
+
# The library version as recorded in instrumentation and logging
|
|
1100
|
+
# @return [::String]
|
|
1101
|
+
# @!attribute [rw] timeout
|
|
1102
|
+
# The call timeout in seconds.
|
|
1103
|
+
# @return [::Numeric]
|
|
1104
|
+
# @!attribute [rw] metadata
|
|
1105
|
+
# Additional headers to be sent with the call.
|
|
1106
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
1107
|
+
# @!attribute [rw] retry_policy
|
|
1108
|
+
# The retry policy. The value is a hash with the following keys:
|
|
1109
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1110
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1111
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1112
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1113
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1114
|
+
# trigger a retry.
|
|
1115
|
+
# @return [::Hash]
|
|
1116
|
+
# @!attribute [rw] quota_project
|
|
1117
|
+
# A separate project against which to charge quota.
|
|
1118
|
+
# @return [::String]
|
|
1119
|
+
# @!attribute [rw] universe_domain
|
|
1120
|
+
# The universe domain within which to make requests. This determines the
|
|
1121
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
1122
|
+
# universe (usually the default "googleapis.com" universe).
|
|
1123
|
+
# @return [::String,nil]
|
|
1124
|
+
# @!attribute [rw] logger
|
|
1125
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
1126
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
1127
|
+
# explicitly disable logging.
|
|
1128
|
+
# @return [::Logger,:default,nil]
|
|
1129
|
+
#
|
|
1130
|
+
class Configuration
|
|
1131
|
+
extend ::Gapic::Config
|
|
1132
|
+
|
|
1133
|
+
# @private
|
|
1134
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
1135
|
+
DEFAULT_ENDPOINT = "pubsub.googleapis.com"
|
|
1136
|
+
|
|
1137
|
+
config_attr :endpoint, nil, ::String, nil
|
|
1138
|
+
config_attr :credentials, nil do |value|
|
|
1139
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
1140
|
+
allowed.any? { |klass| klass === value }
|
|
1141
|
+
end
|
|
1142
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
1143
|
+
config_attr :lib_name, nil, ::String, nil
|
|
1144
|
+
config_attr :lib_version, nil, ::String, nil
|
|
1145
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
1146
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
1147
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
1148
|
+
config_attr :quota_project, nil, ::String, nil
|
|
1149
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
1150
|
+
|
|
1151
|
+
# @private
|
|
1152
|
+
# Overrides for http bindings for the RPCs of this service
|
|
1153
|
+
# are only used when this service is used as mixin, and only
|
|
1154
|
+
# by the host service.
|
|
1155
|
+
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
|
1156
|
+
config_attr :bindings_override, {}, ::Hash, nil
|
|
1157
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
1158
|
+
|
|
1159
|
+
# @private
|
|
1160
|
+
def initialize parent_config = nil
|
|
1161
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
1162
|
+
|
|
1163
|
+
yield self if block_given?
|
|
1164
|
+
end
|
|
1165
|
+
|
|
1166
|
+
##
|
|
1167
|
+
# Configurations for individual RPCs
|
|
1168
|
+
# @return [Rpcs]
|
|
1169
|
+
#
|
|
1170
|
+
def rpcs
|
|
1171
|
+
@rpcs ||= begin
|
|
1172
|
+
parent_rpcs = nil
|
|
1173
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
1174
|
+
Rpcs.new parent_rpcs
|
|
1175
|
+
end
|
|
1176
|
+
end
|
|
1177
|
+
|
|
1178
|
+
##
|
|
1179
|
+
# Configuration RPC class for the TopicAdmin API.
|
|
1180
|
+
#
|
|
1181
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
1182
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
1183
|
+
# the following configuration fields:
|
|
1184
|
+
#
|
|
1185
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
1186
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
1187
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
1188
|
+
# include the following keys:
|
|
1189
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1190
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1191
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1192
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1193
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1194
|
+
# trigger a retry.
|
|
1195
|
+
#
|
|
1196
|
+
class Rpcs
|
|
1197
|
+
##
|
|
1198
|
+
# RPC-specific configuration for `create_topic`
|
|
1199
|
+
# @return [::Gapic::Config::Method]
|
|
1200
|
+
#
|
|
1201
|
+
attr_reader :create_topic
|
|
1202
|
+
##
|
|
1203
|
+
# RPC-specific configuration for `update_topic`
|
|
1204
|
+
# @return [::Gapic::Config::Method]
|
|
1205
|
+
#
|
|
1206
|
+
attr_reader :update_topic
|
|
1207
|
+
##
|
|
1208
|
+
# RPC-specific configuration for `publish`
|
|
1209
|
+
# @return [::Gapic::Config::Method]
|
|
1210
|
+
#
|
|
1211
|
+
attr_reader :publish
|
|
1212
|
+
##
|
|
1213
|
+
# RPC-specific configuration for `get_topic`
|
|
1214
|
+
# @return [::Gapic::Config::Method]
|
|
1215
|
+
#
|
|
1216
|
+
attr_reader :get_topic
|
|
1217
|
+
##
|
|
1218
|
+
# RPC-specific configuration for `list_topics`
|
|
1219
|
+
# @return [::Gapic::Config::Method]
|
|
1220
|
+
#
|
|
1221
|
+
attr_reader :list_topics
|
|
1222
|
+
##
|
|
1223
|
+
# RPC-specific configuration for `list_topic_subscriptions`
|
|
1224
|
+
# @return [::Gapic::Config::Method]
|
|
1225
|
+
#
|
|
1226
|
+
attr_reader :list_topic_subscriptions
|
|
1227
|
+
##
|
|
1228
|
+
# RPC-specific configuration for `list_topic_snapshots`
|
|
1229
|
+
# @return [::Gapic::Config::Method]
|
|
1230
|
+
#
|
|
1231
|
+
attr_reader :list_topic_snapshots
|
|
1232
|
+
##
|
|
1233
|
+
# RPC-specific configuration for `delete_topic`
|
|
1234
|
+
# @return [::Gapic::Config::Method]
|
|
1235
|
+
#
|
|
1236
|
+
attr_reader :delete_topic
|
|
1237
|
+
##
|
|
1238
|
+
# RPC-specific configuration for `detach_subscription`
|
|
1239
|
+
# @return [::Gapic::Config::Method]
|
|
1240
|
+
#
|
|
1241
|
+
attr_reader :detach_subscription
|
|
1242
|
+
|
|
1243
|
+
# @private
|
|
1244
|
+
def initialize parent_rpcs = nil
|
|
1245
|
+
create_topic_config = parent_rpcs.create_topic if parent_rpcs.respond_to? :create_topic
|
|
1246
|
+
@create_topic = ::Gapic::Config::Method.new create_topic_config
|
|
1247
|
+
update_topic_config = parent_rpcs.update_topic if parent_rpcs.respond_to? :update_topic
|
|
1248
|
+
@update_topic = ::Gapic::Config::Method.new update_topic_config
|
|
1249
|
+
publish_config = parent_rpcs.publish if parent_rpcs.respond_to? :publish
|
|
1250
|
+
@publish = ::Gapic::Config::Method.new publish_config
|
|
1251
|
+
get_topic_config = parent_rpcs.get_topic if parent_rpcs.respond_to? :get_topic
|
|
1252
|
+
@get_topic = ::Gapic::Config::Method.new get_topic_config
|
|
1253
|
+
list_topics_config = parent_rpcs.list_topics if parent_rpcs.respond_to? :list_topics
|
|
1254
|
+
@list_topics = ::Gapic::Config::Method.new list_topics_config
|
|
1255
|
+
list_topic_subscriptions_config = parent_rpcs.list_topic_subscriptions if parent_rpcs.respond_to? :list_topic_subscriptions
|
|
1256
|
+
@list_topic_subscriptions = ::Gapic::Config::Method.new list_topic_subscriptions_config
|
|
1257
|
+
list_topic_snapshots_config = parent_rpcs.list_topic_snapshots if parent_rpcs.respond_to? :list_topic_snapshots
|
|
1258
|
+
@list_topic_snapshots = ::Gapic::Config::Method.new list_topic_snapshots_config
|
|
1259
|
+
delete_topic_config = parent_rpcs.delete_topic if parent_rpcs.respond_to? :delete_topic
|
|
1260
|
+
@delete_topic = ::Gapic::Config::Method.new delete_topic_config
|
|
1261
|
+
detach_subscription_config = parent_rpcs.detach_subscription if parent_rpcs.respond_to? :detach_subscription
|
|
1262
|
+
@detach_subscription = ::Gapic::Config::Method.new detach_subscription_config
|
|
1263
|
+
|
|
1264
|
+
yield self if block_given?
|
|
1265
|
+
end
|
|
1266
|
+
end
|
|
1267
|
+
end
|
|
1268
|
+
end
|
|
1269
|
+
end
|
|
1270
|
+
end
|
|
1271
|
+
end
|
|
1272
|
+
end
|
|
1273
|
+
end
|
|
1274
|
+
end
|