google-cloud-support-v2beta 0.a → 0.1.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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/support/v2beta/actor_pb.rb +44 -0
  6. data/lib/google/cloud/support/v2beta/attachment_pb.rb +49 -0
  7. data/lib/google/cloud/support/v2beta/attachment_service_pb.rb +50 -0
  8. data/lib/google/cloud/support/v2beta/attachment_service_services_pb.rb +75 -0
  9. data/lib/google/cloud/support/v2beta/case_attachment_service/client.rb +510 -0
  10. data/lib/google/cloud/support/v2beta/case_attachment_service/credentials.rb +47 -0
  11. data/lib/google/cloud/support/v2beta/case_attachment_service/paths.rb +72 -0
  12. data/lib/google/cloud/support/v2beta/case_attachment_service/rest/client.rb +477 -0
  13. data/lib/google/cloud/support/v2beta/case_attachment_service/rest/service_stub.rb +149 -0
  14. data/lib/google/cloud/support/v2beta/case_attachment_service/rest.rb +52 -0
  15. data/lib/google/cloud/support/v2beta/case_attachment_service.rb +55 -0
  16. data/lib/google/cloud/support/v2beta/case_pb.rb +54 -0
  17. data/lib/google/cloud/support/v2beta/case_service/client.rb +1526 -0
  18. data/lib/google/cloud/support/v2beta/case_service/credentials.rb +47 -0
  19. data/lib/google/cloud/support/v2beta/case_service/paths.rb +100 -0
  20. data/lib/google/cloud/support/v2beta/case_service/rest/client.rb +1452 -0
  21. data/lib/google/cloud/support/v2beta/case_service/rest/service_stub.rb +624 -0
  22. data/lib/google/cloud/support/v2beta/case_service/rest.rb +52 -0
  23. data/lib/google/cloud/support/v2beta/case_service.rb +55 -0
  24. data/lib/google/cloud/support/v2beta/case_service_pb.rb +63 -0
  25. data/lib/google/cloud/support/v2beta/case_service_services_pb.rb +356 -0
  26. data/lib/google/cloud/support/v2beta/comment_pb.rb +49 -0
  27. data/lib/google/cloud/support/v2beta/comment_service/client.rb +639 -0
  28. data/lib/google/cloud/support/v2beta/comment_service/credentials.rb +47 -0
  29. data/lib/google/cloud/support/v2beta/comment_service/paths.rb +115 -0
  30. data/lib/google/cloud/support/v2beta/comment_service/rest/client.rb +599 -0
  31. data/lib/google/cloud/support/v2beta/comment_service/rest/service_stub.rb +219 -0
  32. data/lib/google/cloud/support/v2beta/comment_service/rest.rb +52 -0
  33. data/lib/google/cloud/support/v2beta/comment_service.rb +55 -0
  34. data/lib/google/cloud/support/v2beta/comment_service_pb.rb +51 -0
  35. data/lib/google/cloud/support/v2beta/comment_service_services_pb.rb +117 -0
  36. data/lib/google/cloud/support/v2beta/content_pb.rb +42 -0
  37. data/lib/google/cloud/support/v2beta/email_message_pb.rb +51 -0
  38. data/lib/google/cloud/support/v2beta/escalation_pb.rb +45 -0
  39. data/lib/google/cloud/support/v2beta/feed_item_pb.rb +52 -0
  40. data/lib/google/cloud/support/v2beta/feed_service/client.rb +482 -0
  41. data/lib/google/cloud/support/v2beta/feed_service/credentials.rb +47 -0
  42. data/lib/google/cloud/support/v2beta/feed_service/paths.rb +72 -0
  43. data/lib/google/cloud/support/v2beta/feed_service/rest/client.rb +449 -0
  44. data/lib/google/cloud/support/v2beta/feed_service/rest/service_stub.rb +149 -0
  45. data/lib/google/cloud/support/v2beta/feed_service/rest.rb +52 -0
  46. data/lib/google/cloud/support/v2beta/feed_service.rb +55 -0
  47. data/lib/google/cloud/support/v2beta/feed_service_pb.rb +50 -0
  48. data/lib/google/cloud/support/v2beta/feed_service_services_pb.rb +46 -0
  49. data/lib/google/cloud/support/v2beta/rest.rb +40 -0
  50. data/lib/google/cloud/support/v2beta/version.rb +7 -2
  51. data/lib/google/cloud/support/v2beta.rb +48 -0
  52. data/lib/google-cloud-support-v2beta.rb +21 -0
  53. data/proto_docs/README.md +4 -0
  54. data/proto_docs/google/api/client.rb +473 -0
  55. data/proto_docs/google/api/field_behavior.rb +85 -0
  56. data/proto_docs/google/api/launch_stage.rb +71 -0
  57. data/proto_docs/google/api/resource.rb +227 -0
  58. data/proto_docs/google/cloud/support/v2beta/actor.rb +59 -0
  59. data/proto_docs/google/cloud/support/v2beta/attachment.rb +58 -0
  60. data/proto_docs/google/cloud/support/v2beta/attachment_service.rb +63 -0
  61. data/proto_docs/google/cloud/support/v2beta/case.rb +215 -0
  62. data/proto_docs/google/cloud/support/v2beta/case_service.rb +245 -0
  63. data/proto_docs/google/cloud/support/v2beta/comment.rb +58 -0
  64. data/proto_docs/google/cloud/support/v2beta/comment_service.rb +68 -0
  65. data/proto_docs/google/cloud/support/v2beta/content.rb +35 -0
  66. data/proto_docs/google/cloud/support/v2beta/email_message.rb +55 -0
  67. data/proto_docs/google/cloud/support/v2beta/escalation.rb +55 -0
  68. data/proto_docs/google/cloud/support/v2beta/feed_item.rb +56 -0
  69. data/proto_docs/google/cloud/support/v2beta/feed_service.rb +65 -0
  70. data/proto_docs/google/protobuf/duration.rb +98 -0
  71. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  72. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  73. metadata +105 -9
