google-cloud-support-v2 0.a → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/support/v2/actor_pb.rb +44 -0
  6. data/lib/google/cloud/support/v2/attachment_pb.rb +49 -0
  7. data/lib/google/cloud/support/v2/attachment_service_pb.rb +50 -0
  8. data/lib/google/cloud/support/v2/attachment_service_services_pb.rb +45 -0
  9. data/lib/google/cloud/support/v2/case_attachment_service/client.rb +416 -0
  10. data/lib/google/cloud/support/v2/case_attachment_service/credentials.rb +47 -0
  11. data/lib/google/cloud/support/v2/case_attachment_service/paths.rb +72 -0
  12. data/lib/google/cloud/support/v2/case_attachment_service.rb +49 -0
  13. data/lib/google/cloud/support/v2/case_pb.rb +52 -0
  14. data/lib/google/cloud/support/v2/case_service/client.rb +1180 -0
  15. data/lib/google/cloud/support/v2/case_service/credentials.rb +47 -0
  16. data/lib/google/cloud/support/v2/case_service/paths.rb +100 -0
  17. data/lib/google/cloud/support/v2/case_service.rb +49 -0
  18. data/lib/google/cloud/support/v2/case_service_pb.rb +63 -0
  19. data/lib/google/cloud/support/v2/case_service_services_pb.rb +75 -0
  20. data/lib/google/cloud/support/v2/comment_pb.rb +49 -0
  21. data/lib/google/cloud/support/v2/comment_service/client.rb +511 -0
  22. data/lib/google/cloud/support/v2/comment_service/credentials.rb +47 -0
  23. data/lib/google/cloud/support/v2/comment_service/paths.rb +115 -0
  24. data/lib/google/cloud/support/v2/comment_service.rb +49 -0
  25. data/lib/google/cloud/support/v2/comment_service_pb.rb +51 -0
  26. data/lib/google/cloud/support/v2/comment_service_services_pb.rb +48 -0
  27. data/lib/google/cloud/support/v2/escalation_pb.rb +45 -0
  28. data/lib/google/cloud/support/v2/version.rb +7 -2
  29. data/lib/google/cloud/support/v2.rb +42 -0
  30. data/lib/google-cloud-support-v2.rb +21 -0
  31. data/proto_docs/README.md +4 -0
  32. data/proto_docs/google/api/client.rb +381 -0
  33. data/proto_docs/google/api/field_behavior.rb +85 -0
  34. data/proto_docs/google/api/launch_stage.rb +71 -0
  35. data/proto_docs/google/api/resource.rb +222 -0
  36. data/proto_docs/google/cloud/support/v2/actor.rb +49 -0
  37. data/proto_docs/google/cloud/support/v2/attachment.rb +51 -0
  38. data/proto_docs/google/cloud/support/v2/attachment_service.rb +59 -0
  39. data/proto_docs/google/cloud/support/v2/case.rb +152 -0
  40. data/proto_docs/google/cloud/support/v2/case_service.rb +240 -0
  41. data/proto_docs/google/cloud/support/v2/comment.rb +49 -0
  42. data/proto_docs/google/cloud/support/v2/comment_service.rb +69 -0
  43. data/proto_docs/google/cloud/support/v2/escalation.rb +55 -0
  44. data/proto_docs/google/protobuf/duration.rb +98 -0
  45. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  46. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  47. metadata +201 -13
