google-cloud-api_hub-v1 0.a → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/api_hub/v1/api_hub/client.rb +4514 -0
  6. data/lib/google/cloud/api_hub/v1/api_hub/credentials.rb +47 -0
  7. data/lib/google/cloud/api_hub/v1/api_hub/paths.rb +216 -0
  8. data/lib/google/cloud/api_hub/v1/api_hub/rest/client.rb +4251 -0
  9. data/lib/google/cloud/api_hub/v1/api_hub/rest/service_stub.rb +2147 -0
  10. data/lib/google/cloud/api_hub/v1/api_hub/rest.rb +53 -0
  11. data/lib/google/cloud/api_hub/v1/api_hub.rb +55 -0
  12. data/lib/google/cloud/api_hub/v1/api_hub_dependencies/client.rb +906 -0
  13. data/lib/google/cloud/api_hub/v1/api_hub_dependencies/credentials.rb +47 -0
  14. data/lib/google/cloud/api_hub/v1/api_hub_dependencies/paths.rb +88 -0
  15. data/lib/google/cloud/api_hub/v1/api_hub_dependencies/rest/client.rb +853 -0
  16. data/lib/google/cloud/api_hub/v1/api_hub_dependencies/rest/service_stub.rb +366 -0
  17. data/lib/google/cloud/api_hub/v1/api_hub_dependencies/rest.rb +54 -0
  18. data/lib/google/cloud/api_hub/v1/api_hub_dependencies.rb +56 -0
  19. data/lib/google/cloud/api_hub/v1/api_hub_plugin/client.rb +640 -0
  20. data/lib/google/cloud/api_hub/v1/api_hub_plugin/credentials.rb +47 -0
  21. data/lib/google/cloud/api_hub/v1/api_hub_plugin/paths.rb +52 -0
  22. data/lib/google/cloud/api_hub/v1/api_hub_plugin/rest/client.rb +601 -0
  23. data/lib/google/cloud/api_hub/v1/api_hub_plugin/rest/service_stub.rb +248 -0
  24. data/lib/google/cloud/api_hub/v1/api_hub_plugin/rest.rb +53 -0
  25. data/lib/google/cloud/api_hub/v1/api_hub_plugin.rb +55 -0
  26. data/lib/google/cloud/api_hub/v1/bindings_override.rb +102 -0
  27. data/lib/google/cloud/api_hub/v1/host_project_registration_service/client.rb +689 -0
  28. data/lib/google/cloud/api_hub/v1/host_project_registration_service/credentials.rb +47 -0
  29. data/lib/google/cloud/api_hub/v1/host_project_registration_service/paths.rb +83 -0
  30. data/lib/google/cloud/api_hub/v1/host_project_registration_service/rest/client.rb +650 -0
  31. data/lib/google/cloud/api_hub/v1/host_project_registration_service/rest/service_stub.rb +247 -0
  32. data/lib/google/cloud/api_hub/v1/host_project_registration_service/rest.rb +53 -0
  33. data/lib/google/cloud/api_hub/v1/host_project_registration_service.rb +55 -0
  34. data/lib/google/cloud/api_hub/v1/linting_service/client.rb +744 -0
  35. data/lib/google/cloud/api_hub/v1/linting_service/credentials.rb +47 -0
  36. data/lib/google/cloud/api_hub/v1/linting_service/paths.rb +75 -0
  37. data/lib/google/cloud/api_hub/v1/linting_service/rest/client.rb +698 -0
  38. data/lib/google/cloud/api_hub/v1/linting_service/rest/service_stub.rb +307 -0
  39. data/lib/google/cloud/api_hub/v1/linting_service/rest.rb +53 -0
  40. data/lib/google/cloud/api_hub/v1/linting_service.rb +55 -0
  41. data/lib/google/cloud/api_hub/v1/provisioning/client.rb +676 -0
  42. data/lib/google/cloud/api_hub/v1/provisioning/credentials.rb +47 -0
  43. data/lib/google/cloud/api_hub/v1/provisioning/operations.rb +809 -0
  44. data/lib/google/cloud/api_hub/v1/provisioning/paths.rb +69 -0
  45. data/lib/google/cloud/api_hub/v1/provisioning/rest/client.rb +637 -0
  46. data/lib/google/cloud/api_hub/v1/provisioning/rest/operations.rb +902 -0
  47. data/lib/google/cloud/api_hub/v1/provisioning/rest/service_stub.rb +247 -0
  48. data/lib/google/cloud/api_hub/v1/provisioning/rest.rb +54 -0
  49. data/lib/google/cloud/api_hub/v1/provisioning.rb +56 -0
  50. data/lib/google/cloud/api_hub/v1/rest.rb +44 -0
  51. data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service/client.rb +885 -0
  52. data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service/credentials.rb +47 -0
  53. data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service/paths.rb +83 -0
  54. data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service/rest/client.rb +832 -0
  55. data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service/rest/service_stub.rb +365 -0
  56. data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service/rest.rb +53 -0
  57. data/lib/google/cloud/api_hub/v1/runtime_project_attachment_service.rb +55 -0
  58. data/lib/google/cloud/api_hub/v1/version.rb +7 -2
  59. data/lib/google/cloud/api_hub/v1.rb +51 -0
  60. data/lib/google/cloud/apihub/v1/apihub_service_pb.rb +102 -0
  61. data/lib/google/cloud/apihub/v1/apihub_service_services_pb.rb +288 -0
  62. data/lib/google/cloud/apihub/v1/common_fields_pb.rb +92 -0
  63. data/lib/google/cloud/apihub/v1/host_project_registration_service_pb.rb +53 -0
  64. data/lib/google/cloud/apihub/v1/host_project_registration_service_services_pb.rb +53 -0
  65. data/lib/google/cloud/apihub/v1/linting_service_pb.rb +56 -0
  66. data/lib/google/cloud/apihub/v1/linting_service_services_pb.rb +53 -0
  67. data/lib/google/cloud/apihub/v1/plugin_service_pb.rb +53 -0
  68. data/lib/google/cloud/apihub/v1/plugin_service_services_pb.rb +51 -0
  69. data/lib/google/cloud/apihub/v1/provisioning_service_pb.rb +53 -0
  70. data/lib/google/cloud/apihub/v1/provisioning_service_services_pb.rb +50 -0
  71. data/lib/google/cloud/apihub/v1/runtime_project_attachment_service_pb.rb +57 -0
  72. data/lib/google/cloud/apihub/v1/runtime_project_attachment_service_services_pb.rb +55 -0
  73. data/lib/google-cloud-api_hub-v1.rb +21 -0
  74. data/proto_docs/README.md +4 -0
  75. data/proto_docs/google/api/client.rb +420 -0
  76. data/proto_docs/google/api/field_behavior.rb +85 -0
  77. data/proto_docs/google/api/launch_stage.rb +71 -0
  78. data/proto_docs/google/api/resource.rb +227 -0
  79. data/proto_docs/google/cloud/apihub/v1/apihub_service.rb +1317 -0
  80. data/proto_docs/google/cloud/apihub/v1/common_fields.rb +1296 -0
  81. data/proto_docs/google/cloud/apihub/v1/host_project_registration_service.rb +146 -0
  82. data/proto_docs/google/cloud/apihub/v1/linting_service.rb +103 -0
  83. data/proto_docs/google/cloud/apihub/v1/plugin_service.rb +104 -0
  84. data/proto_docs/google/cloud/apihub/v1/provisioning_service.rb +87 -0
  85. data/proto_docs/google/cloud/apihub/v1/runtime_project_attachment_service.rb +182 -0
  86. data/proto_docs/google/longrunning/operations.rb +164 -0
  87. data/proto_docs/google/protobuf/any.rb +145 -0
  88. data/proto_docs/google/protobuf/duration.rb +98 -0
  89. data/proto_docs/google/protobuf/empty.rb +34 -0
  90. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  91. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  92. data/proto_docs/google/rpc/status.rb +48 -0
  93. metadata +155 -10
