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.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +154 -8
- data/lib/google/cloud/support/v2beta/actor_pb.rb +44 -0
- data/lib/google/cloud/support/v2beta/attachment_pb.rb +49 -0
- data/lib/google/cloud/support/v2beta/attachment_service_pb.rb +50 -0
- data/lib/google/cloud/support/v2beta/attachment_service_services_pb.rb +75 -0
- data/lib/google/cloud/support/v2beta/case_attachment_service/client.rb +510 -0
- data/lib/google/cloud/support/v2beta/case_attachment_service/credentials.rb +47 -0
- data/lib/google/cloud/support/v2beta/case_attachment_service/paths.rb +72 -0
- data/lib/google/cloud/support/v2beta/case_attachment_service/rest/client.rb +477 -0
- data/lib/google/cloud/support/v2beta/case_attachment_service/rest/service_stub.rb +149 -0
- data/lib/google/cloud/support/v2beta/case_attachment_service/rest.rb +52 -0
- data/lib/google/cloud/support/v2beta/case_attachment_service.rb +55 -0
- data/lib/google/cloud/support/v2beta/case_pb.rb +54 -0
- data/lib/google/cloud/support/v2beta/case_service/client.rb +1526 -0
- data/lib/google/cloud/support/v2beta/case_service/credentials.rb +47 -0
- data/lib/google/cloud/support/v2beta/case_service/paths.rb +100 -0
- data/lib/google/cloud/support/v2beta/case_service/rest/client.rb +1452 -0
- data/lib/google/cloud/support/v2beta/case_service/rest/service_stub.rb +624 -0
- data/lib/google/cloud/support/v2beta/case_service/rest.rb +52 -0
- data/lib/google/cloud/support/v2beta/case_service.rb +55 -0
- data/lib/google/cloud/support/v2beta/case_service_pb.rb +63 -0
- data/lib/google/cloud/support/v2beta/case_service_services_pb.rb +356 -0
- data/lib/google/cloud/support/v2beta/comment_pb.rb +49 -0
- data/lib/google/cloud/support/v2beta/comment_service/client.rb +639 -0
- data/lib/google/cloud/support/v2beta/comment_service/credentials.rb +47 -0
- data/lib/google/cloud/support/v2beta/comment_service/paths.rb +115 -0
- data/lib/google/cloud/support/v2beta/comment_service/rest/client.rb +599 -0
- data/lib/google/cloud/support/v2beta/comment_service/rest/service_stub.rb +219 -0
- data/lib/google/cloud/support/v2beta/comment_service/rest.rb +52 -0
- data/lib/google/cloud/support/v2beta/comment_service.rb +55 -0
- data/lib/google/cloud/support/v2beta/comment_service_pb.rb +51 -0
- data/lib/google/cloud/support/v2beta/comment_service_services_pb.rb +117 -0
- data/lib/google/cloud/support/v2beta/content_pb.rb +42 -0
- data/lib/google/cloud/support/v2beta/email_message_pb.rb +51 -0
- data/lib/google/cloud/support/v2beta/escalation_pb.rb +45 -0
- data/lib/google/cloud/support/v2beta/feed_item_pb.rb +52 -0
- data/lib/google/cloud/support/v2beta/feed_service/client.rb +482 -0
- data/lib/google/cloud/support/v2beta/feed_service/credentials.rb +47 -0
- data/lib/google/cloud/support/v2beta/feed_service/paths.rb +72 -0
- data/lib/google/cloud/support/v2beta/feed_service/rest/client.rb +449 -0
- data/lib/google/cloud/support/v2beta/feed_service/rest/service_stub.rb +149 -0
- data/lib/google/cloud/support/v2beta/feed_service/rest.rb +52 -0
- data/lib/google/cloud/support/v2beta/feed_service.rb +55 -0
- data/lib/google/cloud/support/v2beta/feed_service_pb.rb +50 -0
- data/lib/google/cloud/support/v2beta/feed_service_services_pb.rb +46 -0
- data/lib/google/cloud/support/v2beta/rest.rb +40 -0
- data/lib/google/cloud/support/v2beta/version.rb +7 -2
- data/lib/google/cloud/support/v2beta.rb +48 -0
- data/lib/google-cloud-support-v2beta.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +473 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/support/v2beta/actor.rb +59 -0
- data/proto_docs/google/cloud/support/v2beta/attachment.rb +58 -0
- data/proto_docs/google/cloud/support/v2beta/attachment_service.rb +63 -0
- data/proto_docs/google/cloud/support/v2beta/case.rb +215 -0
- data/proto_docs/google/cloud/support/v2beta/case_service.rb +245 -0
- data/proto_docs/google/cloud/support/v2beta/comment.rb +58 -0
- data/proto_docs/google/cloud/support/v2beta/comment_service.rb +68 -0
- data/proto_docs/google/cloud/support/v2beta/content.rb +35 -0
- data/proto_docs/google/cloud/support/v2beta/email_message.rb +55 -0
- data/proto_docs/google/cloud/support/v2beta/escalation.rb +55 -0
- data/proto_docs/google/cloud/support/v2beta/feed_item.rb +56 -0
- data/proto_docs/google/cloud/support/v2beta/feed_service.rb +65 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- metadata +105 -9
@@ -0,0 +1,639 @@
|
|
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
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Support
|
25
|
+
module V2beta
|
26
|
+
module CommentService
|
27
|
+
##
|
28
|
+
# Client for the CommentService service.
|
29
|
+
#
|
30
|
+
# A service to manage comments on cases.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
# @private
|
34
|
+
API_VERSION = ""
|
35
|
+
|
36
|
+
# @private
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "cloudsupport.$UNIVERSE_DOMAIN$"
|
38
|
+
|
39
|
+
include Paths
|
40
|
+
|
41
|
+
# @private
|
42
|
+
attr_reader :comment_service_stub
|
43
|
+
|
44
|
+
##
|
45
|
+
# Configure the CommentService Client class.
|
46
|
+
#
|
47
|
+
# See {::Google::Cloud::Support::V2beta::CommentService::Client::Configuration}
|
48
|
+
# for a description of the configuration fields.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
#
|
52
|
+
# # Modify the configuration for all CommentService clients
|
53
|
+
# ::Google::Cloud::Support::V2beta::CommentService::Client.configure do |config|
|
54
|
+
# config.timeout = 10.0
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# @yield [config] Configure the Client client.
|
58
|
+
# @yieldparam config [Client::Configuration]
|
59
|
+
#
|
60
|
+
# @return [Client::Configuration]
|
61
|
+
#
|
62
|
+
def self.configure
|
63
|
+
@configure ||= begin
|
64
|
+
namespace = ["Google", "Cloud", "Support", "V2beta"]
|
65
|
+
parent_config = while namespace.any?
|
66
|
+
parent_name = namespace.join "::"
|
67
|
+
parent_const = const_get parent_name
|
68
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
69
|
+
namespace.pop
|
70
|
+
end
|
71
|
+
default_config = Client::Configuration.new parent_config
|
72
|
+
|
73
|
+
default_config.rpcs.list_comments.timeout = 60.0
|
74
|
+
default_config.rpcs.list_comments.retry_policy = {
|
75
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
76
|
+
}
|
77
|
+
|
78
|
+
default_config.rpcs.create_comment.timeout = 60.0
|
79
|
+
|
80
|
+
default_config
|
81
|
+
end
|
82
|
+
yield @configure if block_given?
|
83
|
+
@configure
|
84
|
+
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# Configure the CommentService Client instance.
|
88
|
+
#
|
89
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
90
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
91
|
+
# should be made on {Client.configure}.
|
92
|
+
#
|
93
|
+
# See {::Google::Cloud::Support::V2beta::CommentService::Client::Configuration}
|
94
|
+
# for a description of the configuration fields.
|
95
|
+
#
|
96
|
+
# @yield [config] Configure the Client client.
|
97
|
+
# @yieldparam config [Client::Configuration]
|
98
|
+
#
|
99
|
+
# @return [Client::Configuration]
|
100
|
+
#
|
101
|
+
def configure
|
102
|
+
yield @config if block_given?
|
103
|
+
@config
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# The effective universe domain
|
108
|
+
#
|
109
|
+
# @return [String]
|
110
|
+
#
|
111
|
+
def universe_domain
|
112
|
+
@comment_service_stub.universe_domain
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# Create a new CommentService client object.
|
117
|
+
#
|
118
|
+
# @example
|
119
|
+
#
|
120
|
+
# # Create a client using the default configuration
|
121
|
+
# client = ::Google::Cloud::Support::V2beta::CommentService::Client.new
|
122
|
+
#
|
123
|
+
# # Create a client using a custom configuration
|
124
|
+
# client = ::Google::Cloud::Support::V2beta::CommentService::Client.new do |config|
|
125
|
+
# config.timeout = 10.0
|
126
|
+
# end
|
127
|
+
#
|
128
|
+
# @yield [config] Configure the CommentService client.
|
129
|
+
# @yieldparam config [Client::Configuration]
|
130
|
+
#
|
131
|
+
def initialize
|
132
|
+
# These require statements are intentionally placed here to initialize
|
133
|
+
# the gRPC module only when it's required.
|
134
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
135
|
+
require "gapic/grpc"
|
136
|
+
require "google/cloud/support/v2beta/comment_service_services_pb"
|
137
|
+
|
138
|
+
# Create the configuration object
|
139
|
+
@config = Configuration.new Client.configure
|
140
|
+
|
141
|
+
# Yield the configuration if needed
|
142
|
+
yield @config if block_given?
|
143
|
+
|
144
|
+
# Create credentials
|
145
|
+
credentials = @config.credentials
|
146
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
147
|
+
# but only if the default endpoint does not have a region prefix.
|
148
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
149
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
150
|
+
!@config.endpoint.split(".").first.include?("-"))
|
151
|
+
credentials ||= Credentials.default scope: @config.scope,
|
152
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
153
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
154
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
155
|
+
end
|
156
|
+
@quota_project_id = @config.quota_project
|
157
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
158
|
+
|
159
|
+
@comment_service_stub = ::Gapic::ServiceStub.new(
|
160
|
+
::Google::Cloud::Support::V2beta::CommentService::Stub,
|
161
|
+
credentials: credentials,
|
162
|
+
endpoint: @config.endpoint,
|
163
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
164
|
+
universe_domain: @config.universe_domain,
|
165
|
+
channel_args: @config.channel_args,
|
166
|
+
interceptors: @config.interceptors,
|
167
|
+
channel_pool_config: @config.channel_pool,
|
168
|
+
logger: @config.logger
|
169
|
+
)
|
170
|
+
|
171
|
+
@comment_service_stub.stub_logger&.info do |entry|
|
172
|
+
entry.set_system_name
|
173
|
+
entry.set_service
|
174
|
+
entry.message = "Created client for #{entry.service}"
|
175
|
+
entry.set_credentials_fields credentials
|
176
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
177
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
178
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
##
|
183
|
+
# The logger used for request/response debug logging.
|
184
|
+
#
|
185
|
+
# @return [Logger]
|
186
|
+
#
|
187
|
+
def logger
|
188
|
+
@comment_service_stub.logger
|
189
|
+
end
|
190
|
+
|
191
|
+
# Service calls
|
192
|
+
|
193
|
+
##
|
194
|
+
# List all the comments associated with a case.
|
195
|
+
#
|
196
|
+
# EXAMPLES:
|
197
|
+
#
|
198
|
+
# cURL:
|
199
|
+
#
|
200
|
+
# ```shell
|
201
|
+
# case="projects/some-project/cases/43595344"
|
202
|
+
# curl \
|
203
|
+
# --header "Authorization: Bearer $(gcloud auth print-access-token)" \
|
204
|
+
# "https://cloudsupport.googleapis.com/v2/$case/comments"
|
205
|
+
# ```
|
206
|
+
#
|
207
|
+
# Python:
|
208
|
+
#
|
209
|
+
# ```python
|
210
|
+
# import googleapiclient.discovery
|
211
|
+
#
|
212
|
+
# api_version = "v2"
|
213
|
+
# supportApiService = googleapiclient.discovery.build(
|
214
|
+
# serviceName="cloudsupport",
|
215
|
+
# version=api_version,
|
216
|
+
# discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
|
217
|
+
# )
|
218
|
+
# request = (
|
219
|
+
# supportApiService.cases()
|
220
|
+
# .comments()
|
221
|
+
# .list(parent="projects/some-project/cases/43595344")
|
222
|
+
# )
|
223
|
+
# print(request.execute())
|
224
|
+
# ```
|
225
|
+
#
|
226
|
+
# @overload list_comments(request, options = nil)
|
227
|
+
# Pass arguments to `list_comments` via a request object, either of type
|
228
|
+
# {::Google::Cloud::Support::V2beta::ListCommentsRequest} or an equivalent Hash.
|
229
|
+
#
|
230
|
+
# @param request [::Google::Cloud::Support::V2beta::ListCommentsRequest, ::Hash]
|
231
|
+
# A request object representing the call parameters. Required. To specify no
|
232
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
233
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
234
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
235
|
+
#
|
236
|
+
# @overload list_comments(parent: nil, page_size: nil, page_token: nil)
|
237
|
+
# Pass arguments to `list_comments` via keyword arguments. Note that at
|
238
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
239
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
240
|
+
#
|
241
|
+
# @param parent [::String]
|
242
|
+
# Required. The name of the case for which to list comments.
|
243
|
+
# @param page_size [::Integer]
|
244
|
+
# The maximum number of comments to fetch. Defaults to 10.
|
245
|
+
# @param page_token [::String]
|
246
|
+
# A token identifying the page of results to return. If unspecified, the
|
247
|
+
# first page is returned.
|
248
|
+
#
|
249
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
250
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Support::V2beta::Comment>]
|
251
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
252
|
+
#
|
253
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Support::V2beta::Comment>]
|
254
|
+
#
|
255
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
256
|
+
#
|
257
|
+
# @example Basic example
|
258
|
+
# require "google/cloud/support/v2beta"
|
259
|
+
#
|
260
|
+
# # Create a client object. The client can be reused for multiple calls.
|
261
|
+
# client = Google::Cloud::Support::V2beta::CommentService::Client.new
|
262
|
+
#
|
263
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
264
|
+
# request = Google::Cloud::Support::V2beta::ListCommentsRequest.new
|
265
|
+
#
|
266
|
+
# # Call the list_comments method.
|
267
|
+
# result = client.list_comments request
|
268
|
+
#
|
269
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
270
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
271
|
+
# result.each do |item|
|
272
|
+
# # Each element is of type ::Google::Cloud::Support::V2beta::Comment.
|
273
|
+
# p item
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
def list_comments request, options = nil
|
277
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
278
|
+
|
279
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::ListCommentsRequest
|
280
|
+
|
281
|
+
# Converts hash and nil to an options object
|
282
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
283
|
+
|
284
|
+
# Customize the options with defaults
|
285
|
+
metadata = @config.rpcs.list_comments.metadata.to_h
|
286
|
+
|
287
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
288
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
289
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
290
|
+
gapic_version: ::Google::Cloud::Support::V2beta::VERSION
|
291
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
292
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
293
|
+
|
294
|
+
header_params = {}
|
295
|
+
if request.parent
|
296
|
+
header_params["parent"] = request.parent
|
297
|
+
end
|
298
|
+
|
299
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
300
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
301
|
+
|
302
|
+
options.apply_defaults timeout: @config.rpcs.list_comments.timeout,
|
303
|
+
metadata: metadata,
|
304
|
+
retry_policy: @config.rpcs.list_comments.retry_policy
|
305
|
+
|
306
|
+
options.apply_defaults timeout: @config.timeout,
|
307
|
+
metadata: @config.metadata,
|
308
|
+
retry_policy: @config.retry_policy
|
309
|
+
|
310
|
+
@comment_service_stub.call_rpc :list_comments, request, options: options do |response, operation|
|
311
|
+
response = ::Gapic::PagedEnumerable.new @comment_service_stub, :list_comments, request, response, operation, options
|
312
|
+
yield response, operation if block_given?
|
313
|
+
throw :response, response
|
314
|
+
end
|
315
|
+
rescue ::GRPC::BadStatus => e
|
316
|
+
raise ::Google::Cloud::Error.from_error(e)
|
317
|
+
end
|
318
|
+
|
319
|
+
##
|
320
|
+
# Add a new comment to a case.
|
321
|
+
#
|
322
|
+
# The comment must have the following fields set: `body`.
|
323
|
+
#
|
324
|
+
# EXAMPLES:
|
325
|
+
#
|
326
|
+
# cURL:
|
327
|
+
#
|
328
|
+
# ```shell
|
329
|
+
# case="projects/some-project/cases/43591344"
|
330
|
+
# curl \
|
331
|
+
# --request POST \
|
332
|
+
# --header "Authorization: Bearer $(gcloud auth print-access-token)" \
|
333
|
+
# --header 'Content-Type: application/json' \
|
334
|
+
# --data '{
|
335
|
+
# "body": "This is a test comment."
|
336
|
+
# }' \
|
337
|
+
# "https://cloudsupport.googleapis.com/v2/$case/comments"
|
338
|
+
# ```
|
339
|
+
#
|
340
|
+
# Python:
|
341
|
+
#
|
342
|
+
# ```python
|
343
|
+
# import googleapiclient.discovery
|
344
|
+
#
|
345
|
+
# api_version = "v2"
|
346
|
+
# supportApiService = googleapiclient.discovery.build(
|
347
|
+
# serviceName="cloudsupport",
|
348
|
+
# version=api_version,
|
349
|
+
# discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=\\{api_version}",
|
350
|
+
# )
|
351
|
+
# request = (
|
352
|
+
# supportApiService.cases()
|
353
|
+
# .comments()
|
354
|
+
# .create(
|
355
|
+
# parent="projects/some-project/cases/43595344",
|
356
|
+
# body=\\{"body": "This is a test comment."},
|
357
|
+
# )
|
358
|
+
# )
|
359
|
+
# print(request.execute())
|
360
|
+
# ```
|
361
|
+
#
|
362
|
+
# @overload create_comment(request, options = nil)
|
363
|
+
# Pass arguments to `create_comment` via a request object, either of type
|
364
|
+
# {::Google::Cloud::Support::V2beta::CreateCommentRequest} or an equivalent Hash.
|
365
|
+
#
|
366
|
+
# @param request [::Google::Cloud::Support::V2beta::CreateCommentRequest, ::Hash]
|
367
|
+
# A request object representing the call parameters. Required. To specify no
|
368
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
369
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
370
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
371
|
+
#
|
372
|
+
# @overload create_comment(parent: nil, comment: nil)
|
373
|
+
# Pass arguments to `create_comment` via keyword arguments. Note that at
|
374
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
375
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
376
|
+
#
|
377
|
+
# @param parent [::String]
|
378
|
+
# Required. The name of the case to which the comment should be added.
|
379
|
+
# @param comment [::Google::Cloud::Support::V2beta::Comment, ::Hash]
|
380
|
+
# Required. The comment to be added.
|
381
|
+
#
|
382
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
383
|
+
# @yieldparam response [::Google::Cloud::Support::V2beta::Comment]
|
384
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
385
|
+
#
|
386
|
+
# @return [::Google::Cloud::Support::V2beta::Comment]
|
387
|
+
#
|
388
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
389
|
+
#
|
390
|
+
# @example Basic example
|
391
|
+
# require "google/cloud/support/v2beta"
|
392
|
+
#
|
393
|
+
# # Create a client object. The client can be reused for multiple calls.
|
394
|
+
# client = Google::Cloud::Support::V2beta::CommentService::Client.new
|
395
|
+
#
|
396
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
397
|
+
# request = Google::Cloud::Support::V2beta::CreateCommentRequest.new
|
398
|
+
#
|
399
|
+
# # Call the create_comment method.
|
400
|
+
# result = client.create_comment request
|
401
|
+
#
|
402
|
+
# # The returned object is of type Google::Cloud::Support::V2beta::Comment.
|
403
|
+
# p result
|
404
|
+
#
|
405
|
+
def create_comment request, options = nil
|
406
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
407
|
+
|
408
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Support::V2beta::CreateCommentRequest
|
409
|
+
|
410
|
+
# Converts hash and nil to an options object
|
411
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
412
|
+
|
413
|
+
# Customize the options with defaults
|
414
|
+
metadata = @config.rpcs.create_comment.metadata.to_h
|
415
|
+
|
416
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
417
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
418
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
419
|
+
gapic_version: ::Google::Cloud::Support::V2beta::VERSION
|
420
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
421
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
422
|
+
|
423
|
+
header_params = {}
|
424
|
+
if request.parent
|
425
|
+
header_params["parent"] = request.parent
|
426
|
+
end
|
427
|
+
|
428
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
429
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
430
|
+
|
431
|
+
options.apply_defaults timeout: @config.rpcs.create_comment.timeout,
|
432
|
+
metadata: metadata,
|
433
|
+
retry_policy: @config.rpcs.create_comment.retry_policy
|
434
|
+
|
435
|
+
options.apply_defaults timeout: @config.timeout,
|
436
|
+
metadata: @config.metadata,
|
437
|
+
retry_policy: @config.retry_policy
|
438
|
+
|
439
|
+
@comment_service_stub.call_rpc :create_comment, request, options: options do |response, operation|
|
440
|
+
yield response, operation if block_given?
|
441
|
+
end
|
442
|
+
rescue ::GRPC::BadStatus => e
|
443
|
+
raise ::Google::Cloud::Error.from_error(e)
|
444
|
+
end
|
445
|
+
|
446
|
+
##
|
447
|
+
# Configuration class for the CommentService API.
|
448
|
+
#
|
449
|
+
# This class represents the configuration for CommentService,
|
450
|
+
# providing control over timeouts, retry behavior, logging, transport
|
451
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
452
|
+
# applied individually to specific RPCs. See
|
453
|
+
# {::Google::Cloud::Support::V2beta::CommentService::Client::Configuration::Rpcs}
|
454
|
+
# for a list of RPCs that can be configured independently.
|
455
|
+
#
|
456
|
+
# Configuration can be applied globally to all clients, or to a single client
|
457
|
+
# on construction.
|
458
|
+
#
|
459
|
+
# @example
|
460
|
+
#
|
461
|
+
# # Modify the global config, setting the timeout for
|
462
|
+
# # list_comments to 20 seconds,
|
463
|
+
# # and all remaining timeouts to 10 seconds.
|
464
|
+
# ::Google::Cloud::Support::V2beta::CommentService::Client.configure do |config|
|
465
|
+
# config.timeout = 10.0
|
466
|
+
# config.rpcs.list_comments.timeout = 20.0
|
467
|
+
# end
|
468
|
+
#
|
469
|
+
# # Apply the above configuration only to a new client.
|
470
|
+
# client = ::Google::Cloud::Support::V2beta::CommentService::Client.new do |config|
|
471
|
+
# config.timeout = 10.0
|
472
|
+
# config.rpcs.list_comments.timeout = 20.0
|
473
|
+
# end
|
474
|
+
#
|
475
|
+
# @!attribute [rw] endpoint
|
476
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
477
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
478
|
+
# @return [::String,nil]
|
479
|
+
# @!attribute [rw] credentials
|
480
|
+
# Credentials to send with calls. You may provide any of the following types:
|
481
|
+
# * (`String`) The path to a service account key file in JSON format
|
482
|
+
# * (`Hash`) A service account key as a Hash
|
483
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
484
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
485
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
486
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
487
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
488
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
489
|
+
# * (`nil`) indicating no credentials
|
490
|
+
#
|
491
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
492
|
+
# external source for authentication to Google Cloud, you must validate it before
|
493
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
494
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
495
|
+
# For more information, refer to [Validate credential configurations from external
|
496
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
497
|
+
# @return [::Object]
|
498
|
+
# @!attribute [rw] scope
|
499
|
+
# The OAuth scopes
|
500
|
+
# @return [::Array<::String>]
|
501
|
+
# @!attribute [rw] lib_name
|
502
|
+
# The library name as recorded in instrumentation and logging
|
503
|
+
# @return [::String]
|
504
|
+
# @!attribute [rw] lib_version
|
505
|
+
# The library version as recorded in instrumentation and logging
|
506
|
+
# @return [::String]
|
507
|
+
# @!attribute [rw] channel_args
|
508
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
509
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
510
|
+
# @return [::Hash]
|
511
|
+
# @!attribute [rw] interceptors
|
512
|
+
# An array of interceptors that are run before calls are executed.
|
513
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
514
|
+
# @!attribute [rw] timeout
|
515
|
+
# The call timeout in seconds.
|
516
|
+
# @return [::Numeric]
|
517
|
+
# @!attribute [rw] metadata
|
518
|
+
# Additional gRPC headers to be sent with the call.
|
519
|
+
# @return [::Hash{::Symbol=>::String}]
|
520
|
+
# @!attribute [rw] retry_policy
|
521
|
+
# The retry policy. The value is a hash with the following keys:
|
522
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
523
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
524
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
525
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
526
|
+
# trigger a retry.
|
527
|
+
# @return [::Hash]
|
528
|
+
# @!attribute [rw] quota_project
|
529
|
+
# A separate project against which to charge quota.
|
530
|
+
# @return [::String]
|
531
|
+
# @!attribute [rw] universe_domain
|
532
|
+
# The universe domain within which to make requests. This determines the
|
533
|
+
# default endpoint URL. The default value of nil uses the environment
|
534
|
+
# universe (usually the default "googleapis.com" universe).
|
535
|
+
# @return [::String,nil]
|
536
|
+
# @!attribute [rw] logger
|
537
|
+
# A custom logger to use for request/response debug logging, or the value
|
538
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
539
|
+
# explicitly disable logging.
|
540
|
+
# @return [::Logger,:default,nil]
|
541
|
+
#
|
542
|
+
class Configuration
|
543
|
+
extend ::Gapic::Config
|
544
|
+
|
545
|
+
# @private
|
546
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
547
|
+
DEFAULT_ENDPOINT = "cloudsupport.googleapis.com"
|
548
|
+
|
549
|
+
config_attr :endpoint, nil, ::String, nil
|
550
|
+
config_attr :credentials, nil do |value|
|
551
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
552
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
553
|
+
allowed.any? { |klass| klass === value }
|
554
|
+
end
|
555
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
556
|
+
config_attr :lib_name, nil, ::String, nil
|
557
|
+
config_attr :lib_version, nil, ::String, nil
|
558
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
559
|
+
config_attr :interceptors, nil, ::Array, nil
|
560
|
+
config_attr :timeout, nil, ::Numeric, nil
|
561
|
+
config_attr :metadata, nil, ::Hash, nil
|
562
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
563
|
+
config_attr :quota_project, nil, ::String, nil
|
564
|
+
config_attr :universe_domain, nil, ::String, nil
|
565
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
566
|
+
|
567
|
+
# @private
|
568
|
+
def initialize parent_config = nil
|
569
|
+
@parent_config = parent_config unless parent_config.nil?
|
570
|
+
|
571
|
+
yield self if block_given?
|
572
|
+
end
|
573
|
+
|
574
|
+
##
|
575
|
+
# Configurations for individual RPCs
|
576
|
+
# @return [Rpcs]
|
577
|
+
#
|
578
|
+
def rpcs
|
579
|
+
@rpcs ||= begin
|
580
|
+
parent_rpcs = nil
|
581
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
582
|
+
Rpcs.new parent_rpcs
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
##
|
587
|
+
# Configuration for the channel pool
|
588
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
589
|
+
#
|
590
|
+
def channel_pool
|
591
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
592
|
+
end
|
593
|
+
|
594
|
+
##
|
595
|
+
# Configuration RPC class for the CommentService API.
|
596
|
+
#
|
597
|
+
# Includes fields providing the configuration for each RPC in this service.
|
598
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
599
|
+
# the following configuration fields:
|
600
|
+
#
|
601
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
602
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
603
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
604
|
+
# include the following keys:
|
605
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
606
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
607
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
608
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
609
|
+
# trigger a retry.
|
610
|
+
#
|
611
|
+
class Rpcs
|
612
|
+
##
|
613
|
+
# RPC-specific configuration for `list_comments`
|
614
|
+
# @return [::Gapic::Config::Method]
|
615
|
+
#
|
616
|
+
attr_reader :list_comments
|
617
|
+
##
|
618
|
+
# RPC-specific configuration for `create_comment`
|
619
|
+
# @return [::Gapic::Config::Method]
|
620
|
+
#
|
621
|
+
attr_reader :create_comment
|
622
|
+
|
623
|
+
# @private
|
624
|
+
def initialize parent_rpcs = nil
|
625
|
+
list_comments_config = parent_rpcs.list_comments if parent_rpcs.respond_to? :list_comments
|
626
|
+
@list_comments = ::Gapic::Config::Method.new list_comments_config
|
627
|
+
create_comment_config = parent_rpcs.create_comment if parent_rpcs.respond_to? :create_comment
|
628
|
+
@create_comment = ::Gapic::Config::Method.new create_comment_config
|
629
|
+
|
630
|
+
yield self if block_given?
|
631
|
+
end
|
632
|
+
end
|
633
|
+
end
|
634
|
+
end
|
635
|
+
end
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|
639
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Support
|
24
|
+
module V2beta
|
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
|