@@ -0,0 +1,511 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/v2/comment_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Support
25
+ module V2
26
+ module CommentService
27
+ ##
28
+ # Client for the CommentService service.
29
+ #
30
+ # A service to manage comments on cases.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :comment_service_stub
37
+
38
+ ##
39
+ # Configure the CommentService Client class.
40
+ #
41
+ # See {::Google::Cloud::Support::V2::CommentService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all CommentService clients
47
+ # ::Google::Cloud::Support::V2::CommentService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "Support", "V2"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.rpcs.list_comments.timeout = 60.0
68
+ default_config.rpcs.list_comments.retry_policy = {
69
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config.rpcs.create_comment.timeout = 60.0
73
+
74
+ default_config
75
+ end
76
+ yield @configure if block_given?
77
+ @configure
78
+ end
79
+
80
+ ##
81
+ # Configure the CommentService Client instance.
82
+ #
83
+ # The configuration is set to the derived mode, meaning that values can be changed,
84
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
85
+ # should be made on {Client.configure}.
86
+ #
87
+ # See {::Google::Cloud::Support::V2::CommentService::Client::Configuration}
88
+ # for a description of the configuration fields.
89
+ #
90
+ # @yield [config] Configure the Client client.
91
+ # @yieldparam config [Client::Configuration]
92
+ #
93
+ # @return [Client::Configuration]
94
+ #
95
+ def configure
96
+ yield @config if block_given?
97
+ @config
98
+ end
99
+
100
+ ##
101
+ # Create a new CommentService client object.
102
+ #
103
+ # @example
104
+ #
105
+ # # Create a client using the default configuration
106
+ # client = ::Google::Cloud::Support::V2::CommentService::Client.new
107
+ #
108
+ # # Create a client using a custom configuration
109
+ # client = ::Google::Cloud::Support::V2::CommentService::Client.new do |config|
110
+ # config.timeout = 10.0
111
+ # end
112
+ #
113
+ # @yield [config] Configure the CommentService client.
114
+ # @yieldparam config [Client::Configuration]
115
+ #
116
+ def initialize
117
+ # These require statements are intentionally placed here to initialize
118
+ # the gRPC module only when it's required.
119
+ # See https://github.com/googleapis/toolkit/issues/446
120
+ require "gapic/grpc"
121
+ require "google/cloud/support/v2/comment_service_services_pb"
122
+
123
+ # Create the configuration object
124
+ @config = Configuration.new Client.configure
125
+
126
+ # Yield the configuration if needed
127
+ yield @config if block_given?
128
+
129
+ # Create credentials
130
+ credentials = @config.credentials
131
+ # Use self-signed JWT if the endpoint is unchanged from default,
132
+ # but only if the default endpoint does not have a region prefix.
133
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
134
+ !@config.endpoint.split(".").first.include?("-")
135
+ credentials ||= Credentials.default scope: @config.scope,
136
+ enable_self_signed_jwt: enable_self_signed_jwt
137
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
138
+ credentials = Credentials.new credentials, scope: @config.scope
139
+ end
140
+ @quota_project_id = @config.quota_project
141
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
142
+
143
+ @comment_service_stub = ::Gapic::ServiceStub.new(
144
+ ::Google::Cloud::Support::V2::CommentService::Stub,
145
+ credentials: credentials,
146
+ endpoint: @config.endpoint,
147
+ channel_args: @config.channel_args,
148
+ interceptors: @config.interceptors,
149
+ channel_pool_config: @config.channel_pool
150
+ )
151
+ end
152
+
153
+ # Service calls
154
+
155
+ ##
156
+ # Retrieve all Comments associated with the Case object.
157
+ #
158
+ # @overload list_comments(request, options = nil)
159
+ # Pass arguments to `list_comments` via a request object, either of type
160
+ # {::Google::Cloud::Support::V2::ListCommentsRequest} or an equivalent Hash.
161
+ #
162
+ # @param request [::Google::Cloud::Support::V2::ListCommentsRequest, ::Hash]
163
+ # A request object representing the call parameters. Required. To specify no
164
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
165
+ # @param options [::Gapic::CallOptions, ::Hash]
166
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
167
+ #
168
+ # @overload list_comments(parent: nil, page_size: nil, page_token: nil)
169
+ # Pass arguments to `list_comments` via keyword arguments. Note that at
170
+ # least one keyword argument is required. To specify no parameters, or to keep all
171
+ # the default parameter values, pass an empty Hash as a request object (see above).
172
+ #
173
+ # @param parent [::String]
174
+ # Required. The resource name of Case object for which comments should be
175
+ # listed.
176
+ # @param page_size [::Integer]
177
+ # The maximum number of comments fetched with each request. Defaults to 10.
178
+ # @param page_token [::String]
179
+ # A token identifying the page of results to return. If unspecified, the
180
+ # first page is retrieved.
181
+ #
182
+ # @yield [response, operation] Access the result along with the RPC operation
183
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Support::V2::Comment>]
184
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
185
+ #
186
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Support::V2::Comment>]
187
+ #
188
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
189
+ #
190
+ # @example Basic example
191
+ # require "google/cloud/support/v2"
192
+ #
193
+ # # Create a client object. The client can be reused for multiple calls.
194
+ # client = Google::Cloud::Support::V2::CommentService::Client.new
195
+ #
196
+ # # Create a request. To set request fields, pass in keyword arguments.
197
+ # request = Google::Cloud::Support::V2::ListCommentsRequest.new
198
+ #
199
+ # # Call the list_comments method.
200
+ # result = client.list_comments request
201
+ #
202
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
203
+ # # over elements, and API calls will be issued to fetch pages as needed.
204
+ # result.each do |item|
205
+ # # Each element is of type ::Google::Cloud::Support::V2::Comment.
206
+ # p item
207
+ # end
208
+ #
209
+ def list_comments request, options = nil
210
+ raise ::ArgumentError, "request must be provided" if request.nil?
211
+
212
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2::ListCommentsRequest
213
+
214
+ # Converts hash and nil to an options object
215
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
216
+
217
+ # Customize the options with defaults
218
+ metadata = @config.rpcs.list_comments.metadata.to_h
219
+
220
+ # Set x-goog-api-client and x-goog-user-project headers
221
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
222
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
223
+ gapic_version: ::Google::Cloud::Support::V2::VERSION
224
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
225
+
226
+ header_params = {}
227
+ if request.parent
228
+ header_params["parent"] = request.parent
229
+ end
230
+
231
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
232
+ metadata[:"x-goog-request-params"] ||= request_params_header
233
+
234
+ options.apply_defaults timeout: @config.rpcs.list_comments.timeout,
235
+ metadata: metadata,
236
+ retry_policy: @config.rpcs.list_comments.retry_policy
237
+
238
+ options.apply_defaults timeout: @config.timeout,
239
+ metadata: @config.metadata,
240
+ retry_policy: @config.retry_policy
241
+
242
+ @comment_service_stub.call_rpc :list_comments, request, options: options do |response, operation|
243
+ response = ::Gapic::PagedEnumerable.new @comment_service_stub, :list_comments, request, response, operation, options
244
+ yield response, operation if block_given?
245
+ return response
246
+ end
247
+ rescue ::GRPC::BadStatus => e
248
+ raise ::Google::Cloud::Error.from_error(e)
249
+ end
250
+
251
+ ##
252
+ # Add a new comment to the specified Case.
253
+ # The comment object must have the following fields set: body.
254
+ #
255
+ # @overload create_comment(request, options = nil)
256
+ # Pass arguments to `create_comment` via a request object, either of type
257
+ # {::Google::Cloud::Support::V2::CreateCommentRequest} or an equivalent Hash.
258
+ #
259
+ # @param request [::Google::Cloud::Support::V2::CreateCommentRequest, ::Hash]
260
+ # A request object representing the call parameters. Required. To specify no
261
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
262
+ # @param options [::Gapic::CallOptions, ::Hash]
263
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
264
+ #
265
+ # @overload create_comment(parent: nil, comment: nil)
266
+ # Pass arguments to `create_comment` via keyword arguments. Note that at
267
+ # least one keyword argument is required. To specify no parameters, or to keep all
268
+ # the default parameter values, pass an empty Hash as a request object (see above).
269
+ #
270
+ # @param parent [::String]
271
+ # Required. The resource name of Case to which this comment should be added.
272
+ # @param comment [::Google::Cloud::Support::V2::Comment, ::Hash]
273
+ # Required. The Comment object to be added to this Case.
274
+ #
275
+ # @yield [response, operation] Access the result along with the RPC operation
276
+ # @yieldparam response [::Google::Cloud::Support::V2::Comment]
277
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
278
+ #
279
+ # @return [::Google::Cloud::Support::V2::Comment]
280
+ #
281
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
282
+ #
283
+ # @example Basic example
284
+ # require "google/cloud/support/v2"
285
+ #
286
+ # # Create a client object. The client can be reused for multiple calls.
287
+ # client = Google::Cloud::Support::V2::CommentService::Client.new
288
+ #
289
+ # # Create a request. To set request fields, pass in keyword arguments.
290
+ # request = Google::Cloud::Support::V2::CreateCommentRequest.new
291
+ #
292
+ # # Call the create_comment method.
293
+ # result = client.create_comment request
294
+ #
295
+ # # The returned object is of type Google::Cloud::Support::V2::Comment.
296
+ # p result
297
+ #
298
+ def create_comment request, options = nil
299
+ raise ::ArgumentError, "request must be provided" if request.nil?
300
+
301
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2::CreateCommentRequest
302
+
303
+ # Converts hash and nil to an options object
304
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
305
+
306
+ # Customize the options with defaults
307
+ metadata = @config.rpcs.create_comment.metadata.to_h
308
+
309
+ # Set x-goog-api-client and x-goog-user-project headers
310
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
311
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
312
+ gapic_version: ::Google::Cloud::Support::V2::VERSION
313
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
314
+
315
+ header_params = {}
316
+ if request.parent
317
+ header_params["parent"] = request.parent
318
+ end
319
+
320
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
321
+ metadata[:"x-goog-request-params"] ||= request_params_header
322
+
323
+ options.apply_defaults timeout: @config.rpcs.create_comment.timeout,
324
+ metadata: metadata,
325
+ retry_policy: @config.rpcs.create_comment.retry_policy
326
+
327
+ options.apply_defaults timeout: @config.timeout,
328
+ metadata: @config.metadata,
329
+ retry_policy: @config.retry_policy
330
+
331
+ @comment_service_stub.call_rpc :create_comment, request, options: options do |response, operation|
332
+ yield response, operation if block_given?
333
+ return response
334
+ end
335
+ rescue ::GRPC::BadStatus => e
336
+ raise ::Google::Cloud::Error.from_error(e)
337
+ end
338
+
339
+ ##
340
+ # Configuration class for the CommentService API.
341
+ #
342
+ # This class represents the configuration for CommentService,
343
+ # providing control over timeouts, retry behavior, logging, transport
344
+ # parameters, and other low-level controls. Certain parameters can also be
345
+ # applied individually to specific RPCs. See
346
+ # {::Google::Cloud::Support::V2::CommentService::Client::Configuration::Rpcs}
347
+ # for a list of RPCs that can be configured independently.
348
+ #
349
+ # Configuration can be applied globally to all clients, or to a single client
350
+ # on construction.
351
+ #
352
+ # @example
353
+ #
354
+ # # Modify the global config, setting the timeout for
355
+ # # list_comments to 20 seconds,
356
+ # # and all remaining timeouts to 10 seconds.
357
+ # ::Google::Cloud::Support::V2::CommentService::Client.configure do |config|
358
+ # config.timeout = 10.0
359
+ # config.rpcs.list_comments.timeout = 20.0
360
+ # end
361
+ #
362
+ # # Apply the above configuration only to a new client.
363
+ # client = ::Google::Cloud::Support::V2::CommentService::Client.new do |config|
364
+ # config.timeout = 10.0
365
+ # config.rpcs.list_comments.timeout = 20.0
366
+ # end
367
+ #
368
+ # @!attribute [rw] endpoint
369
+ # The hostname or hostname:port of the service endpoint.
370
+ # Defaults to `"cloudsupport.googleapis.com"`.
371
+ # @return [::String]
372
+ # @!attribute [rw] credentials
373
+ # Credentials to send with calls. You may provide any of the following types:
374
+ # * (`String`) The path to a service account key file in JSON format
375
+ # * (`Hash`) A service account key as a Hash
376
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
377
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
378
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
379
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
380
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
381
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
382
+ # * (`nil`) indicating no credentials
383
+ # @return [::Object]
384
+ # @!attribute [rw] scope
385
+ # The OAuth scopes
386
+ # @return [::Array<::String>]
387
+ # @!attribute [rw] lib_name
388
+ # The library name as recorded in instrumentation and logging
389
+ # @return [::String]
390
+ # @!attribute [rw] lib_version
391
+ # The library version as recorded in instrumentation and logging
392
+ # @return [::String]
393
+ # @!attribute [rw] channel_args
394
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
395
+ # `GRPC::Core::Channel` object is provided as the credential.
396
+ # @return [::Hash]
397
+ # @!attribute [rw] interceptors
398
+ # An array of interceptors that are run before calls are executed.
399
+ # @return [::Array<::GRPC::ClientInterceptor>]
400
+ # @!attribute [rw] timeout
401
+ # The call timeout in seconds.
402
+ # @return [::Numeric]
403
+ # @!attribute [rw] metadata
404
+ # Additional gRPC headers to be sent with the call.
405
+ # @return [::Hash{::Symbol=>::String}]
406
+ # @!attribute [rw] retry_policy
407
+ # The retry policy. The value is a hash with the following keys:
408
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
409
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
410
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
411
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
412
+ # trigger a retry.
413
+ # @return [::Hash]
414
+ # @!attribute [rw] quota_project
415
+ # A separate project against which to charge quota.
416
+ # @return [::String]
417
+ #
418
+ class Configuration
419
+ extend ::Gapic::Config
420
+
421
+ DEFAULT_ENDPOINT = "cloudsupport.googleapis.com"
422
+
423
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
424
+ config_attr :credentials, nil do |value|
425
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
426
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
427
+ allowed.any? { |klass| klass === value }
428
+ end
429
+ config_attr :scope, nil, ::String, ::Array, nil
430
+ config_attr :lib_name, nil, ::String, nil
431
+ config_attr :lib_version, nil, ::String, nil
432
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
433
+ config_attr :interceptors, nil, ::Array, nil
434
+ config_attr :timeout, nil, ::Numeric, nil
435
+ config_attr :metadata, nil, ::Hash, nil
436
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
437
+ config_attr :quota_project, nil, ::String, nil
438
+
439
+ # @private
440
+ def initialize parent_config = nil
441
+ @parent_config = parent_config unless parent_config.nil?
442
+
443
+ yield self if block_given?
444
+ end
445
+
446
+ ##
447
+ # Configurations for individual RPCs
448
+ # @return [Rpcs]
449
+ #
450
+ def rpcs
451
+ @rpcs ||= begin
452
+ parent_rpcs = nil
453
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
454
+ Rpcs.new parent_rpcs
455
+ end
456
+ end
457
+
458
+ ##
459
+ # Configuration for the channel pool
460
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
461
+ #
462
+ def channel_pool
463
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
464
+ end
465
+
466
+ ##
467
+ # Configuration RPC class for the CommentService API.
468
+ #
469
+ # Includes fields providing the configuration for each RPC in this service.
470
+ # Each configuration object is of type `Gapic::Config::Method` and includes
471
+ # the following configuration fields:
472
+ #
473
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
474
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
475
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
476
+ # include the following keys:
477
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
478
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
479
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
480
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
481
+ # trigger a retry.
482
+ #
483
+ class Rpcs
484
+ ##
485
+ # RPC-specific configuration for `list_comments`
486
+ # @return [::Gapic::Config::Method]
487
+ #
488
+ attr_reader :list_comments
489
+ ##
490
+ # RPC-specific configuration for `create_comment`
491
+ # @return [::Gapic::Config::Method]
492
+ #
493
+ attr_reader :create_comment
494
+
495
+ # @private
496
+ def initialize parent_rpcs = nil
497
+ list_comments_config = parent_rpcs.list_comments if parent_rpcs.respond_to? :list_comments
498
+ @list_comments = ::Gapic::Config::Method.new list_comments_config
499
+ create_comment_config = parent_rpcs.create_comment if parent_rpcs.respond_to? :create_comment
500
+ @create_comment = ::Gapic::Config::Method.new create_comment_config
501
+
502
+ yield self if block_given?
503
+ end
504
+ end
505
+ end
506
+ end
507
+ end
508
+ end
509
+ end
510
+ end
511
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Support
24
+ module V2
25
+ module CommentService
26
+ # Credentials for the CommentService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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
+
20
+ module Google
21
+ module Cloud
22
+ module Support
23
+ module V2
24
+ module CommentService
25
+ # Path helper methods for the CommentService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Case resource string.
29
+ #
30
+ # @overload case_path(organization:, case:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `organizations/{organization}/cases/{case}`
34
+ #
35
+ # @param organization [String]
36
+ # @param case [String]
37
+ #
38
+ # @overload case_path(project:, case:)
39
+ # The resource will be in the following format:
40
+ #
41
+ # `projects/{project}/cases/{case}`
42
+ #
43
+ # @param project [String]
44
+ # @param case [String]
45
+ #
46
+ # @return [::String]
47
+ def case_path **args
48
+ resources = {
49
+ "case:organization" => (proc do |organization:, case:|
50
+ raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
51
+
52
+ "organizations/#{organization}/cases/#{binding.local_variable_get :case}"
53
+ end),
54
+ "case:project" => (proc do |project:, case:|
55
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
56
+
57
+ "projects/#{project}/cases/#{binding.local_variable_get :case}"
58
+ end)
59
+ }
60
+
61
+ resource = resources[args.keys.sort.join(":")]
62
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
63
+ resource.call(**args)
64
+ end
65
+
66
+ ##
67
+ # Create a fully-qualified Comment resource string.
68
+ #
69
+ # @overload comment_path(organization:, case:, comment:)
70
+ # The resource will be in the following format:
71
+ #
72
+ # `organizations/{organization}/cases/{case}/comments/{comment}`
73
+ #
74
+ # @param organization [String]
75
+ # @param case [String]
76
+ # @param comment [String]
77
+ #
78
+ # @overload comment_path(project:, case:, comment:)
79
+ # The resource will be in the following format:
80
+ #
81
+ # `projects/{project}/cases/{case}/comments/{comment}`
82
+ #
83
+ # @param project [String]
84
+ # @param case [String]
85
+ # @param comment [String]
86
+ #
87
+ # @return [::String]
88
+ def comment_path **args
89
+ resources = {
90
+ "case:comment:organization" => (proc do |organization:, case:, comment:|
91
+ raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
92
+ raise ::ArgumentError, "case cannot contain /" if binding.local_variable_get(:case).to_s.include? "/"
93
+
94
+ "organizations/#{organization}/cases/#{binding.local_variable_get :case}/comments/#{comment}"
95
+ end),
96
+ "case:comment:project" => (proc do |project:, case:, comment:|
97
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
98
+ raise ::ArgumentError, "case cannot contain /" if binding.local_variable_get(:case).to_s.include? "/"
99
+
100
+ "projects/#{project}/cases/#{binding.local_variable_get :case}/comments/#{comment}"
101
+ end)
102
+ }
103
+
104
+ resource = resources[args.keys.sort.join(":")]
105
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
106
+ resource.call(**args)
107
+ end
108
+
109
+ extend self
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end