google-cloud-support-v2beta 0.6.0 → 0.7.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.
@@ -0,0 +1,894 @@
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/cloud/support/v2beta/support_event_subscription_service_pb"
21
+ require "google/cloud/support/v2beta/support_event_subscription_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Support
26
+ module V2beta
27
+ module SupportEventSubscriptionService
28
+ module Rest
29
+ ##
30
+ # REST client for the SupportEventSubscriptionService service.
31
+ #
32
+ # Service for managing customer support event subscriptions.
33
+ #
34
+ class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudsupport.$UNIVERSE_DOMAIN$"
40
+
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :support_event_subscription_service_stub
45
+
46
+ ##
47
+ # Configure the SupportEventSubscriptionService Client class.
48
+ #
49
+ # See {::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all SupportEventSubscriptionService clients
55
+ # ::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "Support", "V2beta"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config
76
+ end
77
+ yield @configure if block_given?
78
+ @configure
79
+ end
80
+
81
+ ##
82
+ # Configure the SupportEventSubscriptionService Client instance.
83
+ #
84
+ # The configuration is set to the derived mode, meaning that values can be changed,
85
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
+ # should be made on {Client.configure}.
87
+ #
88
+ # See {::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client::Configuration}
89
+ # for a description of the configuration fields.
90
+ #
91
+ # @yield [config] Configure the Client client.
92
+ # @yieldparam config [Client::Configuration]
93
+ #
94
+ # @return [Client::Configuration]
95
+ #
96
+ def configure
97
+ yield @config if block_given?
98
+ @config
99
+ end
100
+
101
+ ##
102
+ # The effective universe domain
103
+ #
104
+ # @return [String]
105
+ #
106
+ def universe_domain
107
+ @support_event_subscription_service_stub.universe_domain
108
+ end
109
+
110
+ ##
111
+ # Create a new SupportEventSubscriptionService REST client object.
112
+ #
113
+ # @example
114
+ #
115
+ # # Create a client using the default configuration
116
+ # client = ::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new
117
+ #
118
+ # # Create a client using a custom configuration
119
+ # client = ::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new do |config|
120
+ # config.timeout = 10.0
121
+ # end
122
+ #
123
+ # @yield [config] Configure the SupportEventSubscriptionService client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ def initialize
127
+ # Create the configuration object
128
+ @config = Configuration.new Client.configure
129
+
130
+ # Yield the configuration if needed
131
+ yield @config if block_given?
132
+
133
+ # Create credentials
134
+ credentials = @config.credentials
135
+ # Use self-signed JWT if the endpoint is unchanged from default,
136
+ # but only if the default endpoint does not have a region prefix.
137
+ enable_self_signed_jwt = @config.endpoint.nil? ||
138
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
139
+ !@config.endpoint.split(".").first.include?("-"))
140
+ credentials ||= Credentials.default scope: @config.scope,
141
+ enable_self_signed_jwt: enable_self_signed_jwt
142
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
143
+ credentials = Credentials.new credentials, scope: @config.scope
144
+ end
145
+
146
+ @quota_project_id = @config.quota_project
147
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
148
+
149
+ @support_event_subscription_service_stub = ::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::ServiceStub.new(
150
+ endpoint: @config.endpoint,
151
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
152
+ universe_domain: @config.universe_domain,
153
+ credentials: credentials,
154
+ logger: @config.logger
155
+ )
156
+
157
+ @support_event_subscription_service_stub.logger(stub: true)&.info do |entry|
158
+ entry.set_system_name
159
+ entry.set_service
160
+ entry.message = "Created client for #{entry.service}"
161
+ entry.set_credentials_fields credentials
162
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
163
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
164
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
165
+ end
166
+ end
167
+
168
+ ##
169
+ # The logger used for request/response debug logging.
170
+ #
171
+ # @return [Logger]
172
+ #
173
+ def logger
174
+ @support_event_subscription_service_stub.logger
175
+ end
176
+
177
+ # Service calls
178
+
179
+ ##
180
+ # Creates a support event subscription for an organization.
181
+ #
182
+ # @overload create_support_event_subscription(request, options = nil)
183
+ # Pass arguments to `create_support_event_subscription` via a request object, either of type
184
+ # {::Google::Cloud::Support::V2beta::CreateSupportEventSubscriptionRequest} or an equivalent Hash.
185
+ #
186
+ # @param request [::Google::Cloud::Support::V2beta::CreateSupportEventSubscriptionRequest, ::Hash]
187
+ # A request object representing the call parameters. Required. To specify no
188
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
189
+ # @param options [::Gapic::CallOptions, ::Hash]
190
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
191
+ #
192
+ # @overload create_support_event_subscription(parent: nil, support_event_subscription: nil)
193
+ # Pass arguments to `create_support_event_subscription` via keyword arguments. Note that at
194
+ # least one keyword argument is required. To specify no parameters, or to keep all
195
+ # the default parameter values, pass an empty Hash as a request object (see above).
196
+ #
197
+ # @param parent [::String]
198
+ # Required. The parent resource name where the support event subscription
199
+ # will be created. Format: organizations/\\{organization_id}
200
+ # @param support_event_subscription [::Google::Cloud::Support::V2beta::SupportEventSubscription, ::Hash]
201
+ # Required. The Pub/Sub configuration to create.
202
+ # @yield [result, operation] Access the result along with the TransportOperation object
203
+ # @yieldparam result [::Google::Cloud::Support::V2beta::SupportEventSubscription]
204
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
205
+ #
206
+ # @return [::Google::Cloud::Support::V2beta::SupportEventSubscription]
207
+ #
208
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
209
+ #
210
+ # @example Basic example
211
+ # require "google/cloud/support/v2beta"
212
+ #
213
+ # # Create a client object. The client can be reused for multiple calls.
214
+ # client = Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new
215
+ #
216
+ # # Create a request. To set request fields, pass in keyword arguments.
217
+ # request = Google::Cloud::Support::V2beta::CreateSupportEventSubscriptionRequest.new
218
+ #
219
+ # # Call the create_support_event_subscription method.
220
+ # result = client.create_support_event_subscription request
221
+ #
222
+ # # The returned object is of type Google::Cloud::Support::V2beta::SupportEventSubscription.
223
+ # p result
224
+ #
225
+ def create_support_event_subscription request, options = nil
226
+ raise ::ArgumentError, "request must be provided" if request.nil?
227
+
228
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::CreateSupportEventSubscriptionRequest
229
+
230
+ # Converts hash and nil to an options object
231
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
232
+
233
+ # Customize the options with defaults
234
+ call_metadata = @config.rpcs.create_support_event_subscription.metadata.to_h
235
+
236
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
237
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
238
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
239
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
240
+ transports_version_send: [:rest]
241
+
242
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
243
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
244
+
245
+ options.apply_defaults timeout: @config.rpcs.create_support_event_subscription.timeout,
246
+ metadata: call_metadata,
247
+ retry_policy: @config.rpcs.create_support_event_subscription.retry_policy
248
+
249
+ options.apply_defaults timeout: @config.timeout,
250
+ metadata: @config.metadata,
251
+ retry_policy: @config.retry_policy
252
+
253
+ @support_event_subscription_service_stub.create_support_event_subscription request, options do |result, operation|
254
+ yield result, operation if block_given?
255
+ end
256
+ rescue ::Gapic::Rest::Error => e
257
+ raise ::Google::Cloud::Error.from_error(e)
258
+ end
259
+
260
+ ##
261
+ # Gets a support event subscription.
262
+ #
263
+ # @overload get_support_event_subscription(request, options = nil)
264
+ # Pass arguments to `get_support_event_subscription` via a request object, either of type
265
+ # {::Google::Cloud::Support::V2beta::GetSupportEventSubscriptionRequest} or an equivalent Hash.
266
+ #
267
+ # @param request [::Google::Cloud::Support::V2beta::GetSupportEventSubscriptionRequest, ::Hash]
268
+ # A request object representing the call parameters. Required. To specify no
269
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
270
+ # @param options [::Gapic::CallOptions, ::Hash]
271
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
272
+ #
273
+ # @overload get_support_event_subscription(name: nil)
274
+ # Pass arguments to `get_support_event_subscription` via keyword arguments. Note that at
275
+ # least one keyword argument is required. To specify no parameters, or to keep all
276
+ # the default parameter values, pass an empty Hash as a request object (see above).
277
+ #
278
+ # @param name [::String]
279
+ # Required. The name of the support event subscription to retrieve.
280
+ # Format:
281
+ # organizations/\\{organization_id}/supportEventSubscriptions/\\{subscription_id}
282
+ # @yield [result, operation] Access the result along with the TransportOperation object
283
+ # @yieldparam result [::Google::Cloud::Support::V2beta::SupportEventSubscription]
284
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
285
+ #
286
+ # @return [::Google::Cloud::Support::V2beta::SupportEventSubscription]
287
+ #
288
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
289
+ #
290
+ # @example Basic example
291
+ # require "google/cloud/support/v2beta"
292
+ #
293
+ # # Create a client object. The client can be reused for multiple calls.
294
+ # client = Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new
295
+ #
296
+ # # Create a request. To set request fields, pass in keyword arguments.
297
+ # request = Google::Cloud::Support::V2beta::GetSupportEventSubscriptionRequest.new
298
+ #
299
+ # # Call the get_support_event_subscription method.
300
+ # result = client.get_support_event_subscription request
301
+ #
302
+ # # The returned object is of type Google::Cloud::Support::V2beta::SupportEventSubscription.
303
+ # p result
304
+ #
305
+ def get_support_event_subscription request, options = nil
306
+ raise ::ArgumentError, "request must be provided" if request.nil?
307
+
308
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::GetSupportEventSubscriptionRequest
309
+
310
+ # Converts hash and nil to an options object
311
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
312
+
313
+ # Customize the options with defaults
314
+ call_metadata = @config.rpcs.get_support_event_subscription.metadata.to_h
315
+
316
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
317
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
318
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
319
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
320
+ transports_version_send: [:rest]
321
+
322
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
323
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
324
+
325
+ options.apply_defaults timeout: @config.rpcs.get_support_event_subscription.timeout,
326
+ metadata: call_metadata,
327
+ retry_policy: @config.rpcs.get_support_event_subscription.retry_policy
328
+
329
+ options.apply_defaults timeout: @config.timeout,
330
+ metadata: @config.metadata,
331
+ retry_policy: @config.retry_policy
332
+
333
+ @support_event_subscription_service_stub.get_support_event_subscription request, options do |result, operation|
334
+ yield result, operation if block_given?
335
+ end
336
+ rescue ::Gapic::Rest::Error => e
337
+ raise ::Google::Cloud::Error.from_error(e)
338
+ end
339
+
340
+ ##
341
+ # Lists support event subscriptions.
342
+ #
343
+ # @overload list_support_event_subscriptions(request, options = nil)
344
+ # Pass arguments to `list_support_event_subscriptions` via a request object, either of type
345
+ # {::Google::Cloud::Support::V2beta::ListSupportEventSubscriptionsRequest} or an equivalent Hash.
346
+ #
347
+ # @param request [::Google::Cloud::Support::V2beta::ListSupportEventSubscriptionsRequest, ::Hash]
348
+ # A request object representing the call parameters. Required. To specify no
349
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
350
+ # @param options [::Gapic::CallOptions, ::Hash]
351
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
352
+ #
353
+ # @overload list_support_event_subscriptions(parent: nil, filter: nil, show_deleted: nil, page_size: nil, page_token: nil)
354
+ # Pass arguments to `list_support_event_subscriptions` via keyword arguments. Note that at
355
+ # least one keyword argument is required. To specify no parameters, or to keep all
356
+ # the default parameter values, pass an empty Hash as a request object (see above).
357
+ #
358
+ # @param parent [::String]
359
+ # Required. The fully qualified name of the Cloud resource to list support
360
+ # event subscriptions under. Format: organizations/\\{organization_id}
361
+ # @param filter [::String]
362
+ # Optional. Filter expression based on AIP-160.
363
+ # Supported fields:
364
+ # - pub_sub_topic
365
+ # - state
366
+ #
367
+ # Examples:
368
+ # - `pub_sub_topic="projects/example-project/topics/example-topic"`
369
+ # - `state=WORKING`
370
+ # - `pub_sub_topic="projects/example-project/topics/example-topic" AND
371
+ # state=WORKING`
372
+ # @param show_deleted [::Boolean]
373
+ # Optional. Whether to show deleted subscriptions. By default, deleted
374
+ # subscriptions are not returned.
375
+ # @param page_size [::Integer]
376
+ # Optional. The maximum number of support event subscriptions to return.
377
+ # @param page_token [::String]
378
+ # Optional. A token identifying the page of results to return. If
379
+ # unspecified, the first page is retrieved.
380
+ #
381
+ # When paginating, all other parameters provided to
382
+ # `ListSupportEventSubscriptions` must match the call that provided the page
383
+ # token.
384
+ # @yield [result, operation] Access the result along with the TransportOperation object
385
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::SupportEventSubscription>]
386
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
387
+ #
388
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::SupportEventSubscription>]
389
+ #
390
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
391
+ #
392
+ # @example Basic example
393
+ # require "google/cloud/support/v2beta"
394
+ #
395
+ # # Create a client object. The client can be reused for multiple calls.
396
+ # client = Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new
397
+ #
398
+ # # Create a request. To set request fields, pass in keyword arguments.
399
+ # request = Google::Cloud::Support::V2beta::ListSupportEventSubscriptionsRequest.new
400
+ #
401
+ # # Call the list_support_event_subscriptions method.
402
+ # result = client.list_support_event_subscriptions request
403
+ #
404
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
405
+ # # over elements, and API calls will be issued to fetch pages as needed.
406
+ # result.each do |item|
407
+ # # Each element is of type ::Google::Cloud::Support::V2beta::SupportEventSubscription.
408
+ # p item
409
+ # end
410
+ #
411
+ def list_support_event_subscriptions request, options = nil
412
+ raise ::ArgumentError, "request must be provided" if request.nil?
413
+
414
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::ListSupportEventSubscriptionsRequest
415
+
416
+ # Converts hash and nil to an options object
417
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
418
+
419
+ # Customize the options with defaults
420
+ call_metadata = @config.rpcs.list_support_event_subscriptions.metadata.to_h
421
+
422
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
423
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
424
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
425
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
426
+ transports_version_send: [:rest]
427
+
428
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
429
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
430
+
431
+ options.apply_defaults timeout: @config.rpcs.list_support_event_subscriptions.timeout,
432
+ metadata: call_metadata,
433
+ retry_policy: @config.rpcs.list_support_event_subscriptions.retry_policy
434
+
435
+ options.apply_defaults timeout: @config.timeout,
436
+ metadata: @config.metadata,
437
+ retry_policy: @config.retry_policy
438
+
439
+ @support_event_subscription_service_stub.list_support_event_subscriptions request, options do |result, operation|
440
+ result = ::Gapic::Rest::PagedEnumerable.new @support_event_subscription_service_stub, :list_support_event_subscriptions, "support_event_subscriptions", request, result, options
441
+ yield result, operation if block_given?
442
+ throw :response, result
443
+ end
444
+ rescue ::Gapic::Rest::Error => e
445
+ raise ::Google::Cloud::Error.from_error(e)
446
+ end
447
+
448
+ ##
449
+ # Updates a support event subscription.
450
+ #
451
+ # @overload update_support_event_subscription(request, options = nil)
452
+ # Pass arguments to `update_support_event_subscription` via a request object, either of type
453
+ # {::Google::Cloud::Support::V2beta::UpdateSupportEventSubscriptionRequest} or an equivalent Hash.
454
+ #
455
+ # @param request [::Google::Cloud::Support::V2beta::UpdateSupportEventSubscriptionRequest, ::Hash]
456
+ # A request object representing the call parameters. Required. To specify no
457
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
458
+ # @param options [::Gapic::CallOptions, ::Hash]
459
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
460
+ #
461
+ # @overload update_support_event_subscription(support_event_subscription: nil, update_mask: nil)
462
+ # Pass arguments to `update_support_event_subscription` via keyword arguments. Note that at
463
+ # least one keyword argument is required. To specify no parameters, or to keep all
464
+ # the default parameter values, pass an empty Hash as a request object (see above).
465
+ #
466
+ # @param support_event_subscription [::Google::Cloud::Support::V2beta::SupportEventSubscription, ::Hash]
467
+ # Required. The support event subscription to update.
468
+ # The `name` field is used to identify the configuration to update.
469
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
470
+ # Optional. The list of fields to update. The only supported value is
471
+ # pub_sub_topic.
472
+ # @yield [result, operation] Access the result along with the TransportOperation object
473
+ # @yieldparam result [::Google::Cloud::Support::V2beta::SupportEventSubscription]
474
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
475
+ #
476
+ # @return [::Google::Cloud::Support::V2beta::SupportEventSubscription]
477
+ #
478
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
479
+ #
480
+ # @example Basic example
481
+ # require "google/cloud/support/v2beta"
482
+ #
483
+ # # Create a client object. The client can be reused for multiple calls.
484
+ # client = Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new
485
+ #
486
+ # # Create a request. To set request fields, pass in keyword arguments.
487
+ # request = Google::Cloud::Support::V2beta::UpdateSupportEventSubscriptionRequest.new
488
+ #
489
+ # # Call the update_support_event_subscription method.
490
+ # result = client.update_support_event_subscription request
491
+ #
492
+ # # The returned object is of type Google::Cloud::Support::V2beta::SupportEventSubscription.
493
+ # p result
494
+ #
495
+ def update_support_event_subscription request, options = nil
496
+ raise ::ArgumentError, "request must be provided" if request.nil?
497
+
498
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::UpdateSupportEventSubscriptionRequest
499
+
500
+ # Converts hash and nil to an options object
501
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
502
+
503
+ # Customize the options with defaults
504
+ call_metadata = @config.rpcs.update_support_event_subscription.metadata.to_h
505
+
506
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
507
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
508
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
509
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
510
+ transports_version_send: [:rest]
511
+
512
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
513
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
514
+
515
+ options.apply_defaults timeout: @config.rpcs.update_support_event_subscription.timeout,
516
+ metadata: call_metadata,
517
+ retry_policy: @config.rpcs.update_support_event_subscription.retry_policy
518
+
519
+ options.apply_defaults timeout: @config.timeout,
520
+ metadata: @config.metadata,
521
+ retry_policy: @config.retry_policy
522
+
523
+ @support_event_subscription_service_stub.update_support_event_subscription request, options do |result, operation|
524
+ yield result, operation if block_given?
525
+ end
526
+ rescue ::Gapic::Rest::Error => e
527
+ raise ::Google::Cloud::Error.from_error(e)
528
+ end
529
+
530
+ ##
531
+ # Soft deletes a support event subscription.
532
+ #
533
+ # @overload delete_support_event_subscription(request, options = nil)
534
+ # Pass arguments to `delete_support_event_subscription` via a request object, either of type
535
+ # {::Google::Cloud::Support::V2beta::DeleteSupportEventSubscriptionRequest} or an equivalent Hash.
536
+ #
537
+ # @param request [::Google::Cloud::Support::V2beta::DeleteSupportEventSubscriptionRequest, ::Hash]
538
+ # A request object representing the call parameters. Required. To specify no
539
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
540
+ # @param options [::Gapic::CallOptions, ::Hash]
541
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
542
+ #
543
+ # @overload delete_support_event_subscription(name: nil)
544
+ # Pass arguments to `delete_support_event_subscription` via keyword arguments. Note that at
545
+ # least one keyword argument is required. To specify no parameters, or to keep all
546
+ # the default parameter values, pass an empty Hash as a request object (see above).
547
+ #
548
+ # @param name [::String]
549
+ # Required. The name of the support event subscription to delete.
550
+ # Format:
551
+ # organizations/\\{organization_id}/supportEventSubscriptions/\\{subscription_id}
552
+ # @yield [result, operation] Access the result along with the TransportOperation object
553
+ # @yieldparam result [::Google::Cloud::Support::V2beta::SupportEventSubscription]
554
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
555
+ #
556
+ # @return [::Google::Cloud::Support::V2beta::SupportEventSubscription]
557
+ #
558
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
559
+ #
560
+ # @example Basic example
561
+ # require "google/cloud/support/v2beta"
562
+ #
563
+ # # Create a client object. The client can be reused for multiple calls.
564
+ # client = Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new
565
+ #
566
+ # # Create a request. To set request fields, pass in keyword arguments.
567
+ # request = Google::Cloud::Support::V2beta::DeleteSupportEventSubscriptionRequest.new
568
+ #
569
+ # # Call the delete_support_event_subscription method.
570
+ # result = client.delete_support_event_subscription request
571
+ #
572
+ # # The returned object is of type Google::Cloud::Support::V2beta::SupportEventSubscription.
573
+ # p result
574
+ #
575
+ def delete_support_event_subscription request, options = nil
576
+ raise ::ArgumentError, "request must be provided" if request.nil?
577
+
578
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::DeleteSupportEventSubscriptionRequest
579
+
580
+ # Converts hash and nil to an options object
581
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
582
+
583
+ # Customize the options with defaults
584
+ call_metadata = @config.rpcs.delete_support_event_subscription.metadata.to_h
585
+
586
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
587
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
588
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
589
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
590
+ transports_version_send: [:rest]
591
+
592
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
593
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
594
+
595
+ options.apply_defaults timeout: @config.rpcs.delete_support_event_subscription.timeout,
596
+ metadata: call_metadata,
597
+ retry_policy: @config.rpcs.delete_support_event_subscription.retry_policy
598
+
599
+ options.apply_defaults timeout: @config.timeout,
600
+ metadata: @config.metadata,
601
+ retry_policy: @config.retry_policy
602
+
603
+ @support_event_subscription_service_stub.delete_support_event_subscription request, options do |result, operation|
604
+ yield result, operation if block_given?
605
+ end
606
+ rescue ::Gapic::Rest::Error => e
607
+ raise ::Google::Cloud::Error.from_error(e)
608
+ end
609
+
610
+ ##
611
+ # Undeletes a support event subscription.
612
+ #
613
+ # @overload undelete_support_event_subscription(request, options = nil)
614
+ # Pass arguments to `undelete_support_event_subscription` via a request object, either of type
615
+ # {::Google::Cloud::Support::V2beta::UndeleteSupportEventSubscriptionRequest} or an equivalent Hash.
616
+ #
617
+ # @param request [::Google::Cloud::Support::V2beta::UndeleteSupportEventSubscriptionRequest, ::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 undelete_support_event_subscription(name: nil)
624
+ # Pass arguments to `undelete_support_event_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 name [::String]
629
+ # Required. The name of the support event subscription to undelete.
630
+ # Format:
631
+ # organizations/\\{organization_id}/supportEventSubscriptions/\\{subscription_id}
632
+ # @yield [result, operation] Access the result along with the TransportOperation object
633
+ # @yieldparam result [::Google::Cloud::Support::V2beta::SupportEventSubscription]
634
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
635
+ #
636
+ # @return [::Google::Cloud::Support::V2beta::SupportEventSubscription]
637
+ #
638
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
639
+ #
640
+ # @example Basic example
641
+ # require "google/cloud/support/v2beta"
642
+ #
643
+ # # Create a client object. The client can be reused for multiple calls.
644
+ # client = Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new
645
+ #
646
+ # # Create a request. To set request fields, pass in keyword arguments.
647
+ # request = Google::Cloud::Support::V2beta::UndeleteSupportEventSubscriptionRequest.new
648
+ #
649
+ # # Call the undelete_support_event_subscription method.
650
+ # result = client.undelete_support_event_subscription request
651
+ #
652
+ # # The returned object is of type Google::Cloud::Support::V2beta::SupportEventSubscription.
653
+ # p result
654
+ #
655
+ def undelete_support_event_subscription request, options = nil
656
+ raise ::ArgumentError, "request must be provided" if request.nil?
657
+
658
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::UndeleteSupportEventSubscriptionRequest
659
+
660
+ # Converts hash and nil to an options object
661
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
662
+
663
+ # Customize the options with defaults
664
+ call_metadata = @config.rpcs.undelete_support_event_subscription.metadata.to_h
665
+
666
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
667
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
668
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
669
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
670
+ transports_version_send: [:rest]
671
+
672
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
673
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
674
+
675
+ options.apply_defaults timeout: @config.rpcs.undelete_support_event_subscription.timeout,
676
+ metadata: call_metadata,
677
+ retry_policy: @config.rpcs.undelete_support_event_subscription.retry_policy
678
+
679
+ options.apply_defaults timeout: @config.timeout,
680
+ metadata: @config.metadata,
681
+ retry_policy: @config.retry_policy
682
+
683
+ @support_event_subscription_service_stub.undelete_support_event_subscription request, options do |result, operation|
684
+ yield result, operation if block_given?
685
+ end
686
+ rescue ::Gapic::Rest::Error => e
687
+ raise ::Google::Cloud::Error.from_error(e)
688
+ end
689
+
690
+ ##
691
+ # Configuration class for the SupportEventSubscriptionService REST API.
692
+ #
693
+ # This class represents the configuration for SupportEventSubscriptionService REST,
694
+ # providing control over timeouts, retry behavior, logging, transport
695
+ # parameters, and other low-level controls. Certain parameters can also be
696
+ # applied individually to specific RPCs. See
697
+ # {::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client::Configuration::Rpcs}
698
+ # for a list of RPCs that can be configured independently.
699
+ #
700
+ # Configuration can be applied globally to all clients, or to a single client
701
+ # on construction.
702
+ #
703
+ # @example
704
+ #
705
+ # # Modify the global config, setting the timeout for
706
+ # # create_support_event_subscription to 20 seconds,
707
+ # # and all remaining timeouts to 10 seconds.
708
+ # ::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.configure do |config|
709
+ # config.timeout = 10.0
710
+ # config.rpcs.create_support_event_subscription.timeout = 20.0
711
+ # end
712
+ #
713
+ # # Apply the above configuration only to a new client.
714
+ # client = ::Google::Cloud::Support::V2beta::SupportEventSubscriptionService::Rest::Client.new do |config|
715
+ # config.timeout = 10.0
716
+ # config.rpcs.create_support_event_subscription.timeout = 20.0
717
+ # end
718
+ #
719
+ # @!attribute [rw] endpoint
720
+ # A custom service endpoint, as a hostname or hostname:port. The default is
721
+ # nil, indicating to use the default endpoint in the current universe domain.
722
+ # @return [::String,nil]
723
+ # @!attribute [rw] credentials
724
+ # Credentials to send with calls. You may provide any of the following types:
725
+ # * (`String`) The path to a service account key file in JSON format
726
+ # * (`Hash`) A service account key as a Hash
727
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
728
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
729
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
730
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
731
+ # * (`nil`) indicating no credentials
732
+ #
733
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
734
+ # external source for authentication to Google Cloud, you must validate it before
735
+ # providing it to a Google API client library. Providing an unvalidated credential
736
+ # configuration to Google APIs can compromise the security of your systems and data.
737
+ # For more information, refer to [Validate credential configurations from external
738
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
739
+ # @return [::Object]
740
+ # @!attribute [rw] scope
741
+ # The OAuth scopes
742
+ # @return [::Array<::String>]
743
+ # @!attribute [rw] lib_name
744
+ # The library name as recorded in instrumentation and logging
745
+ # @return [::String]
746
+ # @!attribute [rw] lib_version
747
+ # The library version as recorded in instrumentation and logging
748
+ # @return [::String]
749
+ # @!attribute [rw] timeout
750
+ # The call timeout in seconds.
751
+ # @return [::Numeric]
752
+ # @!attribute [rw] metadata
753
+ # Additional headers to be sent with the call.
754
+ # @return [::Hash{::Symbol=>::String}]
755
+ # @!attribute [rw] retry_policy
756
+ # The retry policy. The value is a hash with the following keys:
757
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
758
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
759
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
760
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
761
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
762
+ # trigger a retry.
763
+ # @return [::Hash]
764
+ # @!attribute [rw] quota_project
765
+ # A separate project against which to charge quota.
766
+ # @return [::String]
767
+ # @!attribute [rw] universe_domain
768
+ # The universe domain within which to make requests. This determines the
769
+ # default endpoint URL. The default value of nil uses the environment
770
+ # universe (usually the default "googleapis.com" universe).
771
+ # @return [::String,nil]
772
+ # @!attribute [rw] logger
773
+ # A custom logger to use for request/response debug logging, or the value
774
+ # `:default` (the default) to construct a default logger, or `nil` to
775
+ # explicitly disable logging.
776
+ # @return [::Logger,:default,nil]
777
+ #
778
+ class Configuration
779
+ extend ::Gapic::Config
780
+
781
+ # @private
782
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
783
+ DEFAULT_ENDPOINT = "cloudsupport.googleapis.com"
784
+
785
+ config_attr :endpoint, nil, ::String, nil
786
+ config_attr :credentials, nil do |value|
787
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
788
+ allowed.any? { |klass| klass === value }
789
+ end
790
+ config_attr :scope, nil, ::String, ::Array, nil
791
+ config_attr :lib_name, nil, ::String, nil
792
+ config_attr :lib_version, nil, ::String, nil
793
+ config_attr :timeout, nil, ::Numeric, nil
794
+ config_attr :metadata, nil, ::Hash, nil
795
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
796
+ config_attr :quota_project, nil, ::String, nil
797
+ config_attr :universe_domain, nil, ::String, nil
798
+ config_attr :logger, :default, ::Logger, nil, :default
799
+
800
+ # @private
801
+ def initialize parent_config = nil
802
+ @parent_config = parent_config unless parent_config.nil?
803
+
804
+ yield self if block_given?
805
+ end
806
+
807
+ ##
808
+ # Configurations for individual RPCs
809
+ # @return [Rpcs]
810
+ #
811
+ def rpcs
812
+ @rpcs ||= begin
813
+ parent_rpcs = nil
814
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
815
+ Rpcs.new parent_rpcs
816
+ end
817
+ end
818
+
819
+ ##
820
+ # Configuration RPC class for the SupportEventSubscriptionService API.
821
+ #
822
+ # Includes fields providing the configuration for each RPC in this service.
823
+ # Each configuration object is of type `Gapic::Config::Method` and includes
824
+ # the following configuration fields:
825
+ #
826
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
827
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
828
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
829
+ # include the following keys:
830
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
831
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
832
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
833
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
834
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
835
+ # trigger a retry.
836
+ #
837
+ class Rpcs
838
+ ##
839
+ # RPC-specific configuration for `create_support_event_subscription`
840
+ # @return [::Gapic::Config::Method]
841
+ #
842
+ attr_reader :create_support_event_subscription
843
+ ##
844
+ # RPC-specific configuration for `get_support_event_subscription`
845
+ # @return [::Gapic::Config::Method]
846
+ #
847
+ attr_reader :get_support_event_subscription
848
+ ##
849
+ # RPC-specific configuration for `list_support_event_subscriptions`
850
+ # @return [::Gapic::Config::Method]
851
+ #
852
+ attr_reader :list_support_event_subscriptions
853
+ ##
854
+ # RPC-specific configuration for `update_support_event_subscription`
855
+ # @return [::Gapic::Config::Method]
856
+ #
857
+ attr_reader :update_support_event_subscription
858
+ ##
859
+ # RPC-specific configuration for `delete_support_event_subscription`
860
+ # @return [::Gapic::Config::Method]
861
+ #
862
+ attr_reader :delete_support_event_subscription
863
+ ##
864
+ # RPC-specific configuration for `undelete_support_event_subscription`
865
+ # @return [::Gapic::Config::Method]
866
+ #
867
+ attr_reader :undelete_support_event_subscription
868
+
869
+ # @private
870
+ def initialize parent_rpcs = nil
871
+ create_support_event_subscription_config = parent_rpcs.create_support_event_subscription if parent_rpcs.respond_to? :create_support_event_subscription
872
+ @create_support_event_subscription = ::Gapic::Config::Method.new create_support_event_subscription_config
873
+ get_support_event_subscription_config = parent_rpcs.get_support_event_subscription if parent_rpcs.respond_to? :get_support_event_subscription
874
+ @get_support_event_subscription = ::Gapic::Config::Method.new get_support_event_subscription_config
875
+ list_support_event_subscriptions_config = parent_rpcs.list_support_event_subscriptions if parent_rpcs.respond_to? :list_support_event_subscriptions
876
+ @list_support_event_subscriptions = ::Gapic::Config::Method.new list_support_event_subscriptions_config
877
+ update_support_event_subscription_config = parent_rpcs.update_support_event_subscription if parent_rpcs.respond_to? :update_support_event_subscription
878
+ @update_support_event_subscription = ::Gapic::Config::Method.new update_support_event_subscription_config
879
+ delete_support_event_subscription_config = parent_rpcs.delete_support_event_subscription if parent_rpcs.respond_to? :delete_support_event_subscription
880
+ @delete_support_event_subscription = ::Gapic::Config::Method.new delete_support_event_subscription_config
881
+ undelete_support_event_subscription_config = parent_rpcs.undelete_support_event_subscription if parent_rpcs.respond_to? :undelete_support_event_subscription
882
+ @undelete_support_event_subscription = ::Gapic::Config::Method.new undelete_support_event_subscription_config
883
+
884
+ yield self if block_given?
885
+ end
886
+ end
887
+ end
888
+ end
889
+ end
890
+ end
891
+ end
892
+ end
893
+ end
894
+ end