@@ -0,0 +1,744 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/apihub/v1/linting_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module ApiHub
26
+ module V1
27
+ module LintingService
28
+ ##
29
+ # Client for the LintingService service.
30
+ #
31
+ # This service provides all methods related to the 1p Linter.
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "apihub.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :linting_service_stub
44
+
45
+ ##
46
+ # Configure the LintingService Client class.
47
+ #
48
+ # See {::Google::Cloud::ApiHub::V1::LintingService::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all LintingService clients
54
+ # ::Google::Cloud::ApiHub::V1::LintingService::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "ApiHub", "V1"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.rpcs.get_style_guide.timeout = 60.0
75
+ default_config.rpcs.get_style_guide.retry_policy = {
76
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
77
+ }
78
+
79
+ default_config.rpcs.update_style_guide.timeout = 60.0
80
+
81
+ default_config.rpcs.get_style_guide_contents.timeout = 60.0
82
+ default_config.rpcs.get_style_guide_contents.retry_policy = {
83
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.lint_spec.timeout = 60.0
87
+
88
+ default_config
89
+ end
90
+ yield @configure if block_given?
91
+ @configure
92
+ end
93
+
94
+ ##
95
+ # Configure the LintingService Client instance.
96
+ #
97
+ # The configuration is set to the derived mode, meaning that values can be changed,
98
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
99
+ # should be made on {Client.configure}.
100
+ #
101
+ # See {::Google::Cloud::ApiHub::V1::LintingService::Client::Configuration}
102
+ # for a description of the configuration fields.
103
+ #
104
+ # @yield [config] Configure the Client client.
105
+ # @yieldparam config [Client::Configuration]
106
+ #
107
+ # @return [Client::Configuration]
108
+ #
109
+ def configure
110
+ yield @config if block_given?
111
+ @config
112
+ end
113
+
114
+ ##
115
+ # The effective universe domain
116
+ #
117
+ # @return [String]
118
+ #
119
+ def universe_domain
120
+ @linting_service_stub.universe_domain
121
+ end
122
+
123
+ ##
124
+ # Create a new LintingService client object.
125
+ #
126
+ # @example
127
+ #
128
+ # # Create a client using the default configuration
129
+ # client = ::Google::Cloud::ApiHub::V1::LintingService::Client.new
130
+ #
131
+ # # Create a client using a custom configuration
132
+ # client = ::Google::Cloud::ApiHub::V1::LintingService::Client.new do |config|
133
+ # config.timeout = 10.0
134
+ # end
135
+ #
136
+ # @yield [config] Configure the LintingService client.
137
+ # @yieldparam config [Client::Configuration]
138
+ #
139
+ def initialize
140
+ # These require statements are intentionally placed here to initialize
141
+ # the gRPC module only when it's required.
142
+ # See https://github.com/googleapis/toolkit/issues/446
143
+ require "gapic/grpc"
144
+ require "google/cloud/apihub/v1/linting_service_services_pb"
145
+
146
+ # Create the configuration object
147
+ @config = Configuration.new Client.configure
148
+
149
+ # Yield the configuration if needed
150
+ yield @config if block_given?
151
+
152
+ # Create credentials
153
+ credentials = @config.credentials
154
+ # Use self-signed JWT if the endpoint is unchanged from default,
155
+ # but only if the default endpoint does not have a region prefix.
156
+ enable_self_signed_jwt = @config.endpoint.nil? ||
157
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
158
+ !@config.endpoint.split(".").first.include?("-"))
159
+ credentials ||= Credentials.default scope: @config.scope,
160
+ enable_self_signed_jwt: enable_self_signed_jwt
161
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
162
+ credentials = Credentials.new credentials, scope: @config.scope
163
+ end
164
+ @quota_project_id = @config.quota_project
165
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
166
+
167
+ @linting_service_stub = ::Gapic::ServiceStub.new(
168
+ ::Google::Cloud::ApiHub::V1::LintingService::Stub,
169
+ credentials: credentials,
170
+ endpoint: @config.endpoint,
171
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
172
+ universe_domain: @config.universe_domain,
173
+ channel_args: @config.channel_args,
174
+ interceptors: @config.interceptors,
175
+ channel_pool_config: @config.channel_pool
176
+ )
177
+
178
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
179
+ config.credentials = credentials
180
+ config.quota_project = @quota_project_id
181
+ config.endpoint = @linting_service_stub.endpoint
182
+ config.universe_domain = @linting_service_stub.universe_domain
183
+ end
184
+ end
185
+
186
+ ##
187
+ # Get the associated client for mix-in of the Locations.
188
+ #
189
+ # @return [Google::Cloud::Location::Locations::Client]
190
+ #
191
+ attr_reader :location_client
192
+
193
+ # Service calls
194
+
195
+ ##
196
+ # Get the style guide being used for linting.
197
+ #
198
+ # @overload get_style_guide(request, options = nil)
199
+ # Pass arguments to `get_style_guide` via a request object, either of type
200
+ # {::Google::Cloud::ApiHub::V1::GetStyleGuideRequest} or an equivalent Hash.
201
+ #
202
+ # @param request [::Google::Cloud::ApiHub::V1::GetStyleGuideRequest, ::Hash]
203
+ # A request object representing the call parameters. Required. To specify no
204
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
205
+ # @param options [::Gapic::CallOptions, ::Hash]
206
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
207
+ #
208
+ # @overload get_style_guide(name: nil)
209
+ # Pass arguments to `get_style_guide` via keyword arguments. Note that at
210
+ # least one keyword argument is required. To specify no parameters, or to keep all
211
+ # the default parameter values, pass an empty Hash as a request object (see above).
212
+ #
213
+ # @param name [::String]
214
+ # Required. The name of the spec to retrieve.
215
+ # Format:
216
+ # `projects/{project}/locations/{location}/plugins/{plugin}/styleGuide`.
217
+ #
218
+ # @yield [response, operation] Access the result along with the RPC operation
219
+ # @yieldparam response [::Google::Cloud::ApiHub::V1::StyleGuide]
220
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
221
+ #
222
+ # @return [::Google::Cloud::ApiHub::V1::StyleGuide]
223
+ #
224
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/cloud/api_hub/v1"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Cloud::ApiHub::V1::LintingService::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Cloud::ApiHub::V1::GetStyleGuideRequest.new
234
+ #
235
+ # # Call the get_style_guide method.
236
+ # result = client.get_style_guide request
237
+ #
238
+ # # The returned object is of type Google::Cloud::ApiHub::V1::StyleGuide.
239
+ # p result
240
+ #
241
+ def get_style_guide request, options = nil
242
+ raise ::ArgumentError, "request must be provided" if request.nil?
243
+
244
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiHub::V1::GetStyleGuideRequest
245
+
246
+ # Converts hash and nil to an options object
247
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
248
+
249
+ # Customize the options with defaults
250
+ metadata = @config.rpcs.get_style_guide.metadata.to_h
251
+
252
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
253
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
254
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
255
+ gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
256
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
257
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
258
+
259
+ header_params = {}
260
+ if request.name
261
+ header_params["name"] = request.name
262
+ end
263
+
264
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
265
+ metadata[:"x-goog-request-params"] ||= request_params_header
266
+
267
+ options.apply_defaults timeout: @config.rpcs.get_style_guide.timeout,
268
+ metadata: metadata,
269
+ retry_policy: @config.rpcs.get_style_guide.retry_policy
270
+
271
+ options.apply_defaults timeout: @config.timeout,
272
+ metadata: @config.metadata,
273
+ retry_policy: @config.retry_policy
274
+
275
+ @linting_service_stub.call_rpc :get_style_guide, request, options: options do |response, operation|
276
+ yield response, operation if block_given?
277
+ return response
278
+ end
279
+ rescue ::GRPC::BadStatus => e
280
+ raise ::Google::Cloud::Error.from_error(e)
281
+ end
282
+
283
+ ##
284
+ # Update the styleGuide to be used for liniting in by API hub.
285
+ #
286
+ # @overload update_style_guide(request, options = nil)
287
+ # Pass arguments to `update_style_guide` via a request object, either of type
288
+ # {::Google::Cloud::ApiHub::V1::UpdateStyleGuideRequest} or an equivalent Hash.
289
+ #
290
+ # @param request [::Google::Cloud::ApiHub::V1::UpdateStyleGuideRequest, ::Hash]
291
+ # A request object representing the call parameters. Required. To specify no
292
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
293
+ # @param options [::Gapic::CallOptions, ::Hash]
294
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
295
+ #
296
+ # @overload update_style_guide(style_guide: nil, update_mask: nil)
297
+ # Pass arguments to `update_style_guide` via keyword arguments. Note that at
298
+ # least one keyword argument is required. To specify no parameters, or to keep all
299
+ # the default parameter values, pass an empty Hash as a request object (see above).
300
+ #
301
+ # @param style_guide [::Google::Cloud::ApiHub::V1::StyleGuide, ::Hash]
302
+ # Required. The Style guide resource to update.
303
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
304
+ # Optional. The list of fields to update.
305
+ #
306
+ # @yield [response, operation] Access the result along with the RPC operation
307
+ # @yieldparam response [::Google::Cloud::ApiHub::V1::StyleGuide]
308
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
309
+ #
310
+ # @return [::Google::Cloud::ApiHub::V1::StyleGuide]
311
+ #
312
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
313
+ #
314
+ # @example Basic example
315
+ # require "google/cloud/api_hub/v1"
316
+ #
317
+ # # Create a client object. The client can be reused for multiple calls.
318
+ # client = Google::Cloud::ApiHub::V1::LintingService::Client.new
319
+ #
320
+ # # Create a request. To set request fields, pass in keyword arguments.
321
+ # request = Google::Cloud::ApiHub::V1::UpdateStyleGuideRequest.new
322
+ #
323
+ # # Call the update_style_guide method.
324
+ # result = client.update_style_guide request
325
+ #
326
+ # # The returned object is of type Google::Cloud::ApiHub::V1::StyleGuide.
327
+ # p result
328
+ #
329
+ def update_style_guide request, options = nil
330
+ raise ::ArgumentError, "request must be provided" if request.nil?
331
+
332
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiHub::V1::UpdateStyleGuideRequest
333
+
334
+ # Converts hash and nil to an options object
335
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
336
+
337
+ # Customize the options with defaults
338
+ metadata = @config.rpcs.update_style_guide.metadata.to_h
339
+
340
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
341
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
342
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
343
+ gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
344
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
345
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
346
+
347
+ header_params = {}
348
+ if request.style_guide&.name
349
+ header_params["style_guide.name"] = request.style_guide.name
350
+ end
351
+
352
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
353
+ metadata[:"x-goog-request-params"] ||= request_params_header
354
+
355
+ options.apply_defaults timeout: @config.rpcs.update_style_guide.timeout,
356
+ metadata: metadata,
357
+ retry_policy: @config.rpcs.update_style_guide.retry_policy
358
+
359
+ options.apply_defaults timeout: @config.timeout,
360
+ metadata: @config.metadata,
361
+ retry_policy: @config.retry_policy
362
+
363
+ @linting_service_stub.call_rpc :update_style_guide, request, options: options do |response, operation|
364
+ yield response, operation if block_given?
365
+ return response
366
+ end
367
+ rescue ::GRPC::BadStatus => e
368
+ raise ::Google::Cloud::Error.from_error(e)
369
+ end
370
+
371
+ ##
372
+ # Get the contents of the style guide.
373
+ #
374
+ # @overload get_style_guide_contents(request, options = nil)
375
+ # Pass arguments to `get_style_guide_contents` via a request object, either of type
376
+ # {::Google::Cloud::ApiHub::V1::GetStyleGuideContentsRequest} or an equivalent Hash.
377
+ #
378
+ # @param request [::Google::Cloud::ApiHub::V1::GetStyleGuideContentsRequest, ::Hash]
379
+ # A request object representing the call parameters. Required. To specify no
380
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
381
+ # @param options [::Gapic::CallOptions, ::Hash]
382
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
383
+ #
384
+ # @overload get_style_guide_contents(name: nil)
385
+ # Pass arguments to `get_style_guide_contents` via keyword arguments. Note that at
386
+ # least one keyword argument is required. To specify no parameters, or to keep all
387
+ # the default parameter values, pass an empty Hash as a request object (see above).
388
+ #
389
+ # @param name [::String]
390
+ # Required. The name of the StyleGuide whose contents need to be retrieved.
391
+ # There is exactly one style guide resource per project per location.
392
+ # The expected format is
393
+ # `projects/{project}/locations/{location}/plugins/{plugin}/styleGuide`.
394
+ #
395
+ # @yield [response, operation] Access the result along with the RPC operation
396
+ # @yieldparam response [::Google::Cloud::ApiHub::V1::StyleGuideContents]
397
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
398
+ #
399
+ # @return [::Google::Cloud::ApiHub::V1::StyleGuideContents]
400
+ #
401
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
402
+ #
403
+ # @example Basic example
404
+ # require "google/cloud/api_hub/v1"
405
+ #
406
+ # # Create a client object. The client can be reused for multiple calls.
407
+ # client = Google::Cloud::ApiHub::V1::LintingService::Client.new
408
+ #
409
+ # # Create a request. To set request fields, pass in keyword arguments.
410
+ # request = Google::Cloud::ApiHub::V1::GetStyleGuideContentsRequest.new
411
+ #
412
+ # # Call the get_style_guide_contents method.
413
+ # result = client.get_style_guide_contents request
414
+ #
415
+ # # The returned object is of type Google::Cloud::ApiHub::V1::StyleGuideContents.
416
+ # p result
417
+ #
418
+ def get_style_guide_contents request, options = nil
419
+ raise ::ArgumentError, "request must be provided" if request.nil?
420
+
421
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiHub::V1::GetStyleGuideContentsRequest
422
+
423
+ # Converts hash and nil to an options object
424
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
425
+
426
+ # Customize the options with defaults
427
+ metadata = @config.rpcs.get_style_guide_contents.metadata.to_h
428
+
429
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
430
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
431
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
432
+ gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
433
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
434
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
435
+
436
+ header_params = {}
437
+ if request.name
438
+ header_params["name"] = request.name
439
+ end
440
+
441
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
442
+ metadata[:"x-goog-request-params"] ||= request_params_header
443
+
444
+ options.apply_defaults timeout: @config.rpcs.get_style_guide_contents.timeout,
445
+ metadata: metadata,
446
+ retry_policy: @config.rpcs.get_style_guide_contents.retry_policy
447
+
448
+ options.apply_defaults timeout: @config.timeout,
449
+ metadata: @config.metadata,
450
+ retry_policy: @config.retry_policy
451
+
452
+ @linting_service_stub.call_rpc :get_style_guide_contents, request, options: options do |response, operation|
453
+ yield response, operation if block_given?
454
+ return response
455
+ end
456
+ rescue ::GRPC::BadStatus => e
457
+ raise ::Google::Cloud::Error.from_error(e)
458
+ end
459
+
460
+ ##
461
+ # Lints the requested spec and updates the corresponding API Spec with the
462
+ # lint response. This lint response will be available in all subsequent
463
+ # Get and List Spec calls to Core service.
464
+ #
465
+ # @overload lint_spec(request, options = nil)
466
+ # Pass arguments to `lint_spec` via a request object, either of type
467
+ # {::Google::Cloud::ApiHub::V1::LintSpecRequest} or an equivalent Hash.
468
+ #
469
+ # @param request [::Google::Cloud::ApiHub::V1::LintSpecRequest, ::Hash]
470
+ # A request object representing the call parameters. Required. To specify no
471
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
472
+ # @param options [::Gapic::CallOptions, ::Hash]
473
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
474
+ #
475
+ # @overload lint_spec(name: nil)
476
+ # Pass arguments to `lint_spec` via keyword arguments. Note that at
477
+ # least one keyword argument is required. To specify no parameters, or to keep all
478
+ # the default parameter values, pass an empty Hash as a request object (see above).
479
+ #
480
+ # @param name [::String]
481
+ # Required. The name of the spec to be linted.
482
+ # Format:
483
+ # `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
484
+ #
485
+ # @yield [response, operation] Access the result along with the RPC operation
486
+ # @yieldparam response [::Google::Protobuf::Empty]
487
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
488
+ #
489
+ # @return [::Google::Protobuf::Empty]
490
+ #
491
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
492
+ #
493
+ # @example Basic example
494
+ # require "google/cloud/api_hub/v1"
495
+ #
496
+ # # Create a client object. The client can be reused for multiple calls.
497
+ # client = Google::Cloud::ApiHub::V1::LintingService::Client.new
498
+ #
499
+ # # Create a request. To set request fields, pass in keyword arguments.
500
+ # request = Google::Cloud::ApiHub::V1::LintSpecRequest.new
501
+ #
502
+ # # Call the lint_spec method.
503
+ # result = client.lint_spec request
504
+ #
505
+ # # The returned object is of type Google::Protobuf::Empty.
506
+ # p result
507
+ #
508
+ def lint_spec request, options = nil
509
+ raise ::ArgumentError, "request must be provided" if request.nil?
510
+
511
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiHub::V1::LintSpecRequest
512
+
513
+ # Converts hash and nil to an options object
514
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
515
+
516
+ # Customize the options with defaults
517
+ metadata = @config.rpcs.lint_spec.metadata.to_h
518
+
519
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
520
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
521
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
522
+ gapic_version: ::Google::Cloud::ApiHub::V1::VERSION
523
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
524
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
525
+
526
+ header_params = {}
527
+ if request.name
528
+ header_params["name"] = request.name
529
+ end
530
+
531
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
532
+ metadata[:"x-goog-request-params"] ||= request_params_header
533
+
534
+ options.apply_defaults timeout: @config.rpcs.lint_spec.timeout,
535
+ metadata: metadata,
536
+ retry_policy: @config.rpcs.lint_spec.retry_policy
537
+
538
+ options.apply_defaults timeout: @config.timeout,
539
+ metadata: @config.metadata,
540
+ retry_policy: @config.retry_policy
541
+
542
+ @linting_service_stub.call_rpc :lint_spec, request, options: options do |response, operation|
543
+ yield response, operation if block_given?
544
+ return response
545
+ end
546
+ rescue ::GRPC::BadStatus => e
547
+ raise ::Google::Cloud::Error.from_error(e)
548
+ end
549
+
550
+ ##
551
+ # Configuration class for the LintingService API.
552
+ #
553
+ # This class represents the configuration for LintingService,
554
+ # providing control over timeouts, retry behavior, logging, transport
555
+ # parameters, and other low-level controls. Certain parameters can also be
556
+ # applied individually to specific RPCs. See
557
+ # {::Google::Cloud::ApiHub::V1::LintingService::Client::Configuration::Rpcs}
558
+ # for a list of RPCs that can be configured independently.
559
+ #
560
+ # Configuration can be applied globally to all clients, or to a single client
561
+ # on construction.
562
+ #
563
+ # @example
564
+ #
565
+ # # Modify the global config, setting the timeout for
566
+ # # get_style_guide to 20 seconds,
567
+ # # and all remaining timeouts to 10 seconds.
568
+ # ::Google::Cloud::ApiHub::V1::LintingService::Client.configure do |config|
569
+ # config.timeout = 10.0
570
+ # config.rpcs.get_style_guide.timeout = 20.0
571
+ # end
572
+ #
573
+ # # Apply the above configuration only to a new client.
574
+ # client = ::Google::Cloud::ApiHub::V1::LintingService::Client.new do |config|
575
+ # config.timeout = 10.0
576
+ # config.rpcs.get_style_guide.timeout = 20.0
577
+ # end
578
+ #
579
+ # @!attribute [rw] endpoint
580
+ # A custom service endpoint, as a hostname or hostname:port. The default is
581
+ # nil, indicating to use the default endpoint in the current universe domain.
582
+ # @return [::String,nil]
583
+ # @!attribute [rw] credentials
584
+ # Credentials to send with calls. You may provide any of the following types:
585
+ # * (`String`) The path to a service account key file in JSON format
586
+ # * (`Hash`) A service account key as a Hash
587
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
588
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
589
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
590
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
591
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
592
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
593
+ # * (`nil`) indicating no credentials
594
+ # @return [::Object]
595
+ # @!attribute [rw] scope
596
+ # The OAuth scopes
597
+ # @return [::Array<::String>]
598
+ # @!attribute [rw] lib_name
599
+ # The library name as recorded in instrumentation and logging
600
+ # @return [::String]
601
+ # @!attribute [rw] lib_version
602
+ # The library version as recorded in instrumentation and logging
603
+ # @return [::String]
604
+ # @!attribute [rw] channel_args
605
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
606
+ # `GRPC::Core::Channel` object is provided as the credential.
607
+ # @return [::Hash]
608
+ # @!attribute [rw] interceptors
609
+ # An array of interceptors that are run before calls are executed.
610
+ # @return [::Array<::GRPC::ClientInterceptor>]
611
+ # @!attribute [rw] timeout
612
+ # The call timeout in seconds.
613
+ # @return [::Numeric]
614
+ # @!attribute [rw] metadata
615
+ # Additional gRPC headers to be sent with the call.
616
+ # @return [::Hash{::Symbol=>::String}]
617
+ # @!attribute [rw] retry_policy
618
+ # The retry policy. The value is a hash with the following keys:
619
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
620
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
621
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
622
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
623
+ # trigger a retry.
624
+ # @return [::Hash]
625
+ # @!attribute [rw] quota_project
626
+ # A separate project against which to charge quota.
627
+ # @return [::String]
628
+ # @!attribute [rw] universe_domain
629
+ # The universe domain within which to make requests. This determines the
630
+ # default endpoint URL. The default value of nil uses the environment
631
+ # universe (usually the default "googleapis.com" universe).
632
+ # @return [::String,nil]
633
+ #
634
+ class Configuration
635
+ extend ::Gapic::Config
636
+
637
+ # @private
638
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
639
+ DEFAULT_ENDPOINT = "apihub.googleapis.com"
640
+
641
+ config_attr :endpoint, nil, ::String, nil
642
+ config_attr :credentials, nil do |value|
643
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
644
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
645
+ allowed.any? { |klass| klass === value }
646
+ end
647
+ config_attr :scope, nil, ::String, ::Array, nil
648
+ config_attr :lib_name, nil, ::String, nil
649
+ config_attr :lib_version, nil, ::String, nil
650
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
651
+ config_attr :interceptors, nil, ::Array, nil
652
+ config_attr :timeout, nil, ::Numeric, nil
653
+ config_attr :metadata, nil, ::Hash, nil
654
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
655
+ config_attr :quota_project, nil, ::String, nil
656
+ config_attr :universe_domain, nil, ::String, nil
657
+
658
+ # @private
659
+ def initialize parent_config = nil
660
+ @parent_config = parent_config unless parent_config.nil?
661
+
662
+ yield self if block_given?
663
+ end
664
+
665
+ ##
666
+ # Configurations for individual RPCs
667
+ # @return [Rpcs]
668
+ #
669
+ def rpcs
670
+ @rpcs ||= begin
671
+ parent_rpcs = nil
672
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
673
+ Rpcs.new parent_rpcs
674
+ end
675
+ end
676
+
677
+ ##
678
+ # Configuration for the channel pool
679
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
680
+ #
681
+ def channel_pool
682
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
683
+ end
684
+
685
+ ##
686
+ # Configuration RPC class for the LintingService API.
687
+ #
688
+ # Includes fields providing the configuration for each RPC in this service.
689
+ # Each configuration object is of type `Gapic::Config::Method` and includes
690
+ # the following configuration fields:
691
+ #
692
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
693
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
694
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
695
+ # include the following keys:
696
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
697
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
698
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
699
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
700
+ # trigger a retry.
701
+ #
702
+ class Rpcs
703
+ ##
704
+ # RPC-specific configuration for `get_style_guide`
705
+ # @return [::Gapic::Config::Method]
706
+ #
707
+ attr_reader :get_style_guide
708
+ ##
709
+ # RPC-specific configuration for `update_style_guide`
710
+ # @return [::Gapic::Config::Method]
711
+ #
712
+ attr_reader :update_style_guide
713
+ ##
714
+ # RPC-specific configuration for `get_style_guide_contents`
715
+ # @return [::Gapic::Config::Method]
716
+ #
717
+ attr_reader :get_style_guide_contents
718
+ ##
719
+ # RPC-specific configuration for `lint_spec`
720
+ # @return [::Gapic::Config::Method]
721
+ #
722
+ attr_reader :lint_spec
723
+
724
+ # @private
725
+ def initialize parent_rpcs = nil
726
+ get_style_guide_config = parent_rpcs.get_style_guide if parent_rpcs.respond_to? :get_style_guide
727
+ @get_style_guide = ::Gapic::Config::Method.new get_style_guide_config
728
+ update_style_guide_config = parent_rpcs.update_style_guide if parent_rpcs.respond_to? :update_style_guide
729
+ @update_style_guide = ::Gapic::Config::Method.new update_style_guide_config
730
+ get_style_guide_contents_config = parent_rpcs.get_style_guide_contents if parent_rpcs.respond_to? :get_style_guide_contents
731
+ @get_style_guide_contents = ::Gapic::Config::Method.new get_style_guide_contents_config
732
+ lint_spec_config = parent_rpcs.lint_spec if parent_rpcs.respond_to? :lint_spec
733
+ @lint_spec = ::Gapic::Config::Method.new lint_spec_config
734
+
735
+ yield self if block_given?
736
+ end
737
+ end
738
+ end
739
+ end
740
+ end
741
+ end
742
+ end
743
+ end
744
+ end