google-cloud-support-v2beta 0.a → 0.1.1

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 +45 -0
  9. data/lib/google/cloud/support/v2beta/case_attachment_service/client.rb +480 -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 +447 -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 +1252 -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 +1178 -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 +82 -0
  26. data/lib/google/cloud/support/v2beta/comment_pb.rb +49 -0
  27. data/lib/google/cloud/support/v2beta/comment_service/client.rb +571 -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 +531 -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 +49 -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 +106 -10
@@ -0,0 +1,115 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Support
23
+ module V2beta
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
@@ -0,0 +1,531 @@
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/comment_service_pb"
21
+ require "google/cloud/support/v2beta/comment_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Support
26
+ module V2beta
27
+ module CommentService
28
+ module Rest
29
+ ##
30
+ # REST client for the CommentService service.
31
+ #
32
+ # A service to manage comments on 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 :comment_service_stub
45
+
46
+ ##
47
+ # Configure the CommentService Client class.
48
+ #
49
+ # See {::Google::Cloud::Support::V2beta::CommentService::Rest::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all CommentService clients
55
+ # ::Google::Cloud::Support::V2beta::CommentService::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.list_comments.timeout = 60.0
76
+ default_config.rpcs.list_comments.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config.rpcs.create_comment.timeout = 60.0
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the CommentService Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Cloud::Support::V2beta::CommentService::Rest::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # The effective universe domain
110
+ #
111
+ # @return [String]
112
+ #
113
+ def universe_domain
114
+ @comment_service_stub.universe_domain
115
+ end
116
+
117
+ ##
118
+ # Create a new CommentService REST client object.
119
+ #
120
+ # @example
121
+ #
122
+ # # Create a client using the default configuration
123
+ # client = ::Google::Cloud::Support::V2beta::CommentService::Rest::Client.new
124
+ #
125
+ # # Create a client using a custom configuration
126
+ # client = ::Google::Cloud::Support::V2beta::CommentService::Rest::Client.new do |config|
127
+ # config.timeout = 10.0
128
+ # end
129
+ #
130
+ # @yield [config] Configure the CommentService client.
131
+ # @yieldparam config [Client::Configuration]
132
+ #
133
+ def initialize
134
+ # Create the configuration object
135
+ @config = Configuration.new Client.configure
136
+
137
+ # Yield the configuration if needed
138
+ yield @config if block_given?
139
+
140
+ # Create credentials
141
+ credentials = @config.credentials
142
+ # Use self-signed JWT if the endpoint is unchanged from default,
143
+ # but only if the default endpoint does not have a region prefix.
144
+ enable_self_signed_jwt = @config.endpoint.nil? ||
145
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
146
+ !@config.endpoint.split(".").first.include?("-"))
147
+ credentials ||= Credentials.default scope: @config.scope,
148
+ enable_self_signed_jwt: enable_self_signed_jwt
149
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
150
+ credentials = Credentials.new credentials, scope: @config.scope
151
+ end
152
+
153
+ @quota_project_id = @config.quota_project
154
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
155
+
156
+ @comment_service_stub = ::Google::Cloud::Support::V2beta::CommentService::Rest::ServiceStub.new(
157
+ endpoint: @config.endpoint,
158
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
+ universe_domain: @config.universe_domain,
160
+ credentials: credentials,
161
+ logger: @config.logger
162
+ )
163
+
164
+ @comment_service_stub.logger(stub: true)&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @comment_service_stub.logger
182
+ end
183
+
184
+ # Service calls
185
+
186
+ ##
187
+ # List all the comments associated with a case.
188
+ #
189
+ # @overload list_comments(request, options = nil)
190
+ # Pass arguments to `list_comments` via a request object, either of type
191
+ # {::Google::Cloud::Support::V2beta::ListCommentsRequest} or an equivalent Hash.
192
+ #
193
+ # @param request [::Google::Cloud::Support::V2beta::ListCommentsRequest, ::Hash]
194
+ # A request object representing the call parameters. Required. To specify no
195
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
196
+ # @param options [::Gapic::CallOptions, ::Hash]
197
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
198
+ #
199
+ # @overload list_comments(parent: nil, page_size: nil, page_token: nil)
200
+ # Pass arguments to `list_comments` via keyword arguments. Note that at
201
+ # least one keyword argument is required. To specify no parameters, or to keep all
202
+ # the default parameter values, pass an empty Hash as a request object (see above).
203
+ #
204
+ # @param parent [::String]
205
+ # Required. The name of the case for which to list comments.
206
+ # @param page_size [::Integer]
207
+ # The maximum number of comments to fetch. Defaults to 10.
208
+ # @param page_token [::String]
209
+ # A token identifying the page of results to return. If unspecified, the
210
+ # first page is returned.
211
+ # @yield [result, operation] Access the result along with the TransportOperation object
212
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::Comment>]
213
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
214
+ #
215
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Support::V2beta::Comment>]
216
+ #
217
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
218
+ #
219
+ # @example Basic example
220
+ # require "google/cloud/support/v2beta"
221
+ #
222
+ # # Create a client object. The client can be reused for multiple calls.
223
+ # client = Google::Cloud::Support::V2beta::CommentService::Rest::Client.new
224
+ #
225
+ # # Create a request. To set request fields, pass in keyword arguments.
226
+ # request = Google::Cloud::Support::V2beta::ListCommentsRequest.new
227
+ #
228
+ # # Call the list_comments method.
229
+ # result = client.list_comments request
230
+ #
231
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
232
+ # # over elements, and API calls will be issued to fetch pages as needed.
233
+ # result.each do |item|
234
+ # # Each element is of type ::Google::Cloud::Support::V2beta::Comment.
235
+ # p item
236
+ # end
237
+ #
238
+ def list_comments request, options = nil
239
+ raise ::ArgumentError, "request must be provided" if request.nil?
240
+
241
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::ListCommentsRequest
242
+
243
+ # Converts hash and nil to an options object
244
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
245
+
246
+ # Customize the options with defaults
247
+ call_metadata = @config.rpcs.list_comments.metadata.to_h
248
+
249
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
250
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
251
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
252
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
253
+ transports_version_send: [:rest]
254
+
255
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
256
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
257
+
258
+ options.apply_defaults timeout: @config.rpcs.list_comments.timeout,
259
+ metadata: call_metadata,
260
+ retry_policy: @config.rpcs.list_comments.retry_policy
261
+
262
+ options.apply_defaults timeout: @config.timeout,
263
+ metadata: @config.metadata,
264
+ retry_policy: @config.retry_policy
265
+
266
+ @comment_service_stub.list_comments request, options do |result, operation|
267
+ result = ::Gapic::Rest::PagedEnumerable.new @comment_service_stub, :list_comments, "comments", request, result, options
268
+ yield result, operation if block_given?
269
+ throw :response, result
270
+ end
271
+ rescue ::Gapic::Rest::Error => e
272
+ raise ::Google::Cloud::Error.from_error(e)
273
+ end
274
+
275
+ ##
276
+ # Add a new comment to a case.
277
+ #
278
+ # The comment must have the following fields set: `body`.
279
+ #
280
+ # @overload create_comment(request, options = nil)
281
+ # Pass arguments to `create_comment` via a request object, either of type
282
+ # {::Google::Cloud::Support::V2beta::CreateCommentRequest} or an equivalent Hash.
283
+ #
284
+ # @param request [::Google::Cloud::Support::V2beta::CreateCommentRequest, ::Hash]
285
+ # A request object representing the call parameters. Required. To specify no
286
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
287
+ # @param options [::Gapic::CallOptions, ::Hash]
288
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
289
+ #
290
+ # @overload create_comment(parent: nil, comment: nil)
291
+ # Pass arguments to `create_comment` via keyword arguments. Note that at
292
+ # least one keyword argument is required. To specify no parameters, or to keep all
293
+ # the default parameter values, pass an empty Hash as a request object (see above).
294
+ #
295
+ # @param parent [::String]
296
+ # Required. The name of the case to which the comment should be added.
297
+ # @param comment [::Google::Cloud::Support::V2beta::Comment, ::Hash]
298
+ # Required. The comment to be added.
299
+ # @yield [result, operation] Access the result along with the TransportOperation object
300
+ # @yieldparam result [::Google::Cloud::Support::V2beta::Comment]
301
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
302
+ #
303
+ # @return [::Google::Cloud::Support::V2beta::Comment]
304
+ #
305
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
306
+ #
307
+ # @example Basic example
308
+ # require "google/cloud/support/v2beta"
309
+ #
310
+ # # Create a client object. The client can be reused for multiple calls.
311
+ # client = Google::Cloud::Support::V2beta::CommentService::Rest::Client.new
312
+ #
313
+ # # Create a request. To set request fields, pass in keyword arguments.
314
+ # request = Google::Cloud::Support::V2beta::CreateCommentRequest.new
315
+ #
316
+ # # Call the create_comment method.
317
+ # result = client.create_comment request
318
+ #
319
+ # # The returned object is of type Google::Cloud::Support::V2beta::Comment.
320
+ # p result
321
+ #
322
+ def create_comment request, options = nil
323
+ raise ::ArgumentError, "request must be provided" if request.nil?
324
+
325
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::CreateCommentRequest
326
+
327
+ # Converts hash and nil to an options object
328
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
329
+
330
+ # Customize the options with defaults
331
+ call_metadata = @config.rpcs.create_comment.metadata.to_h
332
+
333
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
334
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
335
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
336
+ gapic_version: ::Google::Cloud::Support::V2beta::VERSION,
337
+ transports_version_send: [:rest]
338
+
339
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
340
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
341
+
342
+ options.apply_defaults timeout: @config.rpcs.create_comment.timeout,
343
+ metadata: call_metadata,
344
+ retry_policy: @config.rpcs.create_comment.retry_policy
345
+
346
+ options.apply_defaults timeout: @config.timeout,
347
+ metadata: @config.metadata,
348
+ retry_policy: @config.retry_policy
349
+
350
+ @comment_service_stub.create_comment request, options do |result, operation|
351
+ yield result, operation if block_given?
352
+ end
353
+ rescue ::Gapic::Rest::Error => e
354
+ raise ::Google::Cloud::Error.from_error(e)
355
+ end
356
+
357
+ ##
358
+ # Configuration class for the CommentService REST API.
359
+ #
360
+ # This class represents the configuration for CommentService REST,
361
+ # providing control over timeouts, retry behavior, logging, transport
362
+ # parameters, and other low-level controls. Certain parameters can also be
363
+ # applied individually to specific RPCs. See
364
+ # {::Google::Cloud::Support::V2beta::CommentService::Rest::Client::Configuration::Rpcs}
365
+ # for a list of RPCs that can be configured independently.
366
+ #
367
+ # Configuration can be applied globally to all clients, or to a single client
368
+ # on construction.
369
+ #
370
+ # @example
371
+ #
372
+ # # Modify the global config, setting the timeout for
373
+ # # list_comments to 20 seconds,
374
+ # # and all remaining timeouts to 10 seconds.
375
+ # ::Google::Cloud::Support::V2beta::CommentService::Rest::Client.configure do |config|
376
+ # config.timeout = 10.0
377
+ # config.rpcs.list_comments.timeout = 20.0
378
+ # end
379
+ #
380
+ # # Apply the above configuration only to a new client.
381
+ # client = ::Google::Cloud::Support::V2beta::CommentService::Rest::Client.new do |config|
382
+ # config.timeout = 10.0
383
+ # config.rpcs.list_comments.timeout = 20.0
384
+ # end
385
+ #
386
+ # @!attribute [rw] endpoint
387
+ # A custom service endpoint, as a hostname or hostname:port. The default is
388
+ # nil, indicating to use the default endpoint in the current universe domain.
389
+ # @return [::String,nil]
390
+ # @!attribute [rw] credentials
391
+ # Credentials to send with calls. You may provide any of the following types:
392
+ # * (`String`) The path to a service account key file in JSON format
393
+ # * (`Hash`) A service account key as a Hash
394
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
395
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
396
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
397
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
398
+ # * (`nil`) indicating no credentials
399
+ #
400
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
401
+ # external source for authentication to Google Cloud, you must validate it before
402
+ # providing it to a Google API client library. Providing an unvalidated credential
403
+ # configuration to Google APIs can compromise the security of your systems and data.
404
+ # For more information, refer to [Validate credential configurations from external
405
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
406
+ # @return [::Object]
407
+ # @!attribute [rw] scope
408
+ # The OAuth scopes
409
+ # @return [::Array<::String>]
410
+ # @!attribute [rw] lib_name
411
+ # The library name as recorded in instrumentation and logging
412
+ # @return [::String]
413
+ # @!attribute [rw] lib_version
414
+ # The library version as recorded in instrumentation and logging
415
+ # @return [::String]
416
+ # @!attribute [rw] timeout
417
+ # The call timeout in seconds.
418
+ # @return [::Numeric]
419
+ # @!attribute [rw] metadata
420
+ # Additional headers to be sent with the call.
421
+ # @return [::Hash{::Symbol=>::String}]
422
+ # @!attribute [rw] retry_policy
423
+ # The retry policy. The value is a hash with the following keys:
424
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
425
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
426
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
427
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
428
+ # trigger a retry.
429
+ # @return [::Hash]
430
+ # @!attribute [rw] quota_project
431
+ # A separate project against which to charge quota.
432
+ # @return [::String]
433
+ # @!attribute [rw] universe_domain
434
+ # The universe domain within which to make requests. This determines the
435
+ # default endpoint URL. The default value of nil uses the environment
436
+ # universe (usually the default "googleapis.com" universe).
437
+ # @return [::String,nil]
438
+ # @!attribute [rw] logger
439
+ # A custom logger to use for request/response debug logging, or the value
440
+ # `:default` (the default) to construct a default logger, or `nil` to
441
+ # explicitly disable logging.
442
+ # @return [::Logger,:default,nil]
443
+ #
444
+ class Configuration
445
+ extend ::Gapic::Config
446
+
447
+ # @private
448
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
449
+ DEFAULT_ENDPOINT = "cloudsupport.googleapis.com"
450
+
451
+ config_attr :endpoint, nil, ::String, nil
452
+ config_attr :credentials, nil do |value|
453
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
454
+ allowed.any? { |klass| klass === value }
455
+ end
456
+ config_attr :scope, nil, ::String, ::Array, nil
457
+ config_attr :lib_name, nil, ::String, nil
458
+ config_attr :lib_version, nil, ::String, nil
459
+ config_attr :timeout, nil, ::Numeric, nil
460
+ config_attr :metadata, nil, ::Hash, nil
461
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
462
+ config_attr :quota_project, nil, ::String, nil
463
+ config_attr :universe_domain, nil, ::String, nil
464
+ config_attr :logger, :default, ::Logger, nil, :default
465
+
466
+ # @private
467
+ def initialize parent_config = nil
468
+ @parent_config = parent_config unless parent_config.nil?
469
+
470
+ yield self if block_given?
471
+ end
472
+
473
+ ##
474
+ # Configurations for individual RPCs
475
+ # @return [Rpcs]
476
+ #
477
+ def rpcs
478
+ @rpcs ||= begin
479
+ parent_rpcs = nil
480
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
481
+ Rpcs.new parent_rpcs
482
+ end
483
+ end
484
+
485
+ ##
486
+ # Configuration RPC class for the CommentService API.
487
+ #
488
+ # Includes fields providing the configuration for each RPC in this service.
489
+ # Each configuration object is of type `Gapic::Config::Method` and includes
490
+ # the following configuration fields:
491
+ #
492
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
493
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
494
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
495
+ # include the following keys:
496
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
497
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
498
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
499
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
500
+ # trigger a retry.
501
+ #
502
+ class Rpcs
503
+ ##
504
+ # RPC-specific configuration for `list_comments`
505
+ # @return [::Gapic::Config::Method]
506
+ #
507
+ attr_reader :list_comments
508
+ ##
509
+ # RPC-specific configuration for `create_comment`
510
+ # @return [::Gapic::Config::Method]
511
+ #
512
+ attr_reader :create_comment
513
+
514
+ # @private
515
+ def initialize parent_rpcs = nil
516
+ list_comments_config = parent_rpcs.list_comments if parent_rpcs.respond_to? :list_comments
517
+ @list_comments = ::Gapic::Config::Method.new list_comments_config
518
+ create_comment_config = parent_rpcs.create_comment if parent_rpcs.respond_to? :create_comment
519
+ @create_comment = ::Gapic::Config::Method.new create_comment_config
520
+
521
+ yield self if block_given?
522
+ end
523
+ end
524
+ end
525
+ end
526
+ end
527
+ end
528
+ end
529
+ end
530
+ end
531
+ end