google-cloud-support-v2 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 (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 +407 -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 +1171 -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 +502 -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 +71 -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 +200 -12
@@ -0,0 +1,502 @@
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
+ )
150
+ end
151
+
152
+ # Service calls
153
+
154
+ ##
155
+ # Retrieve all Comments associated with the Case object.
156
+ #
157
+ # @overload list_comments(request, options = nil)
158
+ # Pass arguments to `list_comments` via a request object, either of type
159
+ # {::Google::Cloud::Support::V2::ListCommentsRequest} or an equivalent Hash.
160
+ #
161
+ # @param request [::Google::Cloud::Support::V2::ListCommentsRequest, ::Hash]
162
+ # A request object representing the call parameters. Required. To specify no
163
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
164
+ # @param options [::Gapic::CallOptions, ::Hash]
165
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
166
+ #
167
+ # @overload list_comments(parent: nil, page_size: nil, page_token: nil)
168
+ # Pass arguments to `list_comments` via keyword arguments. Note that at
169
+ # least one keyword argument is required. To specify no parameters, or to keep all
170
+ # the default parameter values, pass an empty Hash as a request object (see above).
171
+ #
172
+ # @param parent [::String]
173
+ # Required. The resource name of Case object for which comments should be
174
+ # listed.
175
+ # @param page_size [::Integer]
176
+ # The maximum number of comments fetched with each request. Defaults to 10.
177
+ # @param page_token [::String]
178
+ # A token identifying the page of results to return. If unspecified, the
179
+ # first page is retrieved.
180
+ #
181
+ # @yield [response, operation] Access the result along with the RPC operation
182
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Support::V2::Comment>]
183
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
184
+ #
185
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Support::V2::Comment>]
186
+ #
187
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
188
+ #
189
+ # @example Basic example
190
+ # require "google/cloud/support/v2"
191
+ #
192
+ # # Create a client object. The client can be reused for multiple calls.
193
+ # client = Google::Cloud::Support::V2::CommentService::Client.new
194
+ #
195
+ # # Create a request. To set request fields, pass in keyword arguments.
196
+ # request = Google::Cloud::Support::V2::ListCommentsRequest.new
197
+ #
198
+ # # Call the list_comments method.
199
+ # result = client.list_comments request
200
+ #
201
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
202
+ # # over elements, and API calls will be issued to fetch pages as needed.
203
+ # result.each do |item|
204
+ # # Each element is of type ::Google::Cloud::Support::V2::Comment.
205
+ # p item
206
+ # end
207
+ #
208
+ def list_comments request, options = nil
209
+ raise ::ArgumentError, "request must be provided" if request.nil?
210
+
211
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2::ListCommentsRequest
212
+
213
+ # Converts hash and nil to an options object
214
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
215
+
216
+ # Customize the options with defaults
217
+ metadata = @config.rpcs.list_comments.metadata.to_h
218
+
219
+ # Set x-goog-api-client and x-goog-user-project headers
220
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
221
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
222
+ gapic_version: ::Google::Cloud::Support::V2::VERSION
223
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
224
+
225
+ header_params = {}
226
+ if request.parent
227
+ header_params["parent"] = request.parent
228
+ end
229
+
230
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
231
+ metadata[:"x-goog-request-params"] ||= request_params_header
232
+
233
+ options.apply_defaults timeout: @config.rpcs.list_comments.timeout,
234
+ metadata: metadata,
235
+ retry_policy: @config.rpcs.list_comments.retry_policy
236
+
237
+ options.apply_defaults timeout: @config.timeout,
238
+ metadata: @config.metadata,
239
+ retry_policy: @config.retry_policy
240
+
241
+ @comment_service_stub.call_rpc :list_comments, request, options: options do |response, operation|
242
+ response = ::Gapic::PagedEnumerable.new @comment_service_stub, :list_comments, request, response, operation, options
243
+ yield response, operation if block_given?
244
+ return response
245
+ end
246
+ rescue ::GRPC::BadStatus => e
247
+ raise ::Google::Cloud::Error.from_error(e)
248
+ end
249
+
250
+ ##
251
+ # Add a new comment to the specified Case.
252
+ # The comment object must have the following fields set: body.
253
+ #
254
+ # @overload create_comment(request, options = nil)
255
+ # Pass arguments to `create_comment` via a request object, either of type
256
+ # {::Google::Cloud::Support::V2::CreateCommentRequest} or an equivalent Hash.
257
+ #
258
+ # @param request [::Google::Cloud::Support::V2::CreateCommentRequest, ::Hash]
259
+ # A request object representing the call parameters. Required. To specify no
260
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
261
+ # @param options [::Gapic::CallOptions, ::Hash]
262
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
263
+ #
264
+ # @overload create_comment(parent: nil, comment: nil)
265
+ # Pass arguments to `create_comment` via keyword arguments. Note that at
266
+ # least one keyword argument is required. To specify no parameters, or to keep all
267
+ # the default parameter values, pass an empty Hash as a request object (see above).
268
+ #
269
+ # @param parent [::String]
270
+ # Required. The resource name of Case to which this comment should be added.
271
+ # @param comment [::Google::Cloud::Support::V2::Comment, ::Hash]
272
+ # Required. The Comment object to be added to this Case.
273
+ #
274
+ # @yield [response, operation] Access the result along with the RPC operation
275
+ # @yieldparam response [::Google::Cloud::Support::V2::Comment]
276
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
277
+ #
278
+ # @return [::Google::Cloud::Support::V2::Comment]
279
+ #
280
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
281
+ #
282
+ # @example Basic example
283
+ # require "google/cloud/support/v2"
284
+ #
285
+ # # Create a client object. The client can be reused for multiple calls.
286
+ # client = Google::Cloud::Support::V2::CommentService::Client.new
287
+ #
288
+ # # Create a request. To set request fields, pass in keyword arguments.
289
+ # request = Google::Cloud::Support::V2::CreateCommentRequest.new
290
+ #
291
+ # # Call the create_comment method.
292
+ # result = client.create_comment request
293
+ #
294
+ # # The returned object is of type Google::Cloud::Support::V2::Comment.
295
+ # p result
296
+ #
297
+ def create_comment request, options = nil
298
+ raise ::ArgumentError, "request must be provided" if request.nil?
299
+
300
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2::CreateCommentRequest
301
+
302
+ # Converts hash and nil to an options object
303
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
304
+
305
+ # Customize the options with defaults
306
+ metadata = @config.rpcs.create_comment.metadata.to_h
307
+
308
+ # Set x-goog-api-client and x-goog-user-project headers
309
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
310
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
311
+ gapic_version: ::Google::Cloud::Support::V2::VERSION
312
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
313
+
314
+ header_params = {}
315
+ if request.parent
316
+ header_params["parent"] = request.parent
317
+ end
318
+
319
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
320
+ metadata[:"x-goog-request-params"] ||= request_params_header
321
+
322
+ options.apply_defaults timeout: @config.rpcs.create_comment.timeout,
323
+ metadata: metadata,
324
+ retry_policy: @config.rpcs.create_comment.retry_policy
325
+
326
+ options.apply_defaults timeout: @config.timeout,
327
+ metadata: @config.metadata,
328
+ retry_policy: @config.retry_policy
329
+
330
+ @comment_service_stub.call_rpc :create_comment, request, options: options do |response, operation|
331
+ yield response, operation if block_given?
332
+ return response
333
+ end
334
+ rescue ::GRPC::BadStatus => e
335
+ raise ::Google::Cloud::Error.from_error(e)
336
+ end
337
+
338
+ ##
339
+ # Configuration class for the CommentService API.
340
+ #
341
+ # This class represents the configuration for CommentService,
342
+ # providing control over timeouts, retry behavior, logging, transport
343
+ # parameters, and other low-level controls. Certain parameters can also be
344
+ # applied individually to specific RPCs. See
345
+ # {::Google::Cloud::Support::V2::CommentService::Client::Configuration::Rpcs}
346
+ # for a list of RPCs that can be configured independently.
347
+ #
348
+ # Configuration can be applied globally to all clients, or to a single client
349
+ # on construction.
350
+ #
351
+ # @example
352
+ #
353
+ # # Modify the global config, setting the timeout for
354
+ # # list_comments to 20 seconds,
355
+ # # and all remaining timeouts to 10 seconds.
356
+ # ::Google::Cloud::Support::V2::CommentService::Client.configure do |config|
357
+ # config.timeout = 10.0
358
+ # config.rpcs.list_comments.timeout = 20.0
359
+ # end
360
+ #
361
+ # # Apply the above configuration only to a new client.
362
+ # client = ::Google::Cloud::Support::V2::CommentService::Client.new do |config|
363
+ # config.timeout = 10.0
364
+ # config.rpcs.list_comments.timeout = 20.0
365
+ # end
366
+ #
367
+ # @!attribute [rw] endpoint
368
+ # The hostname or hostname:port of the service endpoint.
369
+ # Defaults to `"cloudsupport.googleapis.com"`.
370
+ # @return [::String]
371
+ # @!attribute [rw] credentials
372
+ # Credentials to send with calls. You may provide any of the following types:
373
+ # * (`String`) The path to a service account key file in JSON format
374
+ # * (`Hash`) A service account key as a Hash
375
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
376
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
377
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
378
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
379
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
380
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
381
+ # * (`nil`) indicating no credentials
382
+ # @return [::Object]
383
+ # @!attribute [rw] scope
384
+ # The OAuth scopes
385
+ # @return [::Array<::String>]
386
+ # @!attribute [rw] lib_name
387
+ # The library name as recorded in instrumentation and logging
388
+ # @return [::String]
389
+ # @!attribute [rw] lib_version
390
+ # The library version as recorded in instrumentation and logging
391
+ # @return [::String]
392
+ # @!attribute [rw] channel_args
393
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
394
+ # `GRPC::Core::Channel` object is provided as the credential.
395
+ # @return [::Hash]
396
+ # @!attribute [rw] interceptors
397
+ # An array of interceptors that are run before calls are executed.
398
+ # @return [::Array<::GRPC::ClientInterceptor>]
399
+ # @!attribute [rw] timeout
400
+ # The call timeout in seconds.
401
+ # @return [::Numeric]
402
+ # @!attribute [rw] metadata
403
+ # Additional gRPC headers to be sent with the call.
404
+ # @return [::Hash{::Symbol=>::String}]
405
+ # @!attribute [rw] retry_policy
406
+ # The retry policy. The value is a hash with the following keys:
407
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
408
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
409
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
410
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
411
+ # trigger a retry.
412
+ # @return [::Hash]
413
+ # @!attribute [rw] quota_project
414
+ # A separate project against which to charge quota.
415
+ # @return [::String]
416
+ #
417
+ class Configuration
418
+ extend ::Gapic::Config
419
+
420
+ DEFAULT_ENDPOINT = "cloudsupport.googleapis.com"
421
+
422
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
423
+ config_attr :credentials, nil do |value|
424
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
425
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
426
+ allowed.any? { |klass| klass === value }
427
+ end
428
+ config_attr :scope, nil, ::String, ::Array, nil
429
+ config_attr :lib_name, nil, ::String, nil
430
+ config_attr :lib_version, nil, ::String, nil
431
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
432
+ config_attr :interceptors, nil, ::Array, nil
433
+ config_attr :timeout, nil, ::Numeric, nil
434
+ config_attr :metadata, nil, ::Hash, nil
435
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
436
+ config_attr :quota_project, nil, ::String, nil
437
+
438
+ # @private
439
+ def initialize parent_config = nil
440
+ @parent_config = parent_config unless parent_config.nil?
441
+
442
+ yield self if block_given?
443
+ end
444
+
445
+ ##
446
+ # Configurations for individual RPCs
447
+ # @return [Rpcs]
448
+ #
449
+ def rpcs
450
+ @rpcs ||= begin
451
+ parent_rpcs = nil
452
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
453
+ Rpcs.new parent_rpcs
454
+ end
455
+ end
456
+
457
+ ##
458
+ # Configuration RPC class for the CommentService API.
459
+ #
460
+ # Includes fields providing the configuration for each RPC in this service.
461
+ # Each configuration object is of type `Gapic::Config::Method` and includes
462
+ # the following configuration fields:
463
+ #
464
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
465
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
466
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
467
+ # include the following keys:
468
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
469
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
470
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
471
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
472
+ # trigger a retry.
473
+ #
474
+ class Rpcs
475
+ ##
476
+ # RPC-specific configuration for `list_comments`
477
+ # @return [::Gapic::Config::Method]
478
+ #
479
+ attr_reader :list_comments
480
+ ##
481
+ # RPC-specific configuration for `create_comment`
482
+ # @return [::Gapic::Config::Method]
483
+ #
484
+ attr_reader :create_comment
485
+
486
+ # @private
487
+ def initialize parent_rpcs = nil
488
+ list_comments_config = parent_rpcs.list_comments if parent_rpcs.respond_to? :list_comments
489
+ @list_comments = ::Gapic::Config::Method.new list_comments_config
490
+ create_comment_config = parent_rpcs.create_comment if parent_rpcs.respond_to? :create_comment
491
+ @create_comment = ::Gapic::Config::Method.new create_comment_config
492
+
493
+ yield self if block_given?
494
+ end
495
+ end
496
+ end
497
+ end
498
+ end
499
+ end
500
+ end
501
+ end
502
+ 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