google-cloud-vpc_access-v1 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/vpc_access/v1"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/vpc_access/v1/vpc_access_service"
20
+ require "google/cloud/vpc_access/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module VpcAccess
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/vpc_access/v1"
29
+ # client = ::Google::Cloud::VpcAccess::V1::VpcAccessService::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/vpc_access/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module VpcAccess
23
+ module V1
24
+ VERSION = "0.1.0"
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/vpc_access/v1/version"
24
+
25
+ require "google/cloud/vpc_access/v1/vpc_access_service/credentials"
26
+ require "google/cloud/vpc_access/v1/vpc_access_service/paths"
27
+ require "google/cloud/vpc_access/v1/vpc_access_service/operations"
28
+ require "google/cloud/vpc_access/v1/vpc_access_service/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module VpcAccess
33
+ module V1
34
+ ##
35
+ # Serverless VPC Access API allows users to create and manage connectors for
36
+ # App Engine, Cloud Functions and Cloud Run to have internal connections to
37
+ # Virtual Private Cloud networks.
38
+ #
39
+ # To load this service and instantiate a client:
40
+ #
41
+ # require "google/cloud/vpc_access/v1/vpc_access_service"
42
+ # client = ::Google::Cloud::VpcAccess::V1::VpcAccessService::Client.new
43
+ #
44
+ module VpcAccessService
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "vpc_access_service", "helpers.rb"
52
+ require "google/cloud/vpc_access/v1/vpc_access_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,638 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/vpcaccess/v1/vpc_access_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module VpcAccess
25
+ module V1
26
+ module VpcAccessService
27
+ ##
28
+ # Client for the VpcAccessService service.
29
+ #
30
+ # Serverless VPC Access API allows users to create and manage connectors for
31
+ # App Engine, Cloud Functions and Cloud Run to have internal connections to
32
+ # Virtual Private Cloud networks.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :vpc_access_service_stub
39
+
40
+ ##
41
+ # Configure the VpcAccessService Client class.
42
+ #
43
+ # See {::Google::Cloud::VpcAccess::V1::VpcAccessService::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # ## Example
47
+ #
48
+ # To modify the configuration for all VpcAccessService clients:
49
+ #
50
+ # ::Google::Cloud::VpcAccess::V1::VpcAccessService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "VpcAccess", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 1.0,
73
+ max_delay: 60.0,
74
+ multiplier: 1.3,
75
+ retry_codes: [14, 2]
76
+ }
77
+
78
+ default_config.rpcs.create_connector.timeout = 60.0
79
+
80
+ default_config.rpcs.get_connector.timeout = 60.0
81
+
82
+ default_config.rpcs.list_connectors.timeout = 60.0
83
+
84
+ default_config.rpcs.delete_connector.timeout = 60.0
85
+
86
+ default_config
87
+ end
88
+ yield @configure if block_given?
89
+ @configure
90
+ end
91
+
92
+ ##
93
+ # Configure the VpcAccessService 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::VpcAccess::V1::VpcAccessService::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
+ # Create a new VpcAccessService client object.
114
+ #
115
+ # ## Examples
116
+ #
117
+ # To create a new VpcAccessService client with the default
118
+ # configuration:
119
+ #
120
+ # client = ::Google::Cloud::VpcAccess::V1::VpcAccessService::Client.new
121
+ #
122
+ # To create a new VpcAccessService client with a custom
123
+ # configuration:
124
+ #
125
+ # client = ::Google::Cloud::VpcAccess::V1::VpcAccessService::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the VpcAccessService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # These require statements are intentionally placed here to initialize
134
+ # the gRPC module only when it's required.
135
+ # See https://github.com/googleapis/toolkit/issues/446
136
+ require "gapic/grpc"
137
+ require "google/cloud/vpcaccess/v1/vpc_access_services_pb"
138
+
139
+ # Create the configuration object
140
+ @config = Configuration.new Client.configure
141
+
142
+ # Yield the configuration if needed
143
+ yield @config if block_given?
144
+
145
+ # Create credentials
146
+ credentials = @config.credentials
147
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
148
+ # but only if the default endpoint does not have a region prefix.
149
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
150
+ @config.endpoint == Client.configure.endpoint &&
151
+ !@config.endpoint.split(".").first.include?("-")
152
+ credentials ||= Credentials.default scope: @config.scope,
153
+ enable_self_signed_jwt: enable_self_signed_jwt
154
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
155
+ credentials = Credentials.new credentials, scope: @config.scope
156
+ end
157
+ @quota_project_id = @config.quota_project
158
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
159
+
160
+ @operations_client = Operations.new do |config|
161
+ config.credentials = credentials
162
+ config.endpoint = @config.endpoint
163
+ end
164
+
165
+ @vpc_access_service_stub = ::Gapic::ServiceStub.new(
166
+ ::Google::Cloud::VpcAccess::V1::VpcAccessService::Stub,
167
+ credentials: credentials,
168
+ endpoint: @config.endpoint,
169
+ channel_args: @config.channel_args,
170
+ interceptors: @config.interceptors
171
+ )
172
+ end
173
+
174
+ ##
175
+ # Get the associated client for long-running operations.
176
+ #
177
+ # @return [::Google::Cloud::VpcAccess::V1::VpcAccessService::Operations]
178
+ #
179
+ attr_reader :operations_client
180
+
181
+ # Service calls
182
+
183
+ ##
184
+ # Creates a Serverless VPC Access connector, returns an operation.
185
+ #
186
+ # @overload create_connector(request, options = nil)
187
+ # Pass arguments to `create_connector` via a request object, either of type
188
+ # {::Google::Cloud::VpcAccess::V1::CreateConnectorRequest} or an equivalent Hash.
189
+ #
190
+ # @param request [::Google::Cloud::VpcAccess::V1::CreateConnectorRequest, ::Hash]
191
+ # A request object representing the call parameters. Required. To specify no
192
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
193
+ # @param options [::Gapic::CallOptions, ::Hash]
194
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
195
+ #
196
+ # @overload create_connector(parent: nil, connector_id: nil, connector: nil)
197
+ # Pass arguments to `create_connector` via keyword arguments. Note that at
198
+ # least one keyword argument is required. To specify no parameters, or to keep all
199
+ # the default parameter values, pass an empty Hash as a request object (see above).
200
+ #
201
+ # @param parent [::String]
202
+ # Required. The project and location in which the configuration should be created,
203
+ # specified in the format `projects/*/locations/*`.
204
+ # @param connector_id [::String]
205
+ # Required. The ID to use for this connector.
206
+ # @param connector [::Google::Cloud::VpcAccess::V1::Connector, ::Hash]
207
+ # Required. Resource to create.
208
+ #
209
+ # @yield [response, operation] Access the result along with the RPC operation
210
+ # @yieldparam response [::Gapic::Operation]
211
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
212
+ #
213
+ # @return [::Gapic::Operation]
214
+ #
215
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
216
+ #
217
+ def create_connector request, options = nil
218
+ raise ::ArgumentError, "request must be provided" if request.nil?
219
+
220
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VpcAccess::V1::CreateConnectorRequest
221
+
222
+ # Converts hash and nil to an options object
223
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
224
+
225
+ # Customize the options with defaults
226
+ metadata = @config.rpcs.create_connector.metadata.to_h
227
+
228
+ # Set x-goog-api-client and x-goog-user-project headers
229
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
230
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
231
+ gapic_version: ::Google::Cloud::VpcAccess::V1::VERSION
232
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
233
+
234
+ header_params = {
235
+ "parent" => request.parent
236
+ }
237
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
238
+ metadata[:"x-goog-request-params"] ||= request_params_header
239
+
240
+ options.apply_defaults timeout: @config.rpcs.create_connector.timeout,
241
+ metadata: metadata,
242
+ retry_policy: @config.rpcs.create_connector.retry_policy
243
+ options.apply_defaults metadata: @config.metadata,
244
+ retry_policy: @config.retry_policy
245
+
246
+ @vpc_access_service_stub.call_rpc :create_connector, request, options: options do |response, operation|
247
+ response = ::Gapic::Operation.new response, @operations_client, options: options
248
+ yield response, operation if block_given?
249
+ return response
250
+ end
251
+ rescue ::GRPC::BadStatus => e
252
+ raise ::Google::Cloud::Error.from_error(e)
253
+ end
254
+
255
+ ##
256
+ # Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource
257
+ # does not exist.
258
+ #
259
+ # @overload get_connector(request, options = nil)
260
+ # Pass arguments to `get_connector` via a request object, either of type
261
+ # {::Google::Cloud::VpcAccess::V1::GetConnectorRequest} or an equivalent Hash.
262
+ #
263
+ # @param request [::Google::Cloud::VpcAccess::V1::GetConnectorRequest, ::Hash]
264
+ # A request object representing the call parameters. Required. To specify no
265
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
266
+ # @param options [::Gapic::CallOptions, ::Hash]
267
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
268
+ #
269
+ # @overload get_connector(name: nil)
270
+ # Pass arguments to `get_connector` via keyword arguments. Note that at
271
+ # least one keyword argument is required. To specify no parameters, or to keep all
272
+ # the default parameter values, pass an empty Hash as a request object (see above).
273
+ #
274
+ # @param name [::String]
275
+ # Required. Name of a Serverless VPC Access connector to get.
276
+ #
277
+ # @yield [response, operation] Access the result along with the RPC operation
278
+ # @yieldparam response [::Google::Cloud::VpcAccess::V1::Connector]
279
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
280
+ #
281
+ # @return [::Google::Cloud::VpcAccess::V1::Connector]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
284
+ #
285
+ def get_connector request, options = nil
286
+ raise ::ArgumentError, "request must be provided" if request.nil?
287
+
288
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VpcAccess::V1::GetConnectorRequest
289
+
290
+ # Converts hash and nil to an options object
291
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
292
+
293
+ # Customize the options with defaults
294
+ metadata = @config.rpcs.get_connector.metadata.to_h
295
+
296
+ # Set x-goog-api-client and x-goog-user-project headers
297
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
299
+ gapic_version: ::Google::Cloud::VpcAccess::V1::VERSION
300
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ header_params = {
303
+ "name" => request.name
304
+ }
305
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
306
+ metadata[:"x-goog-request-params"] ||= request_params_header
307
+
308
+ options.apply_defaults timeout: @config.rpcs.get_connector.timeout,
309
+ metadata: metadata,
310
+ retry_policy: @config.rpcs.get_connector.retry_policy
311
+ options.apply_defaults metadata: @config.metadata,
312
+ retry_policy: @config.retry_policy
313
+
314
+ @vpc_access_service_stub.call_rpc :get_connector, request, options: options do |response, operation|
315
+ yield response, operation if block_given?
316
+ return response
317
+ end
318
+ rescue ::GRPC::BadStatus => e
319
+ raise ::Google::Cloud::Error.from_error(e)
320
+ end
321
+
322
+ ##
323
+ # Lists Serverless VPC Access connectors.
324
+ #
325
+ # @overload list_connectors(request, options = nil)
326
+ # Pass arguments to `list_connectors` via a request object, either of type
327
+ # {::Google::Cloud::VpcAccess::V1::ListConnectorsRequest} or an equivalent Hash.
328
+ #
329
+ # @param request [::Google::Cloud::VpcAccess::V1::ListConnectorsRequest, ::Hash]
330
+ # A request object representing the call parameters. Required. To specify no
331
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
332
+ # @param options [::Gapic::CallOptions, ::Hash]
333
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
334
+ #
335
+ # @overload list_connectors(parent: nil, page_size: nil, page_token: nil)
336
+ # Pass arguments to `list_connectors` via keyword arguments. Note that at
337
+ # least one keyword argument is required. To specify no parameters, or to keep all
338
+ # the default parameter values, pass an empty Hash as a request object (see above).
339
+ #
340
+ # @param parent [::String]
341
+ # Required. The project and location from which the routes should be listed.
342
+ # @param page_size [::Integer]
343
+ # Maximum number of functions to return per call.
344
+ # @param page_token [::String]
345
+ # Continuation token.
346
+ #
347
+ # @yield [response, operation] Access the result along with the RPC operation
348
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::VpcAccess::V1::Connector>]
349
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
350
+ #
351
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::VpcAccess::V1::Connector>]
352
+ #
353
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
354
+ #
355
+ def list_connectors request, options = nil
356
+ raise ::ArgumentError, "request must be provided" if request.nil?
357
+
358
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VpcAccess::V1::ListConnectorsRequest
359
+
360
+ # Converts hash and nil to an options object
361
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
362
+
363
+ # Customize the options with defaults
364
+ metadata = @config.rpcs.list_connectors.metadata.to_h
365
+
366
+ # Set x-goog-api-client and x-goog-user-project headers
367
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
368
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
369
+ gapic_version: ::Google::Cloud::VpcAccess::V1::VERSION
370
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
371
+
372
+ header_params = {
373
+ "parent" => request.parent
374
+ }
375
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
376
+ metadata[:"x-goog-request-params"] ||= request_params_header
377
+
378
+ options.apply_defaults timeout: @config.rpcs.list_connectors.timeout,
379
+ metadata: metadata,
380
+ retry_policy: @config.rpcs.list_connectors.retry_policy
381
+ options.apply_defaults metadata: @config.metadata,
382
+ retry_policy: @config.retry_policy
383
+
384
+ @vpc_access_service_stub.call_rpc :list_connectors, request, options: options do |response, operation|
385
+ response = ::Gapic::PagedEnumerable.new @vpc_access_service_stub, :list_connectors, request, response, operation, options
386
+ yield response, operation if block_given?
387
+ return response
388
+ end
389
+ rescue ::GRPC::BadStatus => e
390
+ raise ::Google::Cloud::Error.from_error(e)
391
+ end
392
+
393
+ ##
394
+ # Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the
395
+ # resource does not exist.
396
+ #
397
+ # @overload delete_connector(request, options = nil)
398
+ # Pass arguments to `delete_connector` via a request object, either of type
399
+ # {::Google::Cloud::VpcAccess::V1::DeleteConnectorRequest} or an equivalent Hash.
400
+ #
401
+ # @param request [::Google::Cloud::VpcAccess::V1::DeleteConnectorRequest, ::Hash]
402
+ # A request object representing the call parameters. Required. To specify no
403
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
404
+ # @param options [::Gapic::CallOptions, ::Hash]
405
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
406
+ #
407
+ # @overload delete_connector(name: nil)
408
+ # Pass arguments to `delete_connector` via keyword arguments. Note that at
409
+ # least one keyword argument is required. To specify no parameters, or to keep all
410
+ # the default parameter values, pass an empty Hash as a request object (see above).
411
+ #
412
+ # @param name [::String]
413
+ # Required. Name of a Serverless VPC Access connector to delete.
414
+ #
415
+ # @yield [response, operation] Access the result along with the RPC operation
416
+ # @yieldparam response [::Gapic::Operation]
417
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
418
+ #
419
+ # @return [::Gapic::Operation]
420
+ #
421
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
422
+ #
423
+ def delete_connector request, options = nil
424
+ raise ::ArgumentError, "request must be provided" if request.nil?
425
+
426
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VpcAccess::V1::DeleteConnectorRequest
427
+
428
+ # Converts hash and nil to an options object
429
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
430
+
431
+ # Customize the options with defaults
432
+ metadata = @config.rpcs.delete_connector.metadata.to_h
433
+
434
+ # Set x-goog-api-client and x-goog-user-project headers
435
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
436
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
437
+ gapic_version: ::Google::Cloud::VpcAccess::V1::VERSION
438
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
439
+
440
+ header_params = {
441
+ "name" => request.name
442
+ }
443
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
444
+ metadata[:"x-goog-request-params"] ||= request_params_header
445
+
446
+ options.apply_defaults timeout: @config.rpcs.delete_connector.timeout,
447
+ metadata: metadata,
448
+ retry_policy: @config.rpcs.delete_connector.retry_policy
449
+ options.apply_defaults metadata: @config.metadata,
450
+ retry_policy: @config.retry_policy
451
+
452
+ @vpc_access_service_stub.call_rpc :delete_connector, request, options: options do |response, operation|
453
+ response = ::Gapic::Operation.new response, @operations_client, options: options
454
+ yield response, operation if block_given?
455
+ return response
456
+ end
457
+ rescue ::GRPC::BadStatus => e
458
+ raise ::Google::Cloud::Error.from_error(e)
459
+ end
460
+
461
+ ##
462
+ # Configuration class for the VpcAccessService API.
463
+ #
464
+ # This class represents the configuration for VpcAccessService,
465
+ # providing control over timeouts, retry behavior, logging, transport
466
+ # parameters, and other low-level controls. Certain parameters can also be
467
+ # applied individually to specific RPCs. See
468
+ # {::Google::Cloud::VpcAccess::V1::VpcAccessService::Client::Configuration::Rpcs}
469
+ # for a list of RPCs that can be configured independently.
470
+ #
471
+ # Configuration can be applied globally to all clients, or to a single client
472
+ # on construction.
473
+ #
474
+ # # Examples
475
+ #
476
+ # To modify the global config, setting the timeout for create_connector
477
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
478
+ #
479
+ # ::Google::Cloud::VpcAccess::V1::VpcAccessService::Client.configure do |config|
480
+ # config.timeout = 10.0
481
+ # config.rpcs.create_connector.timeout = 20.0
482
+ # end
483
+ #
484
+ # To apply the above configuration only to a new client:
485
+ #
486
+ # client = ::Google::Cloud::VpcAccess::V1::VpcAccessService::Client.new do |config|
487
+ # config.timeout = 10.0
488
+ # config.rpcs.create_connector.timeout = 20.0
489
+ # end
490
+ #
491
+ # @!attribute [rw] endpoint
492
+ # The hostname or hostname:port of the service endpoint.
493
+ # Defaults to `"vpcaccess.googleapis.com"`.
494
+ # @return [::String]
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://googleapis.dev/ruby/googleauth/latest/index.html))
501
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
502
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
503
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
504
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
505
+ # * (`nil`) indicating no credentials
506
+ # @return [::Object]
507
+ # @!attribute [rw] scope
508
+ # The OAuth scopes
509
+ # @return [::Array<::String>]
510
+ # @!attribute [rw] lib_name
511
+ # The library name as recorded in instrumentation and logging
512
+ # @return [::String]
513
+ # @!attribute [rw] lib_version
514
+ # The library version as recorded in instrumentation and logging
515
+ # @return [::String]
516
+ # @!attribute [rw] channel_args
517
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
518
+ # `GRPC::Core::Channel` object is provided as the credential.
519
+ # @return [::Hash]
520
+ # @!attribute [rw] interceptors
521
+ # An array of interceptors that are run before calls are executed.
522
+ # @return [::Array<::GRPC::ClientInterceptor>]
523
+ # @!attribute [rw] timeout
524
+ # The call timeout in seconds.
525
+ # @return [::Numeric]
526
+ # @!attribute [rw] metadata
527
+ # Additional gRPC headers to be sent with the call.
528
+ # @return [::Hash{::Symbol=>::String}]
529
+ # @!attribute [rw] retry_policy
530
+ # The retry policy. The value is a hash with the following keys:
531
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
532
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
533
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
534
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
535
+ # trigger a retry.
536
+ # @return [::Hash]
537
+ # @!attribute [rw] quota_project
538
+ # A separate project against which to charge quota.
539
+ # @return [::String]
540
+ #
541
+ class Configuration
542
+ extend ::Gapic::Config
543
+
544
+ config_attr :endpoint, "vpcaccess.googleapis.com", ::String
545
+ config_attr :credentials, nil do |value|
546
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
547
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
548
+ allowed.any? { |klass| klass === value }
549
+ end
550
+ config_attr :scope, nil, ::String, ::Array, nil
551
+ config_attr :lib_name, nil, ::String, nil
552
+ config_attr :lib_version, nil, ::String, nil
553
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
554
+ config_attr :interceptors, nil, ::Array, nil
555
+ config_attr :timeout, nil, ::Numeric, nil
556
+ config_attr :metadata, nil, ::Hash, nil
557
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
+ config_attr :quota_project, nil, ::String, nil
559
+
560
+ # @private
561
+ def initialize parent_config = nil
562
+ @parent_config = parent_config unless parent_config.nil?
563
+
564
+ yield self if block_given?
565
+ end
566
+
567
+ ##
568
+ # Configurations for individual RPCs
569
+ # @return [Rpcs]
570
+ #
571
+ def rpcs
572
+ @rpcs ||= begin
573
+ parent_rpcs = nil
574
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
575
+ Rpcs.new parent_rpcs
576
+ end
577
+ end
578
+
579
+ ##
580
+ # Configuration RPC class for the VpcAccessService API.
581
+ #
582
+ # Includes fields providing the configuration for each RPC in this service.
583
+ # Each configuration object is of type `Gapic::Config::Method` and includes
584
+ # the following configuration fields:
585
+ #
586
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
587
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
588
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
589
+ # include the following keys:
590
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
591
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
592
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
593
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
594
+ # trigger a retry.
595
+ #
596
+ class Rpcs
597
+ ##
598
+ # RPC-specific configuration for `create_connector`
599
+ # @return [::Gapic::Config::Method]
600
+ #
601
+ attr_reader :create_connector
602
+ ##
603
+ # RPC-specific configuration for `get_connector`
604
+ # @return [::Gapic::Config::Method]
605
+ #
606
+ attr_reader :get_connector
607
+ ##
608
+ # RPC-specific configuration for `list_connectors`
609
+ # @return [::Gapic::Config::Method]
610
+ #
611
+ attr_reader :list_connectors
612
+ ##
613
+ # RPC-specific configuration for `delete_connector`
614
+ # @return [::Gapic::Config::Method]
615
+ #
616
+ attr_reader :delete_connector
617
+
618
+ # @private
619
+ def initialize parent_rpcs = nil
620
+ create_connector_config = parent_rpcs.create_connector if parent_rpcs.respond_to? :create_connector
621
+ @create_connector = ::Gapic::Config::Method.new create_connector_config
622
+ get_connector_config = parent_rpcs.get_connector if parent_rpcs.respond_to? :get_connector
623
+ @get_connector = ::Gapic::Config::Method.new get_connector_config
624
+ list_connectors_config = parent_rpcs.list_connectors if parent_rpcs.respond_to? :list_connectors
625
+ @list_connectors = ::Gapic::Config::Method.new list_connectors_config
626
+ delete_connector_config = parent_rpcs.delete_connector if parent_rpcs.respond_to? :delete_connector
627
+ @delete_connector = ::Gapic::Config::Method.new delete_connector_config
628
+
629
+ yield self if block_given?
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end
638
+ end