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