@@ -0,0 +1,1452 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/case_service_pb"
21
+ require "google/cloud/support/v2beta/case_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Support
26
+ module V2beta
27
+ module CaseService
28
+ module Rest
29
+ ##
30
+ # REST client for the CaseService service.
31
+ #
32
+ # A service to manage Google Cloud support cases.
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 :case_service_stub
45
+
46
+ ##
47
+ # Configure the CaseService Client class.
48
+ #
49
+ # See {::Google::Cloud::Support::V2beta::CaseService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all CaseService clients
55
+ # ::Google::Cloud::Support::V2beta::CaseService::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.rpcs.get_case.timeout = 60.0
76
+ default_config.rpcs.get_case.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.list_cases.timeout = 60.0
81
+ default_config.rpcs.list_cases.retry_policy = {
82
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
83
+ }
84
+
85
+ default_config.rpcs.search_cases.timeout = 60.0
86
+ default_config.rpcs.search_cases.retry_policy = {
87
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
88
+ }
89
+
90
+ default_config.rpcs.create_case.timeout = 60.0
91
+
92
+ default_config.rpcs.update_case.timeout = 60.0
93
+
94
+ default_config.rpcs.escalate_case.timeout = 60.0
95
+
96
+ default_config.rpcs.close_case.timeout = 60.0
97
+
98
+ default_config.rpcs.search_case_classifications.timeout = 60.0
99
+ default_config.rpcs.search_case_classifications.retry_policy = {
100
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
101
+ }
102
+
103
+ default_config
104
+ end
105
+ yield @configure if block_given?
106
+ @configure
107
+ end
108
+
109
+ ##
110
+ # Configure the CaseService Client instance.
111
+ #
112
+ # The configuration is set to the derived mode, meaning that values can be changed,
113
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
114
+ # should be made on {Client.configure}.
115
+ #
116
+ # See {::Google::Cloud::Support::V2beta::CaseService::Rest::Client::Configuration}
117
+ # for a description of the configuration fields.
118
+ #
119
+ # @yield [config] Configure the Client client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ # @return [Client::Configuration]
123
+ #
124
+ def configure
125
+ yield @config if block_given?
126
+ @config
127
+ end
128
+
129
+ ##
130
+ # The effective universe domain
131
+ #
132
+ # @return [String]
133
+ #
134
+ def universe_domain
135
+ @case_service_stub.universe_domain
136
+ end
137
+
138
+ ##
139
+ # Create a new CaseService REST client object.
140
+ #
141
+ # @example
142
+ #
143
+ # # Create a client using the default configuration
144
+ # client = ::Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
145
+ #
146
+ # # Create a client using a custom configuration
147
+ # client = ::Google::Cloud::Support::V2beta::CaseService::Rest::Client.new do |config|
148
+ # config.timeout = 10.0
149
+ # end
150
+ #
151
+ # @yield [config] Configure the CaseService client.
152
+ # @yieldparam config [Client::Configuration]
153
+ #
154
+ def initialize
155
+ # Create the configuration object
156
+ @config = Configuration.new Client.configure
157
+
158
+ # Yield the configuration if needed
159
+ yield @config if block_given?
160
+
161
+ # Create credentials
162
+ credentials = @config.credentials
163
+ # Use self-signed JWT if the endpoint is unchanged from default,
164
+ # but only if the default endpoint does not have a region prefix.
165
+ enable_self_signed_jwt = @config.endpoint.nil? ||
166
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
167
+ !@config.endpoint.split(".").first.include?("-"))
168
+ credentials ||= Credentials.default scope: @config.scope,
169
+ enable_self_signed_jwt: enable_self_signed_jwt
170
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
171
+ credentials = Credentials.new credentials, scope: @config.scope
172
+ end
173
+
174
+ @quota_project_id = @config.quota_project
175
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
176
+
177
+ @case_service_stub = ::Google::Cloud::Support::V2beta::CaseService::Rest::ServiceStub.new(
178
+ endpoint: @config.endpoint,
179
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
180
+ universe_domain: @config.universe_domain,
181
+ credentials: credentials,
182
+ logger: @config.logger
183
+ )
184
+
185
+ @case_service_stub.logger(stub: true)&.info do |entry|
186
+ entry.set_system_name
187
+ entry.set_service
188
+ entry.message = "Created client for #{entry.service}"
189
+ entry.set_credentials_fields credentials
190
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
191
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
192
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
193
+ end
194
+ end
195
+
196
+ ##
197
+ # The logger used for request/response debug logging.
198
+ #
199
+ # @return [Logger]
200
+ #
201
+ def logger
202
+ @case_service_stub.logger
203
+ end
204
+
205
+ # Service calls
206
+
207
+ ##
208
+ # Retrieve a case.
209
+ #
210
+ # EXAMPLES:
211
+ #
212
+ # cURL:
213
+ #
214
+ # ```shell
215
+ # case="projects/some-project/cases/16033687"
216
+ # curl \
217
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
218
+ # "https://cloudsupport.googleapis.com/v2/$case"
219
+ # ```
220
+ #
221
+ # Python:
222
+ #
223
+ # ```python
224
+ # import googleapiclient.discovery
225
+ #
226
+ # api_version = "v2"
227
+ # supportApiService = googleapiclient.discovery.build(
228
+ # serviceName="cloudsupport",
229
+ # version=api_version,
230
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
231
+ # )
232
+ #
233
+ # request = supportApiService.cases().get(
234
+ # name="projects/some-project/cases/43595344",
235
+ # )
236
+ # print(request.execute())
237
+ # ```
238
+ #
239
+ # @overload get_case(request, options = nil)
240
+ # Pass arguments to `get_case` via a request object, either of type
241
+ # {::Google::Cloud::Support::V2beta::GetCaseRequest} or an equivalent Hash.
242
+ #
243
+ # @param request [::Google::Cloud::Support::V2beta::GetCaseRequest, ::Hash]
244
+ # A request object representing the call parameters. Required. To specify no
245
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
246
+ # @param options [::Gapic::CallOptions, ::Hash]
247
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
248
+ #
249
+ # @overload get_case(name: nil)
250
+ # Pass arguments to `get_case` via keyword arguments. Note that at
251
+ # least one keyword argument is required. To specify no parameters, or to keep all
252
+ # the default parameter values, pass an empty Hash as a request object (see above).
253
+ #
254
+ # @param name [::String]
255
+ # Required. The full name of a case to be retrieved.
256
+ # @yield [result, operation] Access the result along with the TransportOperation object
257
+ # @yieldparam result [::Google::Cloud::Support::V2beta::Case]
258
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
259
+ #
260
+ # @return [::Google::Cloud::Support::V2beta::Case]
261
+ #
262
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
263
+ #
264
+ # @example Basic example
265
+ # require "google/cloud/support/v2beta"
266
+ #
267
+ # # Create a client object. The client can be reused for multiple calls.
268
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
269
+ #
270
+ # # Create a request. To set request fields, pass in keyword arguments.
271
+ # request = Google::Cloud::Support::V2beta::GetCaseRequest.new
272
+ #
273
+ # # Call the get_case method.
274
+ # result = client.get_case request
275
+ #
276
+ # # The returned object is of type Google::Cloud::Support::V2beta::Case.
277
+ # p result
278
+ #
279
+ def get_case request, options = nil
280
+ raise ::ArgumentError, "request must be provided" if request.nil?
281
+
282
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::GetCaseRequest
283
+
284
+ # Converts hash and nil to an options object
285
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
286
+
287
+ # Customize the options with defaults
288
+ call_metadata = @config.rpcs.get_case.metadata.to_h
289
+
290
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
291
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
293
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
294
+ transports_version_send: [:rest]
295
+
296
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
297
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
298
+
299
+ options.apply_defaults timeout: @config.rpcs.get_case.timeout,
300
+ metadata: call_metadata,
301
+ retry_policy: @config.rpcs.get_case.retry_policy
302
+
303
+ options.apply_defaults timeout: @config.timeout,
304
+ metadata: @config.metadata,
305
+ retry_policy: @config.retry_policy
306
+
307
+ @case_service_stub.get_case request, options do |result, operation|
308
+ yield result, operation if block_given?
309
+ end
310
+ rescue ::Gapic::Rest::Error => e
311
+ raise ::Google::Cloud::Error.from_error(e)
312
+ end
313
+
314
+ ##
315
+ # Retrieve all cases under a parent, but not its children.
316
+ #
317
+ # For example, listing cases under an organization only returns the cases
318
+ # that are directly parented by that organization. To retrieve cases
319
+ # under an organization and its projects, use `cases.search`.
320
+ #
321
+ # EXAMPLES:
322
+ #
323
+ # cURL:
324
+ #
325
+ # ```shell
326
+ # parent="projects/some-project"
327
+ # curl \
328
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
329
+ # "https://cloudsupport.googleapis.com/v2/$parent/cases"
330
+ # ```
331
+ #
332
+ # Python:
333
+ #
334
+ # ```python
335
+ # import googleapiclient.discovery
336
+ #
337
+ # api_version = "v2"
338
+ # supportApiService = googleapiclient.discovery.build(
339
+ # serviceName="cloudsupport",
340
+ # version=api_version,
341
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
342
+ # )
343
+ #
344
+ # request =
345
+ # supportApiService.cases().list(parent="projects/some-project")
346
+ # print(request.execute())
347
+ # ```
348
+ #
349
+ # @overload list_cases(request, options = nil)
350
+ # Pass arguments to `list_cases` via a request object, either of type
351
+ # {::Google::Cloud::Support::V2beta::ListCasesRequest} or an equivalent Hash.
352
+ #
353
+ # @param request [::Google::Cloud::Support::V2beta::ListCasesRequest, ::Hash]
354
+ # A request object representing the call parameters. Required. To specify no
355
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
356
+ # @param options [::Gapic::CallOptions, ::Hash]
357
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
358
+ #
359
+ # @overload list_cases(parent: nil, filter: nil, page_size: nil, page_token: nil, product_line: nil)
360
+ # Pass arguments to `list_cases` via keyword arguments. Note that at
361
+ # least one keyword argument is required. To specify no parameters, or to keep all
362
+ # the default parameter values, pass an empty Hash as a request object (see above).
363
+ #
364
+ # @param parent [::String]
365
+ # Required. The name of a parent to list cases under.
366
+ # @param filter [::String]
367
+ # An expression used to filter cases.
368
+ #
369
+ # If it's an empty string, then no filtering happens. Otherwise, the endpoint
370
+ # returns the cases that match the filter.
371
+ #
372
+ # Expressions use the following fields separated by `AND` and specified with
373
+ # `=`:
374
+ #
375
+ # - `state`: Can be `OPEN` or `CLOSED`.
376
+ # - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
377
+ # can specify multiple values for priority using the `OR` operator. For
378
+ # example, `priority=P1 OR priority=P2`.
379
+ # - `creator.email`: The email address of the case creator.
380
+ #
381
+ # EXAMPLES:
382
+ #
383
+ # - `state=CLOSED`
384
+ # - `state=OPEN AND creator.email="tester@example.com"`
385
+ # - `state=OPEN AND (priority=P0 OR priority=P1)`
386
+ # @param page_size [::Integer]
387
+ # The maximum number of cases fetched with each request. Defaults to 10.
388
+ # @param page_token [::String]
389
+ # A token identifying the page of results to return. If unspecified, the
390
+ # first page is retrieved.
391
+ # @param product_line [::Google::Cloud::Support::V2beta::ProductLine]
392
+ # The product line to request cases for. If unspecified, only
393
+ # Google Cloud cases will be returned.
394
+ # @yield [result, operation] Access the result along with the TransportOperation object
395
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::Case>]
396
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
397
+ #
398
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::Case>]
399
+ #
400
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
401
+ #
402
+ # @example Basic example
403
+ # require "google/cloud/support/v2beta"
404
+ #
405
+ # # Create a client object. The client can be reused for multiple calls.
406
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
407
+ #
408
+ # # Create a request. To set request fields, pass in keyword arguments.
409
+ # request = Google::Cloud::Support::V2beta::ListCasesRequest.new
410
+ #
411
+ # # Call the list_cases method.
412
+ # result = client.list_cases request
413
+ #
414
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
415
+ # # over elements, and API calls will be issued to fetch pages as needed.
416
+ # result.each do |item|
417
+ # # Each element is of type ::Google::Cloud::Support::V2beta::Case.
418
+ # p item
419
+ # end
420
+ #
421
+ def list_cases request, options = nil
422
+ raise ::ArgumentError, "request must be provided" if request.nil?
423
+
424
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::ListCasesRequest
425
+
426
+ # Converts hash and nil to an options object
427
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
428
+
429
+ # Customize the options with defaults
430
+ call_metadata = @config.rpcs.list_cases.metadata.to_h
431
+
432
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
433
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
434
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
435
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
436
+ transports_version_send: [:rest]
437
+
438
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
439
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
440
+
441
+ options.apply_defaults timeout: @config.rpcs.list_cases.timeout,
442
+ metadata: call_metadata,
443
+ retry_policy: @config.rpcs.list_cases.retry_policy
444
+
445
+ options.apply_defaults timeout: @config.timeout,
446
+ metadata: @config.metadata,
447
+ retry_policy: @config.retry_policy
448
+
449
+ @case_service_stub.list_cases request, options do |result, operation|
450
+ result = ::Gapic::Rest::PagedEnumerable.new @case_service_stub, :list_cases, "cases", request, result, options
451
+ yield result, operation if block_given?
452
+ throw :response, result
453
+ end
454
+ rescue ::Gapic::Rest::Error => e
455
+ raise ::Google::Cloud::Error.from_error(e)
456
+ end
457
+
458
+ ##
459
+ # Search for cases using a query.
460
+ #
461
+ # EXAMPLES:
462
+ #
463
+ # cURL:
464
+ #
465
+ # ```shell
466
+ # parent="projects/some-project"
467
+ # curl \
468
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
469
+ # "https://cloudsupport.googleapis.com/v2/$parent/cases:search"
470
+ # ```
471
+ #
472
+ # Python:
473
+ #
474
+ # ```python
475
+ # import googleapiclient.discovery
476
+ #
477
+ # api_version = "v2"
478
+ # supportApiService = googleapiclient.discovery.build(
479
+ # serviceName="cloudsupport",
480
+ # version=api_version,
481
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
482
+ # )
483
+ # request = supportApiService.cases().search(
484
+ # parent="projects/some-project", query="state=OPEN"
485
+ # )
486
+ # print(request.execute())
487
+ # ```
488
+ #
489
+ # @overload search_cases(request, options = nil)
490
+ # Pass arguments to `search_cases` via a request object, either of type
491
+ # {::Google::Cloud::Support::V2beta::SearchCasesRequest} or an equivalent Hash.
492
+ #
493
+ # @param request [::Google::Cloud::Support::V2beta::SearchCasesRequest, ::Hash]
494
+ # A request object representing the call parameters. Required. To specify no
495
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
496
+ # @param options [::Gapic::CallOptions, ::Hash]
497
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
498
+ #
499
+ # @overload search_cases(parent: nil, query: nil, page_size: nil, page_token: nil)
500
+ # Pass arguments to `search_cases` via keyword arguments. Note that at
501
+ # least one keyword argument is required. To specify no parameters, or to keep all
502
+ # the default parameter values, pass an empty Hash as a request object (see above).
503
+ #
504
+ # @param parent [::String]
505
+ # The name of the parent resource to search for cases under.
506
+ # @param query [::String]
507
+ # An expression used to filter cases.
508
+ #
509
+ # Expressions use the following fields separated by `AND` and specified with
510
+ # `=`:
511
+ #
512
+ # - `organization`: An organization name in the form
513
+ # `organizations/<organization_id>`.
514
+ # - `project`: A project name in the form `projects/<project_id>`.
515
+ # - `state`: Can be `OPEN` or `CLOSED`.
516
+ # - `priority`: Can be `P0`, `P1`, `P2`, `P3`, or `P4`. You
517
+ # can specify multiple values for priority using the `OR` operator. For
518
+ # example, `priority=P1 OR priority=P2`.
519
+ # - `creator.email`: The email address of the case creator.
520
+ #
521
+ # You must specify either `organization` or `project`.
522
+ #
523
+ # To search across `displayName`, `description`, and comments, use a global
524
+ # restriction with no keyword or operator. For example, `"my search"`.
525
+ #
526
+ # To search only cases updated after a certain date, use `update_time`
527
+ # restricted with that particular date, time, and timezone in ISO datetime
528
+ # format. For example, `update_time>"2020-01-01T00:00:00-05:00"`.
529
+ # `update_time` only supports the greater than operator (`>`).
530
+ #
531
+ # Examples:
532
+ #
533
+ # - `organization="organizations/123456789"`
534
+ # - `project="projects/my-project-id"`
535
+ # - `project="projects/123456789"`
536
+ # - `organization="organizations/123456789" AND state=CLOSED`
537
+ # - `project="projects/my-project-id" AND creator.email="tester@example.com"`
538
+ # - `project="projects/my-project-id" AND (priority=P0 OR priority=P1)`
539
+ # @param page_size [::Integer]
540
+ # The maximum number of cases fetched with each request. The default page
541
+ # size is 10.
542
+ # @param page_token [::String]
543
+ # A token identifying the page of results to return. If unspecified, the
544
+ # first page is retrieved.
545
+ # @yield [result, operation] Access the result along with the TransportOperation object
546
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::Case>]
547
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
548
+ #
549
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::Case>]
550
+ #
551
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
552
+ #
553
+ # @example Basic example
554
+ # require "google/cloud/support/v2beta"
555
+ #
556
+ # # Create a client object. The client can be reused for multiple calls.
557
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
558
+ #
559
+ # # Create a request. To set request fields, pass in keyword arguments.
560
+ # request = Google::Cloud::Support::V2beta::SearchCasesRequest.new
561
+ #
562
+ # # Call the search_cases method.
563
+ # result = client.search_cases request
564
+ #
565
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
566
+ # # over elements, and API calls will be issued to fetch pages as needed.
567
+ # result.each do |item|
568
+ # # Each element is of type ::Google::Cloud::Support::V2beta::Case.
569
+ # p item
570
+ # end
571
+ #
572
+ def search_cases request, options = nil
573
+ raise ::ArgumentError, "request must be provided" if request.nil?
574
+
575
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::SearchCasesRequest
576
+
577
+ # Converts hash and nil to an options object
578
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
579
+
580
+ # Customize the options with defaults
581
+ call_metadata = @config.rpcs.search_cases.metadata.to_h
582
+
583
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
584
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
585
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
586
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
587
+ transports_version_send: [:rest]
588
+
589
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
590
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
591
+
592
+ options.apply_defaults timeout: @config.rpcs.search_cases.timeout,
593
+ metadata: call_metadata,
594
+ retry_policy: @config.rpcs.search_cases.retry_policy
595
+
596
+ options.apply_defaults timeout: @config.timeout,
597
+ metadata: @config.metadata,
598
+ retry_policy: @config.retry_policy
599
+
600
+ @case_service_stub.search_cases request, options do |result, operation|
601
+ result = ::Gapic::Rest::PagedEnumerable.new @case_service_stub, :search_cases, "cases", request, result, options
602
+ yield result, operation if block_given?
603
+ throw :response, result
604
+ end
605
+ rescue ::Gapic::Rest::Error => e
606
+ raise ::Google::Cloud::Error.from_error(e)
607
+ end
608
+
609
+ ##
610
+ # Create a new case and associate it with a parent.
611
+ #
612
+ # It must have the following fields set: `display_name`, `description`,
613
+ # `classification`, and `priority`. If you're just testing the API and don't
614
+ # want to route your case to an agent, set `testCase=true`.
615
+ #
616
+ # EXAMPLES:
617
+ #
618
+ # cURL:
619
+ #
620
+ # ```shell
621
+ # parent="projects/some-project"
622
+ # curl \
623
+ # --request POST \
624
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
625
+ # --header 'Content-Type: application/json' \
626
+ # --data '{
627
+ # "display_name": "Test case created by me.",
628
+ # "description": "a random test case, feel free to close",
629
+ # "classification": {
630
+ # "id":
631
+ # "100IK2AKCLHMGRJ9CDGMOCGP8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN6NPI64R3CDHN8880G08I1H3MURR7DHII0GRCDTQM8"
632
+ # },
633
+ # "time_zone": "-07:00",
634
+ # "subscriber_email_addresses": [
635
+ # "foo@domain.com",
636
+ # "bar@domain.com"
637
+ # ],
638
+ # "testCase": true,
639
+ # "priority": "P3"
640
+ # }' \
641
+ # "https://cloudsupport.googleapis.com/v2/$parent/cases"
642
+ # ```
643
+ #
644
+ # Python:
645
+ #
646
+ # ```python
647
+ # import googleapiclient.discovery
648
+ #
649
+ # api_version = "v2"
650
+ # supportApiService = googleapiclient.discovery.build(
651
+ # serviceName="cloudsupport",
652
+ # version=api_version,
653
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
654
+ # )
655
+ # request = supportApiService.cases().create(
656
+ # parent="projects/some-project",
657
+ # body={
658
+ # "displayName": "A Test Case",
659
+ # "description": "This is a test case.",
660
+ # "testCase": True,
661
+ # "priority": "P2",
662
+ # "classification": {
663
+ # "id":
664
+ # "100IK2AKCLHMGRJ9CDGMOCGP8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN6NPI64R3CDHN8880G08I1H3MURR7DHII0GRCDTQM8"
665
+ # },
666
+ # },
667
+ # )
668
+ # print(request.execute())
669
+ # ```
670
+ #
671
+ # @overload create_case(request, options = nil)
672
+ # Pass arguments to `create_case` via a request object, either of type
673
+ # {::Google::Cloud::Support::V2beta::CreateCaseRequest} or an equivalent Hash.
674
+ #
675
+ # @param request [::Google::Cloud::Support::V2beta::CreateCaseRequest, ::Hash]
676
+ # A request object representing the call parameters. Required. To specify no
677
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
678
+ # @param options [::Gapic::CallOptions, ::Hash]
679
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
680
+ #
681
+ # @overload create_case(parent: nil, case: nil)
682
+ # Pass arguments to `create_case` via keyword arguments. Note that at
683
+ # least one keyword argument is required. To specify no parameters, or to keep all
684
+ # the default parameter values, pass an empty Hash as a request object (see above).
685
+ #
686
+ # @param parent [::String]
687
+ # Required. The name of the parent under which the case should be created.
688
+ # @param case [::Google::Cloud::Support::V2beta::Case, ::Hash]
689
+ # Required. The case to be created.
690
+ # @yield [result, operation] Access the result along with the TransportOperation object
691
+ # @yieldparam result [::Google::Cloud::Support::V2beta::Case]
692
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
693
+ #
694
+ # @return [::Google::Cloud::Support::V2beta::Case]
695
+ #
696
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
697
+ #
698
+ # @example Basic example
699
+ # require "google/cloud/support/v2beta"
700
+ #
701
+ # # Create a client object. The client can be reused for multiple calls.
702
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
703
+ #
704
+ # # Create a request. To set request fields, pass in keyword arguments.
705
+ # request = Google::Cloud::Support::V2beta::CreateCaseRequest.new
706
+ #
707
+ # # Call the create_case method.
708
+ # result = client.create_case request
709
+ #
710
+ # # The returned object is of type Google::Cloud::Support::V2beta::Case.
711
+ # p result
712
+ #
713
+ def create_case request, options = nil
714
+ raise ::ArgumentError, "request must be provided" if request.nil?
715
+
716
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::CreateCaseRequest
717
+
718
+ # Converts hash and nil to an options object
719
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
720
+
721
+ # Customize the options with defaults
722
+ call_metadata = @config.rpcs.create_case.metadata.to_h
723
+
724
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
725
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
726
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
727
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
728
+ transports_version_send: [:rest]
729
+
730
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
731
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
732
+
733
+ options.apply_defaults timeout: @config.rpcs.create_case.timeout,
734
+ metadata: call_metadata,
735
+ retry_policy: @config.rpcs.create_case.retry_policy
736
+
737
+ options.apply_defaults timeout: @config.timeout,
738
+ metadata: @config.metadata,
739
+ retry_policy: @config.retry_policy
740
+
741
+ @case_service_stub.create_case request, options do |result, operation|
742
+ yield result, operation if block_given?
743
+ end
744
+ rescue ::Gapic::Rest::Error => e
745
+ raise ::Google::Cloud::Error.from_error(e)
746
+ end
747
+
748
+ ##
749
+ # Update a case. Only some fields can be updated.
750
+ #
751
+ # EXAMPLES:
752
+ #
753
+ # cURL:
754
+ #
755
+ # ```shell
756
+ # case="projects/some-project/cases/43595344"
757
+ # curl \
758
+ # --request PATCH \
759
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
760
+ # --header "Content-Type: application/json" \
761
+ # --data '{
762
+ # "priority": "P1"
763
+ # }' \
764
+ # "https://cloudsupport.googleapis.com/v2/$case?updateMask=priority"
765
+ # ```
766
+ #
767
+ # Python:
768
+ #
769
+ # ```python
770
+ # import googleapiclient.discovery
771
+ #
772
+ # api_version = "v2"
773
+ # supportApiService = googleapiclient.discovery.build(
774
+ # serviceName="cloudsupport",
775
+ # version=api_version,
776
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
777
+ # )
778
+ # request = supportApiService.cases().patch(
779
+ # name="projects/some-project/cases/43112854",
780
+ # body={
781
+ # "displayName": "This is Now a New Title",
782
+ # "priority": "P2",
783
+ # },
784
+ # )
785
+ # print(request.execute())
786
+ # ```
787
+ #
788
+ # @overload update_case(request, options = nil)
789
+ # Pass arguments to `update_case` via a request object, either of type
790
+ # {::Google::Cloud::Support::V2beta::UpdateCaseRequest} or an equivalent Hash.
791
+ #
792
+ # @param request [::Google::Cloud::Support::V2beta::UpdateCaseRequest, ::Hash]
793
+ # A request object representing the call parameters. Required. To specify no
794
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
795
+ # @param options [::Gapic::CallOptions, ::Hash]
796
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
797
+ #
798
+ # @overload update_case(case: nil, update_mask: nil)
799
+ # Pass arguments to `update_case` via keyword arguments. Note that at
800
+ # least one keyword argument is required. To specify no parameters, or to keep all
801
+ # the default parameter values, pass an empty Hash as a request object (see above).
802
+ #
803
+ # @param case [::Google::Cloud::Support::V2beta::Case, ::Hash]
804
+ # Required. The case to update.
805
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
806
+ # A list of attributes of the case that should be updated. Supported values
807
+ # are `priority`, `display_name`, and `subscriber_email_addresses`. If no
808
+ # fields are specified, all supported fields are updated.
809
+ #
810
+ # Be careful - if you do not provide a field mask, then you might
811
+ # accidentally clear some fields. For example, if you leave the field mask
812
+ # empty and do not provide a value for `subscriber_email_addresses`, then
813
+ # `subscriber_email_addresses` is updated to empty.
814
+ # @yield [result, operation] Access the result along with the TransportOperation object
815
+ # @yieldparam result [::Google::Cloud::Support::V2beta::Case]
816
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
817
+ #
818
+ # @return [::Google::Cloud::Support::V2beta::Case]
819
+ #
820
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
821
+ #
822
+ # @example Basic example
823
+ # require "google/cloud/support/v2beta"
824
+ #
825
+ # # Create a client object. The client can be reused for multiple calls.
826
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
827
+ #
828
+ # # Create a request. To set request fields, pass in keyword arguments.
829
+ # request = Google::Cloud::Support::V2beta::UpdateCaseRequest.new
830
+ #
831
+ # # Call the update_case method.
832
+ # result = client.update_case request
833
+ #
834
+ # # The returned object is of type Google::Cloud::Support::V2beta::Case.
835
+ # p result
836
+ #
837
+ def update_case request, options = nil
838
+ raise ::ArgumentError, "request must be provided" if request.nil?
839
+
840
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::UpdateCaseRequest
841
+
842
+ # Converts hash and nil to an options object
843
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
844
+
845
+ # Customize the options with defaults
846
+ call_metadata = @config.rpcs.update_case.metadata.to_h
847
+
848
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
849
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
850
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
851
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
852
+ transports_version_send: [:rest]
853
+
854
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
855
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
856
+
857
+ options.apply_defaults timeout: @config.rpcs.update_case.timeout,
858
+ metadata: call_metadata,
859
+ retry_policy: @config.rpcs.update_case.retry_policy
860
+
861
+ options.apply_defaults timeout: @config.timeout,
862
+ metadata: @config.metadata,
863
+ retry_policy: @config.retry_policy
864
+
865
+ @case_service_stub.update_case request, options do |result, operation|
866
+ yield result, operation if block_given?
867
+ end
868
+ rescue ::Gapic::Rest::Error => e
869
+ raise ::Google::Cloud::Error.from_error(e)
870
+ end
871
+
872
+ ##
873
+ # Escalate a case, starting the Google Cloud Support escalation management
874
+ # process.
875
+ #
876
+ # This operation is only available for some support services. Go to
877
+ # https://cloud.google.com/support and look for 'Technical support
878
+ # escalations' in the feature list to find out which ones let you
879
+ # do that.
880
+ #
881
+ # EXAMPLES:
882
+ #
883
+ # cURL:
884
+ #
885
+ # ```shell
886
+ # case="projects/some-project/cases/43595344"
887
+ # curl \
888
+ # --request POST \
889
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
890
+ # --header "Content-Type: application/json" \
891
+ # --data '{
892
+ # "escalation": {
893
+ # "reason": "BUSINESS_IMPACT",
894
+ # "justification": "This is a test escalation."
895
+ # }
896
+ # }' \
897
+ # "https://cloudsupport.googleapis.com/v2/$case:escalate"
898
+ # ```
899
+ #
900
+ # Python:
901
+ #
902
+ # ```python
903
+ # import googleapiclient.discovery
904
+ #
905
+ # api_version = "v2"
906
+ # supportApiService = googleapiclient.discovery.build(
907
+ # serviceName="cloudsupport",
908
+ # version=api_version,
909
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
910
+ # )
911
+ # request = supportApiService.cases().escalate(
912
+ # name="projects/some-project/cases/43595344",
913
+ # body={
914
+ # "escalation": {
915
+ # "reason": "BUSINESS_IMPACT",
916
+ # "justification": "This is a test escalation.",
917
+ # },
918
+ # },
919
+ # )
920
+ # print(request.execute())
921
+ # ```
922
+ #
923
+ # @overload escalate_case(request, options = nil)
924
+ # Pass arguments to `escalate_case` via a request object, either of type
925
+ # {::Google::Cloud::Support::V2beta::EscalateCaseRequest} or an equivalent Hash.
926
+ #
927
+ # @param request [::Google::Cloud::Support::V2beta::EscalateCaseRequest, ::Hash]
928
+ # A request object representing the call parameters. Required. To specify no
929
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
930
+ # @param options [::Gapic::CallOptions, ::Hash]
931
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
932
+ #
933
+ # @overload escalate_case(name: nil, escalation: nil)
934
+ # Pass arguments to `escalate_case` via keyword arguments. Note that at
935
+ # least one keyword argument is required. To specify no parameters, or to keep all
936
+ # the default parameter values, pass an empty Hash as a request object (see above).
937
+ #
938
+ # @param name [::String]
939
+ # Required. The name of the case to be escalated.
940
+ # @param escalation [::Google::Cloud::Support::V2beta::Escalation, ::Hash]
941
+ # The escalation information to be sent with the escalation request.
942
+ # @yield [result, operation] Access the result along with the TransportOperation object
943
+ # @yieldparam result [::Google::Cloud::Support::V2beta::Case]
944
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
945
+ #
946
+ # @return [::Google::Cloud::Support::V2beta::Case]
947
+ #
948
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
949
+ #
950
+ # @example Basic example
951
+ # require "google/cloud/support/v2beta"
952
+ #
953
+ # # Create a client object. The client can be reused for multiple calls.
954
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
955
+ #
956
+ # # Create a request. To set request fields, pass in keyword arguments.
957
+ # request = Google::Cloud::Support::V2beta::EscalateCaseRequest.new
958
+ #
959
+ # # Call the escalate_case method.
960
+ # result = client.escalate_case request
961
+ #
962
+ # # The returned object is of type Google::Cloud::Support::V2beta::Case.
963
+ # p result
964
+ #
965
+ def escalate_case request, options = nil
966
+ raise ::ArgumentError, "request must be provided" if request.nil?
967
+
968
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::EscalateCaseRequest
969
+
970
+ # Converts hash and nil to an options object
971
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
972
+
973
+ # Customize the options with defaults
974
+ call_metadata = @config.rpcs.escalate_case.metadata.to_h
975
+
976
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
977
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
978
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
979
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
980
+ transports_version_send: [:rest]
981
+
982
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
983
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
984
+
985
+ options.apply_defaults timeout: @config.rpcs.escalate_case.timeout,
986
+ metadata: call_metadata,
987
+ retry_policy: @config.rpcs.escalate_case.retry_policy
988
+
989
+ options.apply_defaults timeout: @config.timeout,
990
+ metadata: @config.metadata,
991
+ retry_policy: @config.retry_policy
992
+
993
+ @case_service_stub.escalate_case request, options do |result, operation|
994
+ yield result, operation if block_given?
995
+ end
996
+ rescue ::Gapic::Rest::Error => e
997
+ raise ::Google::Cloud::Error.from_error(e)
998
+ end
999
+
1000
+ ##
1001
+ # Close a case.
1002
+ #
1003
+ # EXAMPLES:
1004
+ #
1005
+ # cURL:
1006
+ #
1007
+ # ```shell
1008
+ # case="projects/some-project/cases/43595344"
1009
+ # curl \
1010
+ # --request POST \
1011
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
1012
+ # "https://cloudsupport.googleapis.com/v2/$case:close"
1013
+ # ```
1014
+ #
1015
+ # Python:
1016
+ #
1017
+ # ```python
1018
+ # import googleapiclient.discovery
1019
+ #
1020
+ # api_version = "v2"
1021
+ # supportApiService = googleapiclient.discovery.build(
1022
+ # serviceName="cloudsupport",
1023
+ # version=api_version,
1024
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
1025
+ # )
1026
+ # request = supportApiService.cases().close(
1027
+ # name="projects/some-project/cases/43595344"
1028
+ # )
1029
+ # print(request.execute())
1030
+ # ```
1031
+ #
1032
+ # @overload close_case(request, options = nil)
1033
+ # Pass arguments to `close_case` via a request object, either of type
1034
+ # {::Google::Cloud::Support::V2beta::CloseCaseRequest} or an equivalent Hash.
1035
+ #
1036
+ # @param request [::Google::Cloud::Support::V2beta::CloseCaseRequest, ::Hash]
1037
+ # A request object representing the call parameters. Required. To specify no
1038
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1039
+ # @param options [::Gapic::CallOptions, ::Hash]
1040
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1041
+ #
1042
+ # @overload close_case(name: nil)
1043
+ # Pass arguments to `close_case` via keyword arguments. Note that at
1044
+ # least one keyword argument is required. To specify no parameters, or to keep all
1045
+ # the default parameter values, pass an empty Hash as a request object (see above).
1046
+ #
1047
+ # @param name [::String]
1048
+ # Required. The name of the case to close.
1049
+ # @yield [result, operation] Access the result along with the TransportOperation object
1050
+ # @yieldparam result [::Google::Cloud::Support::V2beta::Case]
1051
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1052
+ #
1053
+ # @return [::Google::Cloud::Support::V2beta::Case]
1054
+ #
1055
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1056
+ #
1057
+ # @example Basic example
1058
+ # require "google/cloud/support/v2beta"
1059
+ #
1060
+ # # Create a client object. The client can be reused for multiple calls.
1061
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
1062
+ #
1063
+ # # Create a request. To set request fields, pass in keyword arguments.
1064
+ # request = Google::Cloud::Support::V2beta::CloseCaseRequest.new
1065
+ #
1066
+ # # Call the close_case method.
1067
+ # result = client.close_case request
1068
+ #
1069
+ # # The returned object is of type Google::Cloud::Support::V2beta::Case.
1070
+ # p result
1071
+ #
1072
+ def close_case request, options = nil
1073
+ raise ::ArgumentError, "request must be provided" if request.nil?
1074
+
1075
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::CloseCaseRequest
1076
+
1077
+ # Converts hash and nil to an options object
1078
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1079
+
1080
+ # Customize the options with defaults
1081
+ call_metadata = @config.rpcs.close_case.metadata.to_h
1082
+
1083
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1084
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1085
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1086
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
1087
+ transports_version_send: [:rest]
1088
+
1089
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1090
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1091
+
1092
+ options.apply_defaults timeout: @config.rpcs.close_case.timeout,
1093
+ metadata: call_metadata,
1094
+ retry_policy: @config.rpcs.close_case.retry_policy
1095
+
1096
+ options.apply_defaults timeout: @config.timeout,
1097
+ metadata: @config.metadata,
1098
+ retry_policy: @config.retry_policy
1099
+
1100
+ @case_service_stub.close_case request, options do |result, operation|
1101
+ yield result, operation if block_given?
1102
+ end
1103
+ rescue ::Gapic::Rest::Error => e
1104
+ raise ::Google::Cloud::Error.from_error(e)
1105
+ end
1106
+
1107
+ ##
1108
+ # Retrieve valid classifications to use when creating a support case.
1109
+ #
1110
+ # Classifications are hierarchical. Each classification is a string
1111
+ # containing all levels of the hierarchy separated by `" > "`. For example,
1112
+ # `"Technical Issue > Compute > Compute Engine"`.
1113
+ #
1114
+ # Classification IDs returned by this endpoint are valid for at least six
1115
+ # months. When a classification is deactivated, this endpoint immediately
1116
+ # stops returning it. After six months, `case.create` requests using the
1117
+ # classification will fail.
1118
+ #
1119
+ # EXAMPLES:
1120
+ #
1121
+ # cURL:
1122
+ #
1123
+ # ```shell
1124
+ # curl \
1125
+ # --header "Authorization: Bearer $(gcloud auth print-access-token)" \
1126
+ # 'https://cloudsupport.googleapis.com/v2/caseClassifications:search?query=display_name:"*Compute%20Engine*"'
1127
+ # ```
1128
+ #
1129
+ # Python:
1130
+ #
1131
+ # ```python
1132
+ # import googleapiclient.discovery
1133
+ #
1134
+ # supportApiService = googleapiclient.discovery.build(
1135
+ # serviceName="cloudsupport",
1136
+ # version="v2",
1137
+ # discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=v2",
1138
+ # )
1139
+ # request = supportApiService.caseClassifications().search(
1140
+ # query='display_name:"*Compute Engine*"'
1141
+ # )
1142
+ # print(request.execute())
1143
+ # ```
1144
+ #
1145
+ # @overload search_case_classifications(request, options = nil)
1146
+ # Pass arguments to `search_case_classifications` via a request object, either of type
1147
+ # {::Google::Cloud::Support::V2beta::SearchCaseClassificationsRequest} or an equivalent Hash.
1148
+ #
1149
+ # @param request [::Google::Cloud::Support::V2beta::SearchCaseClassificationsRequest, ::Hash]
1150
+ # A request object representing the call parameters. Required. To specify no
1151
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1152
+ # @param options [::Gapic::CallOptions, ::Hash]
1153
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1154
+ #
1155
+ # @overload search_case_classifications(query: nil, page_size: nil, page_token: nil, product: nil)
1156
+ # Pass arguments to `search_case_classifications` via keyword arguments. Note that at
1157
+ # least one keyword argument is required. To specify no parameters, or to keep all
1158
+ # the default parameter values, pass an empty Hash as a request object (see above).
1159
+ #
1160
+ # @param query [::String]
1161
+ # An expression used to filter case classifications.
1162
+ #
1163
+ # If it's an empty string, then no filtering happens. Otherwise, case
1164
+ # classifications will be returned that match the filter.
1165
+ # @param page_size [::Integer]
1166
+ # The maximum number of classifications fetched with each request.
1167
+ # @param page_token [::String]
1168
+ # A token identifying the page of results to return. If unspecified, the
1169
+ # first page is retrieved.
1170
+ # @param product [::Google::Cloud::Support::V2beta::Product, ::Hash]
1171
+ # Optional. The product to return case classifications for.
1172
+ # @yield [result, operation] Access the result along with the TransportOperation object
1173
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::CaseClassification>]
1174
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1175
+ #
1176
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::CaseClassification>]
1177
+ #
1178
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1179
+ #
1180
+ # @example Basic example
1181
+ # require "google/cloud/support/v2beta"
1182
+ #
1183
+ # # Create a client object. The client can be reused for multiple calls.
1184
+ # client = Google::Cloud::Support::V2beta::CaseService::Rest::Client.new
1185
+ #
1186
+ # # Create a request. To set request fields, pass in keyword arguments.
1187
+ # request = Google::Cloud::Support::V2beta::SearchCaseClassificationsRequest.new
1188
+ #
1189
+ # # Call the search_case_classifications method.
1190
+ # result = client.search_case_classifications request
1191
+ #
1192
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1193
+ # # over elements, and API calls will be issued to fetch pages as needed.
1194
+ # result.each do |item|
1195
+ # # Each element is of type ::Google::Cloud::Support::V2beta::CaseClassification.
1196
+ # p item
1197
+ # end
1198
+ #
1199
+ def search_case_classifications request, options = nil
1200
+ raise ::ArgumentError, "request must be provided" if request.nil?
1201
+
1202
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::SearchCaseClassificationsRequest
1203
+
1204
+ # Converts hash and nil to an options object
1205
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1206
+
1207
+ # Customize the options with defaults
1208
+ call_metadata = @config.rpcs.search_case_classifications.metadata.to_h
1209
+
1210
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1211
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1212
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1213
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
1214
+ transports_version_send: [:rest]
1215
+
1216
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1217
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1218
+
1219
+ options.apply_defaults timeout: @config.rpcs.search_case_classifications.timeout,
1220
+ metadata: call_metadata,
1221
+ retry_policy: @config.rpcs.search_case_classifications.retry_policy
1222
+
1223
+ options.apply_defaults timeout: @config.timeout,
1224
+ metadata: @config.metadata,
1225
+ retry_policy: @config.retry_policy
1226
+
1227
+ @case_service_stub.search_case_classifications request, options do |result, operation|
1228
+ result = ::Gapic::Rest::PagedEnumerable.new @case_service_stub, :search_case_classifications, "case_classifications", request, result, options
1229
+ yield result, operation if block_given?
1230
+ throw :response, result
1231
+ end
1232
+ rescue ::Gapic::Rest::Error => e
1233
+ raise ::Google::Cloud::Error.from_error(e)
1234
+ end
1235
+
1236
+ ##
1237
+ # Configuration class for the CaseService REST API.
1238
+ #
1239
+ # This class represents the configuration for CaseService REST,
1240
+ # providing control over timeouts, retry behavior, logging, transport
1241
+ # parameters, and other low-level controls. Certain parameters can also be
1242
+ # applied individually to specific RPCs. See
1243
+ # {::Google::Cloud::Support::V2beta::CaseService::Rest::Client::Configuration::Rpcs}
1244
+ # for a list of RPCs that can be configured independently.
1245
+ #
1246
+ # Configuration can be applied globally to all clients, or to a single client
1247
+ # on construction.
1248
+ #
1249
+ # @example
1250
+ #
1251
+ # # Modify the global config, setting the timeout for
1252
+ # # get_case to 20 seconds,
1253
+ # # and all remaining timeouts to 10 seconds.
1254
+ # ::Google::Cloud::Support::V2beta::CaseService::Rest::Client.configure do |config|
1255
+ # config.timeout = 10.0
1256
+ # config.rpcs.get_case.timeout = 20.0
1257
+ # end
1258
+ #
1259
+ # # Apply the above configuration only to a new client.
1260
+ # client = ::Google::Cloud::Support::V2beta::CaseService::Rest::Client.new do |config|
1261
+ # config.timeout = 10.0
1262
+ # config.rpcs.get_case.timeout = 20.0
1263
+ # end
1264
+ #
1265
+ # @!attribute [rw] endpoint
1266
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1267
+ # nil, indicating to use the default endpoint in the current universe domain.
1268
+ # @return [::String,nil]
1269
+ # @!attribute [rw] credentials
1270
+ # Credentials to send with calls. You may provide any of the following types:
1271
+ # * (`String`) The path to a service account key file in JSON format
1272
+ # * (`Hash`) A service account key as a Hash
1273
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1274
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1275
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1276
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1277
+ # * (`nil`) indicating no credentials
1278
+ #
1279
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1280
+ # external source for authentication to Google Cloud, you must validate it before
1281
+ # providing it to a Google API client library. Providing an unvalidated credential
1282
+ # configuration to Google APIs can compromise the security of your systems and data.
1283
+ # For more information, refer to [Validate credential configurations from external
1284
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1285
+ # @return [::Object]
1286
+ # @!attribute [rw] scope
1287
+ # The OAuth scopes
1288
+ # @return [::Array<::String>]
1289
+ # @!attribute [rw] lib_name
1290
+ # The library name as recorded in instrumentation and logging
1291
+ # @return [::String]
1292
+ # @!attribute [rw] lib_version
1293
+ # The library version as recorded in instrumentation and logging
1294
+ # @return [::String]
1295
+ # @!attribute [rw] timeout
1296
+ # The call timeout in seconds.
1297
+ # @return [::Numeric]
1298
+ # @!attribute [rw] metadata
1299
+ # Additional headers to be sent with the call.
1300
+ # @return [::Hash{::Symbol=>::String}]
1301
+ # @!attribute [rw] retry_policy
1302
+ # The retry policy. The value is a hash with the following keys:
1303
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1304
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1305
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1306
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1307
+ # trigger a retry.
1308
+ # @return [::Hash]
1309
+ # @!attribute [rw] quota_project
1310
+ # A separate project against which to charge quota.
1311
+ # @return [::String]
1312
+ # @!attribute [rw] universe_domain
1313
+ # The universe domain within which to make requests. This determines the
1314
+ # default endpoint URL. The default value of nil uses the environment
1315
+ # universe (usually the default "googleapis.com" universe).
1316
+ # @return [::String,nil]
1317
+ # @!attribute [rw] logger
1318
+ # A custom logger to use for request/response debug logging, or the value
1319
+ # `:default` (the default) to construct a default logger, or `nil` to
1320
+ # explicitly disable logging.
1321
+ # @return [::Logger,:default,nil]
1322
+ #
1323
+ class Configuration
1324
+ extend ::Gapic::Config
1325
+
1326
+ # @private
1327
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1328
+ DEFAULT_ENDPOINT = "cloudsupport.googleapis.com"
1329
+
1330
+ config_attr :endpoint, nil, ::String, nil
1331
+ config_attr :credentials, nil do |value|
1332
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1333
+ allowed.any? { |klass| klass === value }
1334
+ end
1335
+ config_attr :scope, nil, ::String, ::Array, nil
1336
+ config_attr :lib_name, nil, ::String, nil
1337
+ config_attr :lib_version, nil, ::String, nil
1338
+ config_attr :timeout, nil, ::Numeric, nil
1339
+ config_attr :metadata, nil, ::Hash, nil
1340
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1341
+ config_attr :quota_project, nil, ::String, nil
1342
+ config_attr :universe_domain, nil, ::String, nil
1343
+ config_attr :logger, :default, ::Logger, nil, :default
1344
+
1345
+ # @private
1346
+ def initialize parent_config = nil
1347
+ @parent_config = parent_config unless parent_config.nil?
1348
+
1349
+ yield self if block_given?
1350
+ end
1351
+
1352
+ ##
1353
+ # Configurations for individual RPCs
1354
+ # @return [Rpcs]
1355
+ #
1356
+ def rpcs
1357
+ @rpcs ||= begin
1358
+ parent_rpcs = nil
1359
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1360
+ Rpcs.new parent_rpcs
1361
+ end
1362
+ end
1363
+
1364
+ ##
1365
+ # Configuration RPC class for the CaseService API.
1366
+ #
1367
+ # Includes fields providing the configuration for each RPC in this service.
1368
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1369
+ # the following configuration fields:
1370
+ #
1371
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1372
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1373
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1374
+ # include the following keys:
1375
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1376
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1377
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1378
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1379
+ # trigger a retry.
1380
+ #
1381
+ class Rpcs
1382
+ ##
1383
+ # RPC-specific configuration for `get_case`
1384
+ # @return [::Gapic::Config::Method]
1385
+ #
1386
+ attr_reader :get_case
1387
+ ##
1388
+ # RPC-specific configuration for `list_cases`
1389
+ # @return [::Gapic::Config::Method]
1390
+ #
1391
+ attr_reader :list_cases
1392
+ ##
1393
+ # RPC-specific configuration for `search_cases`
1394
+ # @return [::Gapic::Config::Method]
1395
+ #
1396
+ attr_reader :search_cases
1397
+ ##
1398
+ # RPC-specific configuration for `create_case`
1399
+ # @return [::Gapic::Config::Method]
1400
+ #
1401
+ attr_reader :create_case
1402
+ ##
1403
+ # RPC-specific configuration for `update_case`
1404
+ # @return [::Gapic::Config::Method]
1405
+ #
1406
+ attr_reader :update_case
1407
+ ##
1408
+ # RPC-specific configuration for `escalate_case`
1409
+ # @return [::Gapic::Config::Method]
1410
+ #
1411
+ attr_reader :escalate_case
1412
+ ##
1413
+ # RPC-specific configuration for `close_case`
1414
+ # @return [::Gapic::Config::Method]
1415
+ #
1416
+ attr_reader :close_case
1417
+ ##
1418
+ # RPC-specific configuration for `search_case_classifications`
1419
+ # @return [::Gapic::Config::Method]
1420
+ #
1421
+ attr_reader :search_case_classifications
1422
+
1423
+ # @private
1424
+ def initialize parent_rpcs = nil
1425
+ get_case_config = parent_rpcs.get_case if parent_rpcs.respond_to? :get_case
1426
+ @get_case = ::Gapic::Config::Method.new get_case_config
1427
+ list_cases_config = parent_rpcs.list_cases if parent_rpcs.respond_to? :list_cases
1428
+ @list_cases = ::Gapic::Config::Method.new list_cases_config
1429
+ search_cases_config = parent_rpcs.search_cases if parent_rpcs.respond_to? :search_cases
1430
+ @search_cases = ::Gapic::Config::Method.new search_cases_config
1431
+ create_case_config = parent_rpcs.create_case if parent_rpcs.respond_to? :create_case
1432
+ @create_case = ::Gapic::Config::Method.new create_case_config
1433
+ update_case_config = parent_rpcs.update_case if parent_rpcs.respond_to? :update_case
1434
+ @update_case = ::Gapic::Config::Method.new update_case_config
1435
+ escalate_case_config = parent_rpcs.escalate_case if parent_rpcs.respond_to? :escalate_case
1436
+ @escalate_case = ::Gapic::Config::Method.new escalate_case_config
1437
+ close_case_config = parent_rpcs.close_case if parent_rpcs.respond_to? :close_case
1438
+ @close_case = ::Gapic::Config::Method.new close_case_config
1439
+ search_case_classifications_config = parent_rpcs.search_case_classifications if parent_rpcs.respond_to? :search_case_classifications
1440
+ @search_case_classifications = ::Gapic::Config::Method.new search_case_classifications_config
1441
+
1442
+ yield self if block_given?
1443
+ end
1444
+ end
1445
+ end
1446
+ end
1447
+ end
1448
+ end
1449
+ end
1450
+ end
1451
+ end
1452
+ end