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,407 @@
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/attachment_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Support
25
+ module V2
26
+ module CaseAttachmentService
27
+ ##
28
+ # Client for the CaseAttachmentService service.
29
+ #
30
+ # A service to manage file attachment for Google Cloud support cases.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :case_attachment_service_stub
37
+
38
+ ##
39
+ # Configure the CaseAttachmentService Client class.
40
+ #
41
+ # See {::Google::Cloud::Support::V2::CaseAttachmentService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all CaseAttachmentService clients
47
+ # ::Google::Cloud::Support::V2::CaseAttachmentService::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_attachments.timeout = 60.0
68
+ default_config.rpcs.list_attachments.retry_policy = {
69
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the CaseAttachmentService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::Support::V2::CaseAttachmentService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # Create a new CaseAttachmentService client object.
100
+ #
101
+ # @example
102
+ #
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::Support::V2::CaseAttachmentService::Client.new
105
+ #
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::Support::V2::CaseAttachmentService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the CaseAttachmentService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/support/v2/attachment_service_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @case_attachment_service_stub = ::Gapic::ServiceStub.new(
142
+ ::Google::Cloud::Support::V2::CaseAttachmentService::Stub,
143
+ credentials: credentials,
144
+ endpoint: @config.endpoint,
145
+ channel_args: @config.channel_args,
146
+ interceptors: @config.interceptors
147
+ )
148
+ end
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Retrieve all attachments associated with a support case.
154
+ #
155
+ # @overload list_attachments(request, options = nil)
156
+ # Pass arguments to `list_attachments` via a request object, either of type
157
+ # {::Google::Cloud::Support::V2::ListAttachmentsRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::Support::V2::ListAttachmentsRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
164
+ #
165
+ # @overload list_attachments(parent: nil, page_size: nil, page_token: nil)
166
+ # Pass arguments to `list_attachments` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param parent [::String]
171
+ # Required. The resource name of Case object for which attachments should be
172
+ # listed.
173
+ # @param page_size [::Integer]
174
+ # The maximum number of attachments fetched with each request. If not
175
+ # provided, the default is 10. The maximum page size that will be returned is
176
+ # 100.
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::Attachment>]
183
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
184
+ #
185
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Support::V2::Attachment>]
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::CaseAttachmentService::Client.new
194
+ #
195
+ # # Create a request. To set request fields, pass in keyword arguments.
196
+ # request = Google::Cloud::Support::V2::ListAttachmentsRequest.new
197
+ #
198
+ # # Call the list_attachments method.
199
+ # result = client.list_attachments 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::Attachment.
205
+ # p item
206
+ # end
207
+ #
208
+ def list_attachments 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::ListAttachmentsRequest
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_attachments.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_attachments.timeout,
234
+ metadata: metadata,
235
+ retry_policy: @config.rpcs.list_attachments.retry_policy
236
+
237
+ options.apply_defaults timeout: @config.timeout,
238
+ metadata: @config.metadata,
239
+ retry_policy: @config.retry_policy
240
+
241
+ @case_attachment_service_stub.call_rpc :list_attachments, request, options: options do |response, operation|
242
+ response = ::Gapic::PagedEnumerable.new @case_attachment_service_stub, :list_attachments, 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
+ # Configuration class for the CaseAttachmentService API.
252
+ #
253
+ # This class represents the configuration for CaseAttachmentService,
254
+ # providing control over timeouts, retry behavior, logging, transport
255
+ # parameters, and other low-level controls. Certain parameters can also be
256
+ # applied individually to specific RPCs. See
257
+ # {::Google::Cloud::Support::V2::CaseAttachmentService::Client::Configuration::Rpcs}
258
+ # for a list of RPCs that can be configured independently.
259
+ #
260
+ # Configuration can be applied globally to all clients, or to a single client
261
+ # on construction.
262
+ #
263
+ # @example
264
+ #
265
+ # # Modify the global config, setting the timeout for
266
+ # # list_attachments to 20 seconds,
267
+ # # and all remaining timeouts to 10 seconds.
268
+ # ::Google::Cloud::Support::V2::CaseAttachmentService::Client.configure do |config|
269
+ # config.timeout = 10.0
270
+ # config.rpcs.list_attachments.timeout = 20.0
271
+ # end
272
+ #
273
+ # # Apply the above configuration only to a new client.
274
+ # client = ::Google::Cloud::Support::V2::CaseAttachmentService::Client.new do |config|
275
+ # config.timeout = 10.0
276
+ # config.rpcs.list_attachments.timeout = 20.0
277
+ # end
278
+ #
279
+ # @!attribute [rw] endpoint
280
+ # The hostname or hostname:port of the service endpoint.
281
+ # Defaults to `"cloudsupport.googleapis.com"`.
282
+ # @return [::String]
283
+ # @!attribute [rw] credentials
284
+ # Credentials to send with calls. You may provide any of the following types:
285
+ # * (`String`) The path to a service account key file in JSON format
286
+ # * (`Hash`) A service account key as a Hash
287
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
288
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
289
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
290
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
291
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
292
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
293
+ # * (`nil`) indicating no credentials
294
+ # @return [::Object]
295
+ # @!attribute [rw] scope
296
+ # The OAuth scopes
297
+ # @return [::Array<::String>]
298
+ # @!attribute [rw] lib_name
299
+ # The library name as recorded in instrumentation and logging
300
+ # @return [::String]
301
+ # @!attribute [rw] lib_version
302
+ # The library version as recorded in instrumentation and logging
303
+ # @return [::String]
304
+ # @!attribute [rw] channel_args
305
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
306
+ # `GRPC::Core::Channel` object is provided as the credential.
307
+ # @return [::Hash]
308
+ # @!attribute [rw] interceptors
309
+ # An array of interceptors that are run before calls are executed.
310
+ # @return [::Array<::GRPC::ClientInterceptor>]
311
+ # @!attribute [rw] timeout
312
+ # The call timeout in seconds.
313
+ # @return [::Numeric]
314
+ # @!attribute [rw] metadata
315
+ # Additional gRPC headers to be sent with the call.
316
+ # @return [::Hash{::Symbol=>::String}]
317
+ # @!attribute [rw] retry_policy
318
+ # The retry policy. The value is a hash with the following keys:
319
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
320
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
321
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
322
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
323
+ # trigger a retry.
324
+ # @return [::Hash]
325
+ # @!attribute [rw] quota_project
326
+ # A separate project against which to charge quota.
327
+ # @return [::String]
328
+ #
329
+ class Configuration
330
+ extend ::Gapic::Config
331
+
332
+ DEFAULT_ENDPOINT = "cloudsupport.googleapis.com"
333
+
334
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
335
+ config_attr :credentials, nil do |value|
336
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
337
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
338
+ allowed.any? { |klass| klass === value }
339
+ end
340
+ config_attr :scope, nil, ::String, ::Array, nil
341
+ config_attr :lib_name, nil, ::String, nil
342
+ config_attr :lib_version, nil, ::String, nil
343
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
344
+ config_attr :interceptors, nil, ::Array, nil
345
+ config_attr :timeout, nil, ::Numeric, nil
346
+ config_attr :metadata, nil, ::Hash, nil
347
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
348
+ config_attr :quota_project, nil, ::String, nil
349
+
350
+ # @private
351
+ def initialize parent_config = nil
352
+ @parent_config = parent_config unless parent_config.nil?
353
+
354
+ yield self if block_given?
355
+ end
356
+
357
+ ##
358
+ # Configurations for individual RPCs
359
+ # @return [Rpcs]
360
+ #
361
+ def rpcs
362
+ @rpcs ||= begin
363
+ parent_rpcs = nil
364
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
365
+ Rpcs.new parent_rpcs
366
+ end
367
+ end
368
+
369
+ ##
370
+ # Configuration RPC class for the CaseAttachmentService API.
371
+ #
372
+ # Includes fields providing the configuration for each RPC in this service.
373
+ # Each configuration object is of type `Gapic::Config::Method` and includes
374
+ # the following configuration fields:
375
+ #
376
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
377
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
378
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
379
+ # include the following keys:
380
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
381
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
382
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
383
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
384
+ # trigger a retry.
385
+ #
386
+ class Rpcs
387
+ ##
388
+ # RPC-specific configuration for `list_attachments`
389
+ # @return [::Gapic::Config::Method]
390
+ #
391
+ attr_reader :list_attachments
392
+
393
+ # @private
394
+ def initialize parent_rpcs = nil
395
+ list_attachments_config = parent_rpcs.list_attachments if parent_rpcs.respond_to? :list_attachments
396
+ @list_attachments = ::Gapic::Config::Method.new list_attachments_config
397
+
398
+ yield self if block_given?
399
+ end
400
+ end
401
+ end
402
+ end
403
+ end
404
+ end
405
+ end
406
+ end
407
+ 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 CaseAttachmentService
26
+ # Credentials for the CaseAttachmentService 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,72 @@
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 CaseAttachmentService
25
+ # Path helper methods for the CaseAttachmentService 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
+ extend self
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,49 @@
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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/support/v2/version"
24
+
25
+ require "google/cloud/support/v2/case_attachment_service/credentials"
26
+ require "google/cloud/support/v2/case_attachment_service/paths"
27
+ require "google/cloud/support/v2/case_attachment_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Support
32
+ module V2
33
+ ##
34
+ # A service to manage file attachment for Google Cloud support cases.
35
+ #
36
+ # @example Load this service and instantiate a gRPC client
37
+ #
38
+ # require "google/cloud/support/v2/case_attachment_service"
39
+ # client = ::Google::Cloud::Support::V2::CaseAttachmentService::Client.new
40
+ #
41
+ module CaseAttachmentService
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "case_attachment_service", "helpers.rb"
49
+ require "google/cloud/support/v2/case_attachment_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: google/cloud/support/v2/case.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/field_behavior_pb'
8
+ require 'google/api/resource_pb'
9
+ require 'google/cloud/support/v2/actor_pb'
10
+ require 'google/protobuf/timestamp_pb'
11
+
12
+
13
+ descriptor_data = "\n\"google/cloud/support/v2/case.proto\x12\x17google.cloud.support.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/support/v2/actor.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xe1\x06\n\x04\x43\x61se\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x43\n\x0e\x63lassification\x18\x04 \x01(\x0b\x32+.google.cloud.support.v2.CaseClassification\x12\x11\n\ttime_zone\x18\x08 \x01(\t\x12\"\n\x1asubscriber_email_addresses\x18\t \x03(\t\x12\x37\n\x05state\x18\x0c \x01(\x0e\x32#.google.cloud.support.v2.Case.StateB\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\r \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x0e \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12/\n\x07\x63reator\x18\x0f \x01(\x0b\x32\x1e.google.cloud.support.v2.Actor\x12\x15\n\rcontact_email\x18# \x01(\t\x12\x11\n\tescalated\x18\x11 \x01(\x08\x12\x11\n\ttest_case\x18\x13 \x01(\x08\x12\x15\n\rlanguage_code\x18\x17 \x01(\t\x12\x38\n\x08priority\x18 \x01(\x0e\x32&.google.cloud.support.v2.Case.Priority\"\x7f\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x07\n\x03NEW\x10\x01\x12\x1e\n\x1aIN_PROGRESS_GOOGLE_SUPPORT\x10\x02\x12\x13\n\x0f\x41\x43TION_REQUIRED\x10\x03\x12\x15\n\x11SOLUTION_PROVIDED\x10\x04\x12\n\n\x06\x43LOSED\x10\x05\"L\n\x08Priority\x12\x18\n\x14PRIORITY_UNSPECIFIED\x10\x00\x12\x06\n\x02P0\x10\x01\x12\x06\n\x02P1\x10\x02\x12\x06\n\x02P2\x10\x03\x12\x06\n\x02P3\x10\x04\x12\x06\n\x02P4\x10\x05:q\xea\x41n\n cloudsupport.googleapis.com/Case\x12)organizations/{organization}/cases/{case}\x12\x1fprojects/{project}/cases/{case}\"6\n\x12\x43\x61seClassification\x12\n\n\x02id\x18\x03 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x04 \x01(\tB\xb2\x01\n\x1b\x63om.google.cloud.support.v2B\tCaseProtoP\x01Z5cloud.google.com/go/support/apiv2/supportpb;supportpb\xaa\x02\x17Google.Cloud.Support.V2\xca\x02\x17Google\\Cloud\\Support\\V2\xea\x02\x1aGoogle::Cloud::Support::V2b\x06proto3"
14
+
15
+ pool = Google::Protobuf::DescriptorPool.generated_pool
16
+
17
+ begin
18
+ pool.add_serialized_file(descriptor_data)
19
+ rescue TypeError => e
20
+ # Compatibility code: will be removed in the next major version.
21
+ require 'google/protobuf/descriptor_pb'
22
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
23
+ parsed.clear_dependency
24
+ serialized = parsed.class.encode(parsed)
25
+ file = pool.add_serialized_file(serialized)
26
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
27
+ imports = [
28
+ ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"],
29
+ ["google.cloud.support.v2.Actor", "google/cloud/support/v2/actor.proto"],
30
+ ]
31
+ imports.each do |type_name, expected_filename|
32
+ import_file = pool.lookup(type_name).file_descriptor
33
+ if import_file.name != expected_filename
34
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
35
+ end
36
+ end
37
+ warn "Each proto file must use a consistent fully-qualified name."
38
+ warn "This will become an error in the next major version."
39
+ end
40
+
41
+ module Google
42
+ module Cloud
43
+ module Support
44
+ module V2
45
+ Case = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.support.v2.Case").msgclass
46
+ Case::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.support.v2.Case.State").enummodule
47
+ Case::Priority = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.support.v2.Case.Priority").enummodule
48
+ CaseClassification = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.support.v2.CaseClassification").msgclass
49
+ end
50
+ end
51
+ end
52
+ end