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,637 @@
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/provisioning_service_pb"
21
+ require "google/cloud/api_hub/v1/provisioning/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module ApiHub
27
+ module V1
28
+ module Provisioning
29
+ module Rest
30
+ ##
31
+ # REST client for the Provisioning service.
32
+ #
33
+ # This service is used for managing the data plane provisioning of the API hub.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "apihub.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :provisioning_stub
46
+
47
+ ##
48
+ # Configure the Provisioning Client class.
49
+ #
50
+ # See {::Google::Cloud::ApiHub::V1::Provisioning::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all Provisioning clients
56
+ # ::Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "ApiHub", "V1"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.rpcs.create_api_hub_instance.timeout = 60.0
77
+
78
+ default_config.rpcs.get_api_hub_instance.timeout = 60.0
79
+ default_config.rpcs.get_api_hub_instance.retry_policy = {
80
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
81
+ }
82
+
83
+ default_config.rpcs.lookup_api_hub_instance.timeout = 60.0
84
+ default_config.rpcs.lookup_api_hub_instance.retry_policy = {
85
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
86
+ }
87
+
88
+ default_config
89
+ end
90
+ yield @configure if block_given?
91
+ @configure
92
+ end
93
+
94
+ ##
95
+ # Configure the Provisioning 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::Provisioning::Rest::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
+ @provisioning_stub.universe_domain
121
+ end
122
+
123
+ ##
124
+ # Create a new Provisioning REST client object.
125
+ #
126
+ # @example
127
+ #
128
+ # # Create a client using the default configuration
129
+ # client = ::Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.new
130
+ #
131
+ # # Create a client using a custom configuration
132
+ # client = ::Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.new do |config|
133
+ # config.timeout = 10.0
134
+ # end
135
+ #
136
+ # @yield [config] Configure the Provisioning client.
137
+ # @yieldparam config [Client::Configuration]
138
+ #
139
+ def initialize
140
+ # Create the configuration object
141
+ @config = Configuration.new Client.configure
142
+
143
+ # Yield the configuration if needed
144
+ yield @config if block_given?
145
+
146
+ # Create credentials
147
+ credentials = @config.credentials
148
+ # Use self-signed JWT if the endpoint is unchanged from default,
149
+ # but only if the default endpoint does not have a region prefix.
150
+ enable_self_signed_jwt = @config.endpoint.nil? ||
151
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
152
+ !@config.endpoint.split(".").first.include?("-"))
153
+ credentials ||= Credentials.default scope: @config.scope,
154
+ enable_self_signed_jwt: enable_self_signed_jwt
155
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
156
+ credentials = Credentials.new credentials, scope: @config.scope
157
+ end
158
+
159
+ @quota_project_id = @config.quota_project
160
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
161
+
162
+ @operations_client = ::Google::Cloud::ApiHub::V1::Provisioning::Rest::Operations.new do |config|
163
+ config.credentials = credentials
164
+ config.quota_project = @quota_project_id
165
+ config.endpoint = @config.endpoint
166
+ config.universe_domain = @config.universe_domain
167
+ end
168
+
169
+ @provisioning_stub = ::Google::Cloud::ApiHub::V1::Provisioning::Rest::ServiceStub.new(
170
+ endpoint: @config.endpoint,
171
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
172
+ universe_domain: @config.universe_domain,
173
+ credentials: credentials
174
+ )
175
+
176
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
177
+ config.credentials = credentials
178
+ config.quota_project = @quota_project_id
179
+ config.endpoint = @provisioning_stub.endpoint
180
+ config.universe_domain = @provisioning_stub.universe_domain
181
+ config.bindings_override = @config.bindings_override
182
+ end
183
+ end
184
+
185
+ ##
186
+ # Get the associated client for long-running operations.
187
+ #
188
+ # @return [::Google::Cloud::ApiHub::V1::Provisioning::Rest::Operations]
189
+ #
190
+ attr_reader :operations_client
191
+
192
+ ##
193
+ # Get the associated client for mix-in of the Locations.
194
+ #
195
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
196
+ #
197
+ attr_reader :location_client
198
+
199
+ # Service calls
200
+
201
+ ##
202
+ # Provisions instance resources for the API Hub.
203
+ #
204
+ # @overload create_api_hub_instance(request, options = nil)
205
+ # Pass arguments to `create_api_hub_instance` via a request object, either of type
206
+ # {::Google::Cloud::ApiHub::V1::CreateApiHubInstanceRequest} or an equivalent Hash.
207
+ #
208
+ # @param request [::Google::Cloud::ApiHub::V1::CreateApiHubInstanceRequest, ::Hash]
209
+ # A request object representing the call parameters. Required. To specify no
210
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
211
+ # @param options [::Gapic::CallOptions, ::Hash]
212
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
213
+ #
214
+ # @overload create_api_hub_instance(parent: nil, api_hub_instance_id: nil, api_hub_instance: nil)
215
+ # Pass arguments to `create_api_hub_instance` via keyword arguments. Note that at
216
+ # least one keyword argument is required. To specify no parameters, or to keep all
217
+ # the default parameter values, pass an empty Hash as a request object (see above).
218
+ #
219
+ # @param parent [::String]
220
+ # Required. The parent resource for the Api Hub instance resource.
221
+ # Format: `projects/{project}/locations/{location}`
222
+ # @param api_hub_instance_id [::String]
223
+ # Optional. Identifier to assign to the Api Hub instance. Must be unique
224
+ # within scope of the parent resource. If the field is not provided, system
225
+ # generated id will be used.
226
+ #
227
+ # This value should be 4-40 characters, and valid characters
228
+ # are `/[a-z][A-Z][0-9]-_/`.
229
+ # @param api_hub_instance [::Google::Cloud::ApiHub::V1::ApiHubInstance, ::Hash]
230
+ # Required. The ApiHub instance.
231
+ # @yield [result, operation] Access the result along with the TransportOperation object
232
+ # @yieldparam result [::Gapic::Operation]
233
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
234
+ #
235
+ # @return [::Gapic::Operation]
236
+ #
237
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
238
+ #
239
+ # @example Basic example
240
+ # require "google/cloud/api_hub/v1"
241
+ #
242
+ # # Create a client object. The client can be reused for multiple calls.
243
+ # client = Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.new
244
+ #
245
+ # # Create a request. To set request fields, pass in keyword arguments.
246
+ # request = Google::Cloud::ApiHub::V1::CreateApiHubInstanceRequest.new
247
+ #
248
+ # # Call the create_api_hub_instance method.
249
+ # result = client.create_api_hub_instance request
250
+ #
251
+ # # The returned object is of type Gapic::Operation. You can use it to
252
+ # # check the status of an operation, cancel it, or wait for results.
253
+ # # Here is how to wait for a response.
254
+ # result.wait_until_done! timeout: 60
255
+ # if result.response?
256
+ # p result.response
257
+ # else
258
+ # puts "No response received."
259
+ # end
260
+ #
261
+ def create_api_hub_instance request, options = nil
262
+ raise ::ArgumentError, "request must be provided" if request.nil?
263
+
264
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiHub::V1::CreateApiHubInstanceRequest
265
+
266
+ # Converts hash and nil to an options object
267
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
268
+
269
+ # Customize the options with defaults
270
+ call_metadata = @config.rpcs.create_api_hub_instance.metadata.to_h
271
+
272
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
273
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
274
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
275
+ gapic_version: ::Google::Cloud::ApiHub::V1::VERSION,
276
+ transports_version_send: [:rest]
277
+
278
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
279
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
280
+
281
+ options.apply_defaults timeout: @config.rpcs.create_api_hub_instance.timeout,
282
+ metadata: call_metadata,
283
+ retry_policy: @config.rpcs.create_api_hub_instance.retry_policy
284
+
285
+ options.apply_defaults timeout: @config.timeout,
286
+ metadata: @config.metadata,
287
+ retry_policy: @config.retry_policy
288
+
289
+ @provisioning_stub.create_api_hub_instance request, options do |result, operation|
290
+ result = ::Gapic::Operation.new result, @operations_client, options: options
291
+ yield result, operation if block_given?
292
+ return result
293
+ end
294
+ rescue ::Gapic::Rest::Error => e
295
+ raise ::Google::Cloud::Error.from_error(e)
296
+ end
297
+
298
+ ##
299
+ # Gets details of a single API Hub instance.
300
+ #
301
+ # @overload get_api_hub_instance(request, options = nil)
302
+ # Pass arguments to `get_api_hub_instance` via a request object, either of type
303
+ # {::Google::Cloud::ApiHub::V1::GetApiHubInstanceRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Cloud::ApiHub::V1::GetApiHubInstanceRequest, ::Hash]
306
+ # A request object representing the call parameters. Required. To specify no
307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
308
+ # @param options [::Gapic::CallOptions, ::Hash]
309
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
310
+ #
311
+ # @overload get_api_hub_instance(name: nil)
312
+ # Pass arguments to `get_api_hub_instance` via keyword arguments. Note that at
313
+ # least one keyword argument is required. To specify no parameters, or to keep all
314
+ # the default parameter values, pass an empty Hash as a request object (see above).
315
+ #
316
+ # @param name [::String]
317
+ # Required. The name of the Api Hub instance to retrieve.
318
+ # Format:
319
+ # `projects/{project}/locations/{location}/apiHubInstances/{apiHubInstance}`.
320
+ # @yield [result, operation] Access the result along with the TransportOperation object
321
+ # @yieldparam result [::Google::Cloud::ApiHub::V1::ApiHubInstance]
322
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
323
+ #
324
+ # @return [::Google::Cloud::ApiHub::V1::ApiHubInstance]
325
+ #
326
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
327
+ #
328
+ # @example Basic example
329
+ # require "google/cloud/api_hub/v1"
330
+ #
331
+ # # Create a client object. The client can be reused for multiple calls.
332
+ # client = Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.new
333
+ #
334
+ # # Create a request. To set request fields, pass in keyword arguments.
335
+ # request = Google::Cloud::ApiHub::V1::GetApiHubInstanceRequest.new
336
+ #
337
+ # # Call the get_api_hub_instance method.
338
+ # result = client.get_api_hub_instance request
339
+ #
340
+ # # The returned object is of type Google::Cloud::ApiHub::V1::ApiHubInstance.
341
+ # p result
342
+ #
343
+ def get_api_hub_instance request, options = nil
344
+ raise ::ArgumentError, "request must be provided" if request.nil?
345
+
346
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiHub::V1::GetApiHubInstanceRequest
347
+
348
+ # Converts hash and nil to an options object
349
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
350
+
351
+ # Customize the options with defaults
352
+ call_metadata = @config.rpcs.get_api_hub_instance.metadata.to_h
353
+
354
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
355
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
356
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
357
+ gapic_version: ::Google::Cloud::ApiHub::V1::VERSION,
358
+ transports_version_send: [:rest]
359
+
360
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
361
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
362
+
363
+ options.apply_defaults timeout: @config.rpcs.get_api_hub_instance.timeout,
364
+ metadata: call_metadata,
365
+ retry_policy: @config.rpcs.get_api_hub_instance.retry_policy
366
+
367
+ options.apply_defaults timeout: @config.timeout,
368
+ metadata: @config.metadata,
369
+ retry_policy: @config.retry_policy
370
+
371
+ @provisioning_stub.get_api_hub_instance request, options do |result, operation|
372
+ yield result, operation if block_given?
373
+ return result
374
+ end
375
+ rescue ::Gapic::Rest::Error => e
376
+ raise ::Google::Cloud::Error.from_error(e)
377
+ end
378
+
379
+ ##
380
+ # Looks up an Api Hub instance in a given GCP project. There will always be
381
+ # only one Api Hub instance for a GCP project across all locations.
382
+ #
383
+ # @overload lookup_api_hub_instance(request, options = nil)
384
+ # Pass arguments to `lookup_api_hub_instance` via a request object, either of type
385
+ # {::Google::Cloud::ApiHub::V1::LookupApiHubInstanceRequest} or an equivalent Hash.
386
+ #
387
+ # @param request [::Google::Cloud::ApiHub::V1::LookupApiHubInstanceRequest, ::Hash]
388
+ # A request object representing the call parameters. Required. To specify no
389
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
390
+ # @param options [::Gapic::CallOptions, ::Hash]
391
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
392
+ #
393
+ # @overload lookup_api_hub_instance(parent: nil)
394
+ # Pass arguments to `lookup_api_hub_instance` via keyword arguments. Note that at
395
+ # least one keyword argument is required. To specify no parameters, or to keep all
396
+ # the default parameter values, pass an empty Hash as a request object (see above).
397
+ #
398
+ # @param parent [::String]
399
+ # Required. There will always be only one Api Hub instance for a GCP project
400
+ # across all locations.
401
+ # The parent resource for the Api Hub instance resource.
402
+ # Format: `projects/{project}/locations/{location}`
403
+ # @yield [result, operation] Access the result along with the TransportOperation object
404
+ # @yieldparam result [::Google::Cloud::ApiHub::V1::LookupApiHubInstanceResponse]
405
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
406
+ #
407
+ # @return [::Google::Cloud::ApiHub::V1::LookupApiHubInstanceResponse]
408
+ #
409
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
410
+ #
411
+ # @example Basic example
412
+ # require "google/cloud/api_hub/v1"
413
+ #
414
+ # # Create a client object. The client can be reused for multiple calls.
415
+ # client = Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.new
416
+ #
417
+ # # Create a request. To set request fields, pass in keyword arguments.
418
+ # request = Google::Cloud::ApiHub::V1::LookupApiHubInstanceRequest.new
419
+ #
420
+ # # Call the lookup_api_hub_instance method.
421
+ # result = client.lookup_api_hub_instance request
422
+ #
423
+ # # The returned object is of type Google::Cloud::ApiHub::V1::LookupApiHubInstanceResponse.
424
+ # p result
425
+ #
426
+ def lookup_api_hub_instance request, options = nil
427
+ raise ::ArgumentError, "request must be provided" if request.nil?
428
+
429
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ApiHub::V1::LookupApiHubInstanceRequest
430
+
431
+ # Converts hash and nil to an options object
432
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
433
+
434
+ # Customize the options with defaults
435
+ call_metadata = @config.rpcs.lookup_api_hub_instance.metadata.to_h
436
+
437
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
438
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
439
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
440
+ gapic_version: ::Google::Cloud::ApiHub::V1::VERSION,
441
+ transports_version_send: [:rest]
442
+
443
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
444
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
445
+
446
+ options.apply_defaults timeout: @config.rpcs.lookup_api_hub_instance.timeout,
447
+ metadata: call_metadata,
448
+ retry_policy: @config.rpcs.lookup_api_hub_instance.retry_policy
449
+
450
+ options.apply_defaults timeout: @config.timeout,
451
+ metadata: @config.metadata,
452
+ retry_policy: @config.retry_policy
453
+
454
+ @provisioning_stub.lookup_api_hub_instance request, options do |result, operation|
455
+ yield result, operation if block_given?
456
+ return result
457
+ end
458
+ rescue ::Gapic::Rest::Error => e
459
+ raise ::Google::Cloud::Error.from_error(e)
460
+ end
461
+
462
+ ##
463
+ # Configuration class for the Provisioning REST API.
464
+ #
465
+ # This class represents the configuration for Provisioning REST,
466
+ # providing control over timeouts, retry behavior, logging, transport
467
+ # parameters, and other low-level controls. Certain parameters can also be
468
+ # applied individually to specific RPCs. See
469
+ # {::Google::Cloud::ApiHub::V1::Provisioning::Rest::Client::Configuration::Rpcs}
470
+ # for a list of RPCs that can be configured independently.
471
+ #
472
+ # Configuration can be applied globally to all clients, or to a single client
473
+ # on construction.
474
+ #
475
+ # @example
476
+ #
477
+ # # Modify the global config, setting the timeout for
478
+ # # create_api_hub_instance to 20 seconds,
479
+ # # and all remaining timeouts to 10 seconds.
480
+ # ::Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.configure do |config|
481
+ # config.timeout = 10.0
482
+ # config.rpcs.create_api_hub_instance.timeout = 20.0
483
+ # end
484
+ #
485
+ # # Apply the above configuration only to a new client.
486
+ # client = ::Google::Cloud::ApiHub::V1::Provisioning::Rest::Client.new do |config|
487
+ # config.timeout = 10.0
488
+ # config.rpcs.create_api_hub_instance.timeout = 20.0
489
+ # end
490
+ #
491
+ # @!attribute [rw] endpoint
492
+ # A custom service endpoint, as a hostname or hostname:port. The default is
493
+ # nil, indicating to use the default endpoint in the current universe domain.
494
+ # @return [::String,nil]
495
+ # @!attribute [rw] credentials
496
+ # Credentials to send with calls. You may provide any of the following types:
497
+ # * (`String`) The path to a service account key file in JSON format
498
+ # * (`Hash`) A service account key as a Hash
499
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
500
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
501
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
502
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
503
+ # * (`nil`) indicating no credentials
504
+ # @return [::Object]
505
+ # @!attribute [rw] scope
506
+ # The OAuth scopes
507
+ # @return [::Array<::String>]
508
+ # @!attribute [rw] lib_name
509
+ # The library name as recorded in instrumentation and logging
510
+ # @return [::String]
511
+ # @!attribute [rw] lib_version
512
+ # The library version as recorded in instrumentation and logging
513
+ # @return [::String]
514
+ # @!attribute [rw] timeout
515
+ # The call timeout in seconds.
516
+ # @return [::Numeric]
517
+ # @!attribute [rw] metadata
518
+ # Additional 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
+ #
537
+ class Configuration
538
+ extend ::Gapic::Config
539
+
540
+ # @private
541
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
542
+ DEFAULT_ENDPOINT = "apihub.googleapis.com"
543
+
544
+ config_attr :endpoint, nil, ::String, nil
545
+ config_attr :credentials, nil do |value|
546
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
547
+ allowed.any? { |klass| klass === value }
548
+ end
549
+ config_attr :scope, nil, ::String, ::Array, nil
550
+ config_attr :lib_name, nil, ::String, nil
551
+ config_attr :lib_version, nil, ::String, nil
552
+ config_attr :timeout, nil, ::Numeric, nil
553
+ config_attr :metadata, nil, ::Hash, nil
554
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
555
+ config_attr :quota_project, nil, ::String, nil
556
+ config_attr :universe_domain, nil, ::String, nil
557
+
558
+ # @private
559
+ # Overrides for http bindings for the RPCs of this service
560
+ # are only used when this service is used as mixin, and only
561
+ # by the host service.
562
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
563
+ config_attr :bindings_override, {}, ::Hash, nil
564
+
565
+ # @private
566
+ def initialize parent_config = nil
567
+ @parent_config = parent_config unless parent_config.nil?
568
+
569
+ yield self if block_given?
570
+ end
571
+
572
+ ##
573
+ # Configurations for individual RPCs
574
+ # @return [Rpcs]
575
+ #
576
+ def rpcs
577
+ @rpcs ||= begin
578
+ parent_rpcs = nil
579
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
580
+ Rpcs.new parent_rpcs
581
+ end
582
+ end
583
+
584
+ ##
585
+ # Configuration RPC class for the Provisioning API.
586
+ #
587
+ # Includes fields providing the configuration for each RPC in this service.
588
+ # Each configuration object is of type `Gapic::Config::Method` and includes
589
+ # the following configuration fields:
590
+ #
591
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
592
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
593
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
594
+ # include the following keys:
595
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
596
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
597
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
598
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
599
+ # trigger a retry.
600
+ #
601
+ class Rpcs
602
+ ##
603
+ # RPC-specific configuration for `create_api_hub_instance`
604
+ # @return [::Gapic::Config::Method]
605
+ #
606
+ attr_reader :create_api_hub_instance
607
+ ##
608
+ # RPC-specific configuration for `get_api_hub_instance`
609
+ # @return [::Gapic::Config::Method]
610
+ #
611
+ attr_reader :get_api_hub_instance
612
+ ##
613
+ # RPC-specific configuration for `lookup_api_hub_instance`
614
+ # @return [::Gapic::Config::Method]
615
+ #
616
+ attr_reader :lookup_api_hub_instance
617
+
618
+ # @private
619
+ def initialize parent_rpcs = nil
620
+ create_api_hub_instance_config = parent_rpcs.create_api_hub_instance if parent_rpcs.respond_to? :create_api_hub_instance
621
+ @create_api_hub_instance = ::Gapic::Config::Method.new create_api_hub_instance_config
622
+ get_api_hub_instance_config = parent_rpcs.get_api_hub_instance if parent_rpcs.respond_to? :get_api_hub_instance
623
+ @get_api_hub_instance = ::Gapic::Config::Method.new get_api_hub_instance_config
624
+ lookup_api_hub_instance_config = parent_rpcs.lookup_api_hub_instance if parent_rpcs.respond_to? :lookup_api_hub_instance
625
+ @lookup_api_hub_instance = ::Gapic::Config::Method.new lookup_api_hub_instance_config
626
+
627
+ yield self if block_given?
628
+ end
629
+ end
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end