google-apps-events-subscriptions-v1 0.a → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/apps/events/subscriptions/v1/rest.rb +39 -0
- data/lib/google/apps/events/subscriptions/v1/subscription_resource_pb.rb +57 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/client.rb +1029 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/credentials.rb +59 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/operations.rb +803 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/paths.rb +80 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/rest/client.rb +977 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/rest/operations.rb +897 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/rest/service_stub.rb +424 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service/rest.rb +55 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service.rb +58 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service_pb.rb +65 -0
- data/lib/google/apps/events/subscriptions/v1/subscriptions_service_services_pb.rb +73 -0
- data/lib/google/apps/events/subscriptions/v1/version.rb +7 -2
- data/lib/google/apps/events/subscriptions/v1.rb +47 -0
- data/lib/google-apps-events-subscriptions-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +399 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/apps/events/subscriptions/v1/subscription_resource.rb +224 -0
- data/proto_docs/google/apps/events/subscriptions/v1/subscriptions_service.rb +211 -0
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- metadata +77 -11
@@ -0,0 +1,1029 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/apps/events/subscriptions/v1/subscriptions_service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Apps
|
24
|
+
module Events
|
25
|
+
module Subscriptions
|
26
|
+
module V1
|
27
|
+
module SubscriptionsService
|
28
|
+
##
|
29
|
+
# Client for the SubscriptionsService service.
|
30
|
+
#
|
31
|
+
# A service that manages subscriptions to Google Workspace events.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
DEFAULT_ENDPOINT_TEMPLATE = "workspaceevents.$UNIVERSE_DOMAIN$"
|
36
|
+
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :subscriptions_service_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the SubscriptionsService Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all SubscriptionsService clients
|
51
|
+
# ::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Apps", "Events", "Subscriptions", "V1"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.rpcs.create_subscription.timeout = 60.0
|
72
|
+
|
73
|
+
default_config.rpcs.delete_subscription.timeout = 60.0
|
74
|
+
|
75
|
+
default_config.rpcs.get_subscription.timeout = 60.0
|
76
|
+
default_config.rpcs.get_subscription.retry_policy = {
|
77
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
78
|
+
}
|
79
|
+
|
80
|
+
default_config.rpcs.list_subscriptions.timeout = 60.0
|
81
|
+
default_config.rpcs.list_subscriptions.retry_policy = {
|
82
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config.rpcs.update_subscription.timeout = 60.0
|
86
|
+
|
87
|
+
default_config.rpcs.reactivate_subscription.timeout = 60.0
|
88
|
+
|
89
|
+
default_config
|
90
|
+
end
|
91
|
+
yield @configure if block_given?
|
92
|
+
@configure
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Configure the SubscriptionsService Client instance.
|
97
|
+
#
|
98
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
99
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
100
|
+
# should be made on {Client.configure}.
|
101
|
+
#
|
102
|
+
# See {::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client::Configuration}
|
103
|
+
# for a description of the configuration fields.
|
104
|
+
#
|
105
|
+
# @yield [config] Configure the Client client.
|
106
|
+
# @yieldparam config [Client::Configuration]
|
107
|
+
#
|
108
|
+
# @return [Client::Configuration]
|
109
|
+
#
|
110
|
+
def configure
|
111
|
+
yield @config if block_given?
|
112
|
+
@config
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# The effective universe domain
|
117
|
+
#
|
118
|
+
# @return [String]
|
119
|
+
#
|
120
|
+
def universe_domain
|
121
|
+
@subscriptions_service_stub.universe_domain
|
122
|
+
end
|
123
|
+
|
124
|
+
##
|
125
|
+
# Create a new SubscriptionsService client object.
|
126
|
+
#
|
127
|
+
# @example
|
128
|
+
#
|
129
|
+
# # Create a client using the default configuration
|
130
|
+
# client = ::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new
|
131
|
+
#
|
132
|
+
# # Create a client using a custom configuration
|
133
|
+
# client = ::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new do |config|
|
134
|
+
# config.timeout = 10.0
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# @yield [config] Configure the SubscriptionsService client.
|
138
|
+
# @yieldparam config [Client::Configuration]
|
139
|
+
#
|
140
|
+
def initialize
|
141
|
+
# These require statements are intentionally placed here to initialize
|
142
|
+
# the gRPC module only when it's required.
|
143
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
144
|
+
require "gapic/grpc"
|
145
|
+
require "google/apps/events/subscriptions/v1/subscriptions_service_services_pb"
|
146
|
+
|
147
|
+
# Create the configuration object
|
148
|
+
@config = Configuration.new Client.configure
|
149
|
+
|
150
|
+
# Yield the configuration if needed
|
151
|
+
yield @config if block_given?
|
152
|
+
|
153
|
+
# Create credentials
|
154
|
+
credentials = @config.credentials
|
155
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
156
|
+
# but only if the default endpoint does not have a region prefix.
|
157
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
158
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
159
|
+
!@config.endpoint.split(".").first.include?("-"))
|
160
|
+
credentials ||= Credentials.default scope: @config.scope,
|
161
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
162
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
163
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
164
|
+
end
|
165
|
+
@quota_project_id = @config.quota_project
|
166
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
167
|
+
|
168
|
+
@operations_client = Operations.new do |config|
|
169
|
+
config.credentials = credentials
|
170
|
+
config.quota_project = @quota_project_id
|
171
|
+
config.endpoint = @config.endpoint
|
172
|
+
config.universe_domain = @config.universe_domain
|
173
|
+
end
|
174
|
+
|
175
|
+
@subscriptions_service_stub = ::Gapic::ServiceStub.new(
|
176
|
+
::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Stub,
|
177
|
+
credentials: credentials,
|
178
|
+
endpoint: @config.endpoint,
|
179
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
180
|
+
universe_domain: @config.universe_domain,
|
181
|
+
channel_args: @config.channel_args,
|
182
|
+
interceptors: @config.interceptors,
|
183
|
+
channel_pool_config: @config.channel_pool
|
184
|
+
)
|
185
|
+
end
|
186
|
+
|
187
|
+
##
|
188
|
+
# Get the associated client for long-running operations.
|
189
|
+
#
|
190
|
+
# @return [::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Operations]
|
191
|
+
#
|
192
|
+
attr_reader :operations_client
|
193
|
+
|
194
|
+
# Service calls
|
195
|
+
|
196
|
+
##
|
197
|
+
# Creates a Google Workspace subscription. To learn how to use this
|
198
|
+
# method, see [Create a Google Workspace
|
199
|
+
# subscription](https://developers.google.com/workspace/events/guides/create-subscription).
|
200
|
+
#
|
201
|
+
# @overload create_subscription(request, options = nil)
|
202
|
+
# Pass arguments to `create_subscription` via a request object, either of type
|
203
|
+
# {::Google::Apps::Events::Subscriptions::V1::CreateSubscriptionRequest} or an equivalent Hash.
|
204
|
+
#
|
205
|
+
# @param request [::Google::Apps::Events::Subscriptions::V1::CreateSubscriptionRequest, ::Hash]
|
206
|
+
# A request object representing the call parameters. Required. To specify no
|
207
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
208
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
209
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
210
|
+
#
|
211
|
+
# @overload create_subscription(subscription: nil, validate_only: nil)
|
212
|
+
# Pass arguments to `create_subscription` via keyword arguments. Note that at
|
213
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
214
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
215
|
+
#
|
216
|
+
# @param subscription [::Google::Apps::Events::Subscriptions::V1::Subscription, ::Hash]
|
217
|
+
# Required. The subscription resource to create.
|
218
|
+
# @param validate_only [::Boolean]
|
219
|
+
# Optional. If set to `true`, validates and previews the request, but doesn't
|
220
|
+
# create the subscription.
|
221
|
+
#
|
222
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
223
|
+
# @yieldparam response [::Gapic::Operation]
|
224
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
225
|
+
#
|
226
|
+
# @return [::Gapic::Operation]
|
227
|
+
#
|
228
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
229
|
+
#
|
230
|
+
# @example Basic example
|
231
|
+
# require "google/apps/events/subscriptions/v1"
|
232
|
+
#
|
233
|
+
# # Create a client object. The client can be reused for multiple calls.
|
234
|
+
# client = Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new
|
235
|
+
#
|
236
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
237
|
+
# request = Google::Apps::Events::Subscriptions::V1::CreateSubscriptionRequest.new
|
238
|
+
#
|
239
|
+
# # Call the create_subscription method.
|
240
|
+
# result = client.create_subscription request
|
241
|
+
#
|
242
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
243
|
+
# # check the status of an operation, cancel it, or wait for results.
|
244
|
+
# # Here is how to wait for a response.
|
245
|
+
# result.wait_until_done! timeout: 60
|
246
|
+
# if result.response?
|
247
|
+
# p result.response
|
248
|
+
# else
|
249
|
+
# puts "No response received."
|
250
|
+
# end
|
251
|
+
#
|
252
|
+
def create_subscription request, options = nil
|
253
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
254
|
+
|
255
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Events::Subscriptions::V1::CreateSubscriptionRequest
|
256
|
+
|
257
|
+
# Converts hash and nil to an options object
|
258
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
259
|
+
|
260
|
+
# Customize the options with defaults
|
261
|
+
metadata = @config.rpcs.create_subscription.metadata.to_h
|
262
|
+
|
263
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
264
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
265
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
266
|
+
gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
|
267
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
268
|
+
|
269
|
+
options.apply_defaults timeout: @config.rpcs.create_subscription.timeout,
|
270
|
+
metadata: metadata,
|
271
|
+
retry_policy: @config.rpcs.create_subscription.retry_policy
|
272
|
+
|
273
|
+
options.apply_defaults timeout: @config.timeout,
|
274
|
+
metadata: @config.metadata,
|
275
|
+
retry_policy: @config.retry_policy
|
276
|
+
|
277
|
+
@subscriptions_service_stub.call_rpc :create_subscription, request, options: options do |response, operation|
|
278
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
279
|
+
yield response, operation if block_given?
|
280
|
+
return response
|
281
|
+
end
|
282
|
+
rescue ::GRPC::BadStatus => e
|
283
|
+
raise ::Google::Cloud::Error.from_error(e)
|
284
|
+
end
|
285
|
+
|
286
|
+
##
|
287
|
+
# Deletes a Google Workspace subscription.
|
288
|
+
# To learn how to use this method, see [Delete a Google Workspace
|
289
|
+
# subscription](https://developers.google.com/workspace/events/guides/delete-subscription).
|
290
|
+
#
|
291
|
+
# @overload delete_subscription(request, options = nil)
|
292
|
+
# Pass arguments to `delete_subscription` via a request object, either of type
|
293
|
+
# {::Google::Apps::Events::Subscriptions::V1::DeleteSubscriptionRequest} or an equivalent Hash.
|
294
|
+
#
|
295
|
+
# @param request [::Google::Apps::Events::Subscriptions::V1::DeleteSubscriptionRequest, ::Hash]
|
296
|
+
# A request object representing the call parameters. Required. To specify no
|
297
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
298
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
299
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
300
|
+
#
|
301
|
+
# @overload delete_subscription(name: nil, validate_only: nil, allow_missing: nil, etag: nil)
|
302
|
+
# Pass arguments to `delete_subscription` via keyword arguments. Note that at
|
303
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
304
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
305
|
+
#
|
306
|
+
# @param name [::String]
|
307
|
+
# Required. Resource name of the subscription to delete.
|
308
|
+
#
|
309
|
+
# Format: `subscriptions/{subscription}`
|
310
|
+
# @param validate_only [::Boolean]
|
311
|
+
# Optional. If set to `true`, validates and previews the request, but doesn't
|
312
|
+
# delete the subscription.
|
313
|
+
# @param allow_missing [::Boolean]
|
314
|
+
# Optional. If set to `true` and the subscription isn't found, the request
|
315
|
+
# succeeds but doesn't delete the subscription.
|
316
|
+
# @param etag [::String]
|
317
|
+
# Optional. Etag of the subscription.
|
318
|
+
#
|
319
|
+
# If present, it must match with the server's etag. Otherwise, request
|
320
|
+
# fails with the status `ABORTED`.
|
321
|
+
#
|
322
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
323
|
+
# @yieldparam response [::Gapic::Operation]
|
324
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
325
|
+
#
|
326
|
+
# @return [::Gapic::Operation]
|
327
|
+
#
|
328
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
329
|
+
#
|
330
|
+
# @example Basic example
|
331
|
+
# require "google/apps/events/subscriptions/v1"
|
332
|
+
#
|
333
|
+
# # Create a client object. The client can be reused for multiple calls.
|
334
|
+
# client = Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new
|
335
|
+
#
|
336
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
337
|
+
# request = Google::Apps::Events::Subscriptions::V1::DeleteSubscriptionRequest.new
|
338
|
+
#
|
339
|
+
# # Call the delete_subscription method.
|
340
|
+
# result = client.delete_subscription request
|
341
|
+
#
|
342
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
343
|
+
# # check the status of an operation, cancel it, or wait for results.
|
344
|
+
# # Here is how to wait for a response.
|
345
|
+
# result.wait_until_done! timeout: 60
|
346
|
+
# if result.response?
|
347
|
+
# p result.response
|
348
|
+
# else
|
349
|
+
# puts "No response received."
|
350
|
+
# end
|
351
|
+
#
|
352
|
+
def delete_subscription request, options = nil
|
353
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
354
|
+
|
355
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Events::Subscriptions::V1::DeleteSubscriptionRequest
|
356
|
+
|
357
|
+
# Converts hash and nil to an options object
|
358
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
359
|
+
|
360
|
+
# Customize the options with defaults
|
361
|
+
metadata = @config.rpcs.delete_subscription.metadata.to_h
|
362
|
+
|
363
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
364
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
365
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
366
|
+
gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
|
367
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
368
|
+
|
369
|
+
header_params = {}
|
370
|
+
if request.name
|
371
|
+
header_params["name"] = request.name
|
372
|
+
end
|
373
|
+
|
374
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
375
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
376
|
+
|
377
|
+
options.apply_defaults timeout: @config.rpcs.delete_subscription.timeout,
|
378
|
+
metadata: metadata,
|
379
|
+
retry_policy: @config.rpcs.delete_subscription.retry_policy
|
380
|
+
|
381
|
+
options.apply_defaults timeout: @config.timeout,
|
382
|
+
metadata: @config.metadata,
|
383
|
+
retry_policy: @config.retry_policy
|
384
|
+
|
385
|
+
@subscriptions_service_stub.call_rpc :delete_subscription, request, options: options do |response, operation|
|
386
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
387
|
+
yield response, operation if block_given?
|
388
|
+
return response
|
389
|
+
end
|
390
|
+
rescue ::GRPC::BadStatus => e
|
391
|
+
raise ::Google::Cloud::Error.from_error(e)
|
392
|
+
end
|
393
|
+
|
394
|
+
##
|
395
|
+
# Gets details about a Google Workspace subscription. To learn how to use
|
396
|
+
# this method, see [Get details about a Google Workspace
|
397
|
+
# subscription](https://developers.google.com/workspace/events/guides/get-subscription).
|
398
|
+
#
|
399
|
+
# @overload get_subscription(request, options = nil)
|
400
|
+
# Pass arguments to `get_subscription` via a request object, either of type
|
401
|
+
# {::Google::Apps::Events::Subscriptions::V1::GetSubscriptionRequest} or an equivalent Hash.
|
402
|
+
#
|
403
|
+
# @param request [::Google::Apps::Events::Subscriptions::V1::GetSubscriptionRequest, ::Hash]
|
404
|
+
# A request object representing the call parameters. Required. To specify no
|
405
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
406
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
407
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
408
|
+
#
|
409
|
+
# @overload get_subscription(name: nil)
|
410
|
+
# Pass arguments to `get_subscription` via keyword arguments. Note that at
|
411
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
412
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
413
|
+
#
|
414
|
+
# @param name [::String]
|
415
|
+
# Required. Resource name of the subscription.
|
416
|
+
#
|
417
|
+
# Format: `subscriptions/{subscription}`
|
418
|
+
#
|
419
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
420
|
+
# @yieldparam response [::Google::Apps::Events::Subscriptions::V1::Subscription]
|
421
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
422
|
+
#
|
423
|
+
# @return [::Google::Apps::Events::Subscriptions::V1::Subscription]
|
424
|
+
#
|
425
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
426
|
+
#
|
427
|
+
# @example Basic example
|
428
|
+
# require "google/apps/events/subscriptions/v1"
|
429
|
+
#
|
430
|
+
# # Create a client object. The client can be reused for multiple calls.
|
431
|
+
# client = Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new
|
432
|
+
#
|
433
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
434
|
+
# request = Google::Apps::Events::Subscriptions::V1::GetSubscriptionRequest.new
|
435
|
+
#
|
436
|
+
# # Call the get_subscription method.
|
437
|
+
# result = client.get_subscription request
|
438
|
+
#
|
439
|
+
# # The returned object is of type Google::Apps::Events::Subscriptions::V1::Subscription.
|
440
|
+
# p result
|
441
|
+
#
|
442
|
+
def get_subscription request, options = nil
|
443
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
444
|
+
|
445
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Events::Subscriptions::V1::GetSubscriptionRequest
|
446
|
+
|
447
|
+
# Converts hash and nil to an options object
|
448
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
449
|
+
|
450
|
+
# Customize the options with defaults
|
451
|
+
metadata = @config.rpcs.get_subscription.metadata.to_h
|
452
|
+
|
453
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
454
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
455
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
456
|
+
gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
|
457
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
458
|
+
|
459
|
+
header_params = {}
|
460
|
+
if request.name
|
461
|
+
header_params["name"] = request.name
|
462
|
+
end
|
463
|
+
|
464
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
465
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
466
|
+
|
467
|
+
options.apply_defaults timeout: @config.rpcs.get_subscription.timeout,
|
468
|
+
metadata: metadata,
|
469
|
+
retry_policy: @config.rpcs.get_subscription.retry_policy
|
470
|
+
|
471
|
+
options.apply_defaults timeout: @config.timeout,
|
472
|
+
metadata: @config.metadata,
|
473
|
+
retry_policy: @config.retry_policy
|
474
|
+
|
475
|
+
@subscriptions_service_stub.call_rpc :get_subscription, request, options: options do |response, operation|
|
476
|
+
yield response, operation if block_given?
|
477
|
+
return response
|
478
|
+
end
|
479
|
+
rescue ::GRPC::BadStatus => e
|
480
|
+
raise ::Google::Cloud::Error.from_error(e)
|
481
|
+
end
|
482
|
+
|
483
|
+
##
|
484
|
+
# Lists Google Workspace subscriptions. To learn how to use this method, see
|
485
|
+
# [List Google Workspace
|
486
|
+
# subscriptions](https://developers.google.com/workspace/events/guides/list-subscriptions).
|
487
|
+
#
|
488
|
+
# @overload list_subscriptions(request, options = nil)
|
489
|
+
# Pass arguments to `list_subscriptions` via a request object, either of type
|
490
|
+
# {::Google::Apps::Events::Subscriptions::V1::ListSubscriptionsRequest} or an equivalent Hash.
|
491
|
+
#
|
492
|
+
# @param request [::Google::Apps::Events::Subscriptions::V1::ListSubscriptionsRequest, ::Hash]
|
493
|
+
# A request object representing the call parameters. Required. To specify no
|
494
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
495
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
496
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
497
|
+
#
|
498
|
+
# @overload list_subscriptions(page_size: nil, page_token: nil, filter: nil)
|
499
|
+
# Pass arguments to `list_subscriptions` via keyword arguments. Note that at
|
500
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
501
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
502
|
+
#
|
503
|
+
# @param page_size [::Integer]
|
504
|
+
# Optional. The maximum number of subscriptions to return. The service might
|
505
|
+
# return fewer than this value.
|
506
|
+
#
|
507
|
+
# If unspecified or set to `0`, up to 50 subscriptions are returned.
|
508
|
+
#
|
509
|
+
# The maximum value is 100. If you specify a value more than 100, the system
|
510
|
+
# only returns 100 subscriptions.
|
511
|
+
# @param page_token [::String]
|
512
|
+
# Optional. A page token, received from a previous list subscriptions call.
|
513
|
+
# Provide this parameter to retrieve the subsequent page.
|
514
|
+
#
|
515
|
+
# When paginating, the filter value should match the call that provided the
|
516
|
+
# page token. Passing a different value might lead to unexpected results.
|
517
|
+
# @param filter [::String]
|
518
|
+
# Required. A query filter.
|
519
|
+
#
|
520
|
+
# You can filter subscriptions by event type (`event_types`)
|
521
|
+
# and target resource (`target_resource`).
|
522
|
+
#
|
523
|
+
# You must specify at least one event type in your query. To filter for
|
524
|
+
# multiple event types, use the `OR` operator.
|
525
|
+
#
|
526
|
+
# To filter by both event type and target resource, use the `AND` operator
|
527
|
+
# and specify the full resource name, such as
|
528
|
+
# `//chat.googleapis.com/spaces/{space}`.
|
529
|
+
#
|
530
|
+
# For example, the following queries are valid:
|
531
|
+
#
|
532
|
+
# ```
|
533
|
+
# event_types:"google.workspace.chat.membership.v1.updated" OR
|
534
|
+
# event_types:"google.workspace.chat.message.v1.created"
|
535
|
+
#
|
536
|
+
# event_types:"google.workspace.chat.message.v1.created" AND
|
537
|
+
# target_resource="//chat.googleapis.com/spaces/\\{space}"
|
538
|
+
#
|
539
|
+
# ( event_types:"google.workspace.chat.membership.v1.updated" OR
|
540
|
+
# event_types:"google.workspace.chat.message.v1.created" ) AND
|
541
|
+
# target_resource="//chat.googleapis.com/spaces/\\{space}"
|
542
|
+
# ```
|
543
|
+
#
|
544
|
+
# The server rejects invalid queries with an `INVALID_ARGUMENT`
|
545
|
+
# error.
|
546
|
+
#
|
547
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
548
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Apps::Events::Subscriptions::V1::Subscription>]
|
549
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
550
|
+
#
|
551
|
+
# @return [::Gapic::PagedEnumerable<::Google::Apps::Events::Subscriptions::V1::Subscription>]
|
552
|
+
#
|
553
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
554
|
+
#
|
555
|
+
# @example Basic example
|
556
|
+
# require "google/apps/events/subscriptions/v1"
|
557
|
+
#
|
558
|
+
# # Create a client object. The client can be reused for multiple calls.
|
559
|
+
# client = Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new
|
560
|
+
#
|
561
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
562
|
+
# request = Google::Apps::Events::Subscriptions::V1::ListSubscriptionsRequest.new
|
563
|
+
#
|
564
|
+
# # Call the list_subscriptions method.
|
565
|
+
# result = client.list_subscriptions request
|
566
|
+
#
|
567
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
568
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
569
|
+
# result.each do |item|
|
570
|
+
# # Each element is of type ::Google::Apps::Events::Subscriptions::V1::Subscription.
|
571
|
+
# p item
|
572
|
+
# end
|
573
|
+
#
|
574
|
+
def list_subscriptions request, options = nil
|
575
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
576
|
+
|
577
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Events::Subscriptions::V1::ListSubscriptionsRequest
|
578
|
+
|
579
|
+
# Converts hash and nil to an options object
|
580
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
581
|
+
|
582
|
+
# Customize the options with defaults
|
583
|
+
metadata = @config.rpcs.list_subscriptions.metadata.to_h
|
584
|
+
|
585
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
586
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
587
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
588
|
+
gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
|
589
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
590
|
+
|
591
|
+
options.apply_defaults timeout: @config.rpcs.list_subscriptions.timeout,
|
592
|
+
metadata: metadata,
|
593
|
+
retry_policy: @config.rpcs.list_subscriptions.retry_policy
|
594
|
+
|
595
|
+
options.apply_defaults timeout: @config.timeout,
|
596
|
+
metadata: @config.metadata,
|
597
|
+
retry_policy: @config.retry_policy
|
598
|
+
|
599
|
+
@subscriptions_service_stub.call_rpc :list_subscriptions, request, options: options do |response, operation|
|
600
|
+
response = ::Gapic::PagedEnumerable.new @subscriptions_service_stub, :list_subscriptions, request, response, operation, options
|
601
|
+
yield response, operation if block_given?
|
602
|
+
return response
|
603
|
+
end
|
604
|
+
rescue ::GRPC::BadStatus => e
|
605
|
+
raise ::Google::Cloud::Error.from_error(e)
|
606
|
+
end
|
607
|
+
|
608
|
+
##
|
609
|
+
# Updates or renews a Google Workspace subscription. To learn how to use this
|
610
|
+
# method, see [Update or renew a Google Workspace
|
611
|
+
# subscription](https://developers.google.com/workspace/events/guides/update-subscription).
|
612
|
+
#
|
613
|
+
# @overload update_subscription(request, options = nil)
|
614
|
+
# Pass arguments to `update_subscription` via a request object, either of type
|
615
|
+
# {::Google::Apps::Events::Subscriptions::V1::UpdateSubscriptionRequest} or an equivalent Hash.
|
616
|
+
#
|
617
|
+
# @param request [::Google::Apps::Events::Subscriptions::V1::UpdateSubscriptionRequest, ::Hash]
|
618
|
+
# A request object representing the call parameters. Required. To specify no
|
619
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
620
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
621
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
622
|
+
#
|
623
|
+
# @overload update_subscription(subscription: nil, update_mask: nil, validate_only: nil)
|
624
|
+
# Pass arguments to `update_subscription` via keyword arguments. Note that at
|
625
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
626
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
627
|
+
#
|
628
|
+
# @param subscription [::Google::Apps::Events::Subscriptions::V1::Subscription, ::Hash]
|
629
|
+
# Required. The subscription to update.
|
630
|
+
#
|
631
|
+
# The subscription's `name` field is used to identify the subscription to
|
632
|
+
# update.
|
633
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
634
|
+
# Optional. Required. The field to update.
|
635
|
+
#
|
636
|
+
# You can update one of the following fields in a subscription:
|
637
|
+
#
|
638
|
+
# * {::Google::Apps::Events::Subscriptions::V1::Subscription#expire_time `expire_time`}: The timestamp when the
|
639
|
+
# subscription expires.
|
640
|
+
# * {::Google::Apps::Events::Subscriptions::V1::Subscription#ttl `ttl`}: The
|
641
|
+
# time-to-live (TTL) or duration of the
|
642
|
+
# subscription.
|
643
|
+
# @param validate_only [::Boolean]
|
644
|
+
# Optional. If set to `true`, validates and previews the request, but doesn't
|
645
|
+
# update the subscription.
|
646
|
+
#
|
647
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
648
|
+
# @yieldparam response [::Gapic::Operation]
|
649
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
650
|
+
#
|
651
|
+
# @return [::Gapic::Operation]
|
652
|
+
#
|
653
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
654
|
+
#
|
655
|
+
# @example Basic example
|
656
|
+
# require "google/apps/events/subscriptions/v1"
|
657
|
+
#
|
658
|
+
# # Create a client object. The client can be reused for multiple calls.
|
659
|
+
# client = Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new
|
660
|
+
#
|
661
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
662
|
+
# request = Google::Apps::Events::Subscriptions::V1::UpdateSubscriptionRequest.new
|
663
|
+
#
|
664
|
+
# # Call the update_subscription method.
|
665
|
+
# result = client.update_subscription request
|
666
|
+
#
|
667
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
668
|
+
# # check the status of an operation, cancel it, or wait for results.
|
669
|
+
# # Here is how to wait for a response.
|
670
|
+
# result.wait_until_done! timeout: 60
|
671
|
+
# if result.response?
|
672
|
+
# p result.response
|
673
|
+
# else
|
674
|
+
# puts "No response received."
|
675
|
+
# end
|
676
|
+
#
|
677
|
+
def update_subscription request, options = nil
|
678
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
679
|
+
|
680
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Events::Subscriptions::V1::UpdateSubscriptionRequest
|
681
|
+
|
682
|
+
# Converts hash and nil to an options object
|
683
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
684
|
+
|
685
|
+
# Customize the options with defaults
|
686
|
+
metadata = @config.rpcs.update_subscription.metadata.to_h
|
687
|
+
|
688
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
689
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
690
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
691
|
+
gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
|
692
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
693
|
+
|
694
|
+
header_params = {}
|
695
|
+
if request.subscription&.name
|
696
|
+
header_params["subscription.name"] = request.subscription.name
|
697
|
+
end
|
698
|
+
|
699
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
700
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
701
|
+
|
702
|
+
options.apply_defaults timeout: @config.rpcs.update_subscription.timeout,
|
703
|
+
metadata: metadata,
|
704
|
+
retry_policy: @config.rpcs.update_subscription.retry_policy
|
705
|
+
|
706
|
+
options.apply_defaults timeout: @config.timeout,
|
707
|
+
metadata: @config.metadata,
|
708
|
+
retry_policy: @config.retry_policy
|
709
|
+
|
710
|
+
@subscriptions_service_stub.call_rpc :update_subscription, request, options: options do |response, operation|
|
711
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
712
|
+
yield response, operation if block_given?
|
713
|
+
return response
|
714
|
+
end
|
715
|
+
rescue ::GRPC::BadStatus => e
|
716
|
+
raise ::Google::Cloud::Error.from_error(e)
|
717
|
+
end
|
718
|
+
|
719
|
+
##
|
720
|
+
# Reactivates a suspended Google Workspace subscription.
|
721
|
+
#
|
722
|
+
# This method resets your subscription's `State` field to `ACTIVE`. Before
|
723
|
+
# you use this method, you must fix the error that suspended the
|
724
|
+
# subscription. To learn how to use this method, see [Reactivate a Google
|
725
|
+
# Workspace
|
726
|
+
# subscription](https://developers.google.com/workspace/events/guides/reactivate-subscription).
|
727
|
+
#
|
728
|
+
# @overload reactivate_subscription(request, options = nil)
|
729
|
+
# Pass arguments to `reactivate_subscription` via a request object, either of type
|
730
|
+
# {::Google::Apps::Events::Subscriptions::V1::ReactivateSubscriptionRequest} or an equivalent Hash.
|
731
|
+
#
|
732
|
+
# @param request [::Google::Apps::Events::Subscriptions::V1::ReactivateSubscriptionRequest, ::Hash]
|
733
|
+
# A request object representing the call parameters. Required. To specify no
|
734
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
735
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
736
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
737
|
+
#
|
738
|
+
# @overload reactivate_subscription(name: nil)
|
739
|
+
# Pass arguments to `reactivate_subscription` via keyword arguments. Note that at
|
740
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
741
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
742
|
+
#
|
743
|
+
# @param name [::String]
|
744
|
+
# Required. Resource name of the subscription.
|
745
|
+
#
|
746
|
+
# Format: `subscriptions/{subscription}`
|
747
|
+
#
|
748
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
749
|
+
# @yieldparam response [::Gapic::Operation]
|
750
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
751
|
+
#
|
752
|
+
# @return [::Gapic::Operation]
|
753
|
+
#
|
754
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
755
|
+
#
|
756
|
+
# @example Basic example
|
757
|
+
# require "google/apps/events/subscriptions/v1"
|
758
|
+
#
|
759
|
+
# # Create a client object. The client can be reused for multiple calls.
|
760
|
+
# client = Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new
|
761
|
+
#
|
762
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
763
|
+
# request = Google::Apps::Events::Subscriptions::V1::ReactivateSubscriptionRequest.new
|
764
|
+
#
|
765
|
+
# # Call the reactivate_subscription method.
|
766
|
+
# result = client.reactivate_subscription request
|
767
|
+
#
|
768
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
769
|
+
# # check the status of an operation, cancel it, or wait for results.
|
770
|
+
# # Here is how to wait for a response.
|
771
|
+
# result.wait_until_done! timeout: 60
|
772
|
+
# if result.response?
|
773
|
+
# p result.response
|
774
|
+
# else
|
775
|
+
# puts "No response received."
|
776
|
+
# end
|
777
|
+
#
|
778
|
+
def reactivate_subscription request, options = nil
|
779
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
780
|
+
|
781
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Apps::Events::Subscriptions::V1::ReactivateSubscriptionRequest
|
782
|
+
|
783
|
+
# Converts hash and nil to an options object
|
784
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
785
|
+
|
786
|
+
# Customize the options with defaults
|
787
|
+
metadata = @config.rpcs.reactivate_subscription.metadata.to_h
|
788
|
+
|
789
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
790
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
791
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
792
|
+
gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
|
793
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
794
|
+
|
795
|
+
header_params = {}
|
796
|
+
if request.name
|
797
|
+
header_params["name"] = request.name
|
798
|
+
end
|
799
|
+
|
800
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
801
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
802
|
+
|
803
|
+
options.apply_defaults timeout: @config.rpcs.reactivate_subscription.timeout,
|
804
|
+
metadata: metadata,
|
805
|
+
retry_policy: @config.rpcs.reactivate_subscription.retry_policy
|
806
|
+
|
807
|
+
options.apply_defaults timeout: @config.timeout,
|
808
|
+
metadata: @config.metadata,
|
809
|
+
retry_policy: @config.retry_policy
|
810
|
+
|
811
|
+
@subscriptions_service_stub.call_rpc :reactivate_subscription, request, options: options do |response, operation|
|
812
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
813
|
+
yield response, operation if block_given?
|
814
|
+
return response
|
815
|
+
end
|
816
|
+
rescue ::GRPC::BadStatus => e
|
817
|
+
raise ::Google::Cloud::Error.from_error(e)
|
818
|
+
end
|
819
|
+
|
820
|
+
##
|
821
|
+
# Configuration class for the SubscriptionsService API.
|
822
|
+
#
|
823
|
+
# This class represents the configuration for SubscriptionsService,
|
824
|
+
# providing control over timeouts, retry behavior, logging, transport
|
825
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
826
|
+
# applied individually to specific RPCs. See
|
827
|
+
# {::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client::Configuration::Rpcs}
|
828
|
+
# for a list of RPCs that can be configured independently.
|
829
|
+
#
|
830
|
+
# Configuration can be applied globally to all clients, or to a single client
|
831
|
+
# on construction.
|
832
|
+
#
|
833
|
+
# @example
|
834
|
+
#
|
835
|
+
# # Modify the global config, setting the timeout for
|
836
|
+
# # create_subscription to 20 seconds,
|
837
|
+
# # and all remaining timeouts to 10 seconds.
|
838
|
+
# ::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.configure do |config|
|
839
|
+
# config.timeout = 10.0
|
840
|
+
# config.rpcs.create_subscription.timeout = 20.0
|
841
|
+
# end
|
842
|
+
#
|
843
|
+
# # Apply the above configuration only to a new client.
|
844
|
+
# client = ::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new do |config|
|
845
|
+
# config.timeout = 10.0
|
846
|
+
# config.rpcs.create_subscription.timeout = 20.0
|
847
|
+
# end
|
848
|
+
#
|
849
|
+
# @!attribute [rw] endpoint
|
850
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
851
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
852
|
+
# @return [::String,nil]
|
853
|
+
# @!attribute [rw] credentials
|
854
|
+
# Credentials to send with calls. You may provide any of the following types:
|
855
|
+
# * (`String`) The path to a service account key file in JSON format
|
856
|
+
# * (`Hash`) A service account key as a Hash
|
857
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
858
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
859
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
860
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
861
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
862
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
863
|
+
# * (`nil`) indicating no credentials
|
864
|
+
# @return [::Object]
|
865
|
+
# @!attribute [rw] scope
|
866
|
+
# The OAuth scopes
|
867
|
+
# @return [::Array<::String>]
|
868
|
+
# @!attribute [rw] lib_name
|
869
|
+
# The library name as recorded in instrumentation and logging
|
870
|
+
# @return [::String]
|
871
|
+
# @!attribute [rw] lib_version
|
872
|
+
# The library version as recorded in instrumentation and logging
|
873
|
+
# @return [::String]
|
874
|
+
# @!attribute [rw] channel_args
|
875
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
876
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
877
|
+
# @return [::Hash]
|
878
|
+
# @!attribute [rw] interceptors
|
879
|
+
# An array of interceptors that are run before calls are executed.
|
880
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
881
|
+
# @!attribute [rw] timeout
|
882
|
+
# The call timeout in seconds.
|
883
|
+
# @return [::Numeric]
|
884
|
+
# @!attribute [rw] metadata
|
885
|
+
# Additional gRPC headers to be sent with the call.
|
886
|
+
# @return [::Hash{::Symbol=>::String}]
|
887
|
+
# @!attribute [rw] retry_policy
|
888
|
+
# The retry policy. The value is a hash with the following keys:
|
889
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
890
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
891
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
892
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
893
|
+
# trigger a retry.
|
894
|
+
# @return [::Hash]
|
895
|
+
# @!attribute [rw] quota_project
|
896
|
+
# A separate project against which to charge quota.
|
897
|
+
# @return [::String]
|
898
|
+
# @!attribute [rw] universe_domain
|
899
|
+
# The universe domain within which to make requests. This determines the
|
900
|
+
# default endpoint URL. The default value of nil uses the environment
|
901
|
+
# universe (usually the default "googleapis.com" universe).
|
902
|
+
# @return [::String,nil]
|
903
|
+
#
|
904
|
+
class Configuration
|
905
|
+
extend ::Gapic::Config
|
906
|
+
|
907
|
+
# @private
|
908
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
909
|
+
DEFAULT_ENDPOINT = "workspaceevents.googleapis.com"
|
910
|
+
|
911
|
+
config_attr :endpoint, nil, ::String, nil
|
912
|
+
config_attr :credentials, nil do |value|
|
913
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
914
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
915
|
+
allowed.any? { |klass| klass === value }
|
916
|
+
end
|
917
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
918
|
+
config_attr :lib_name, nil, ::String, nil
|
919
|
+
config_attr :lib_version, nil, ::String, nil
|
920
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
921
|
+
config_attr :interceptors, nil, ::Array, nil
|
922
|
+
config_attr :timeout, nil, ::Numeric, nil
|
923
|
+
config_attr :metadata, nil, ::Hash, nil
|
924
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
925
|
+
config_attr :quota_project, nil, ::String, nil
|
926
|
+
config_attr :universe_domain, nil, ::String, nil
|
927
|
+
|
928
|
+
# @private
|
929
|
+
def initialize parent_config = nil
|
930
|
+
@parent_config = parent_config unless parent_config.nil?
|
931
|
+
|
932
|
+
yield self if block_given?
|
933
|
+
end
|
934
|
+
|
935
|
+
##
|
936
|
+
# Configurations for individual RPCs
|
937
|
+
# @return [Rpcs]
|
938
|
+
#
|
939
|
+
def rpcs
|
940
|
+
@rpcs ||= begin
|
941
|
+
parent_rpcs = nil
|
942
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
943
|
+
Rpcs.new parent_rpcs
|
944
|
+
end
|
945
|
+
end
|
946
|
+
|
947
|
+
##
|
948
|
+
# Configuration for the channel pool
|
949
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
950
|
+
#
|
951
|
+
def channel_pool
|
952
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
953
|
+
end
|
954
|
+
|
955
|
+
##
|
956
|
+
# Configuration RPC class for the SubscriptionsService API.
|
957
|
+
#
|
958
|
+
# Includes fields providing the configuration for each RPC in this service.
|
959
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
960
|
+
# the following configuration fields:
|
961
|
+
#
|
962
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
963
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
964
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
965
|
+
# include the following keys:
|
966
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
967
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
968
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
969
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
970
|
+
# trigger a retry.
|
971
|
+
#
|
972
|
+
class Rpcs
|
973
|
+
##
|
974
|
+
# RPC-specific configuration for `create_subscription`
|
975
|
+
# @return [::Gapic::Config::Method]
|
976
|
+
#
|
977
|
+
attr_reader :create_subscription
|
978
|
+
##
|
979
|
+
# RPC-specific configuration for `delete_subscription`
|
980
|
+
# @return [::Gapic::Config::Method]
|
981
|
+
#
|
982
|
+
attr_reader :delete_subscription
|
983
|
+
##
|
984
|
+
# RPC-specific configuration for `get_subscription`
|
985
|
+
# @return [::Gapic::Config::Method]
|
986
|
+
#
|
987
|
+
attr_reader :get_subscription
|
988
|
+
##
|
989
|
+
# RPC-specific configuration for `list_subscriptions`
|
990
|
+
# @return [::Gapic::Config::Method]
|
991
|
+
#
|
992
|
+
attr_reader :list_subscriptions
|
993
|
+
##
|
994
|
+
# RPC-specific configuration for `update_subscription`
|
995
|
+
# @return [::Gapic::Config::Method]
|
996
|
+
#
|
997
|
+
attr_reader :update_subscription
|
998
|
+
##
|
999
|
+
# RPC-specific configuration for `reactivate_subscription`
|
1000
|
+
# @return [::Gapic::Config::Method]
|
1001
|
+
#
|
1002
|
+
attr_reader :reactivate_subscription
|
1003
|
+
|
1004
|
+
# @private
|
1005
|
+
def initialize parent_rpcs = nil
|
1006
|
+
create_subscription_config = parent_rpcs.create_subscription if parent_rpcs.respond_to? :create_subscription
|
1007
|
+
@create_subscription = ::Gapic::Config::Method.new create_subscription_config
|
1008
|
+
delete_subscription_config = parent_rpcs.delete_subscription if parent_rpcs.respond_to? :delete_subscription
|
1009
|
+
@delete_subscription = ::Gapic::Config::Method.new delete_subscription_config
|
1010
|
+
get_subscription_config = parent_rpcs.get_subscription if parent_rpcs.respond_to? :get_subscription
|
1011
|
+
@get_subscription = ::Gapic::Config::Method.new get_subscription_config
|
1012
|
+
list_subscriptions_config = parent_rpcs.list_subscriptions if parent_rpcs.respond_to? :list_subscriptions
|
1013
|
+
@list_subscriptions = ::Gapic::Config::Method.new list_subscriptions_config
|
1014
|
+
update_subscription_config = parent_rpcs.update_subscription if parent_rpcs.respond_to? :update_subscription
|
1015
|
+
@update_subscription = ::Gapic::Config::Method.new update_subscription_config
|
1016
|
+
reactivate_subscription_config = parent_rpcs.reactivate_subscription if parent_rpcs.respond_to? :reactivate_subscription
|
1017
|
+
@reactivate_subscription = ::Gapic::Config::Method.new reactivate_subscription_config
|
1018
|
+
|
1019
|
+
yield self if block_given?
|
1020
|
+
end
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
end
|
1026
|
+
end
|
1027
|
+
end
|
1028
|
+
end
|
1029
|
+
end
|