google-cloud-network_services-v1beta1 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/network_services/v1beta1/bindings_override.rb +108 -0
  6. data/lib/google/cloud/network_services/v1beta1/dep_service/client.rb +2076 -0
  7. data/lib/google/cloud/network_services/v1beta1/dep_service/credentials.rb +47 -0
  8. data/lib/google/cloud/network_services/v1beta1/dep_service/operations.rb +843 -0
  9. data/lib/google/cloud/network_services/v1beta1/dep_service/paths.rb +107 -0
  10. data/lib/google/cloud/network_services/v1beta1/dep_service/rest/client.rb +1937 -0
  11. data/lib/google/cloud/network_services/v1beta1/dep_service/rest/operations.rb +927 -0
  12. data/lib/google/cloud/network_services/v1beta1/dep_service/rest/service_stub.rb +1002 -0
  13. data/lib/google/cloud/network_services/v1beta1/dep_service/rest.rb +54 -0
  14. data/lib/google/cloud/network_services/v1beta1/dep_service.rb +56 -0
  15. data/lib/google/cloud/network_services/v1beta1/network_services/client.rb +947 -0
  16. data/lib/google/cloud/network_services/v1beta1/network_services/credentials.rb +47 -0
  17. data/lib/google/cloud/network_services/v1beta1/network_services/operations.rb +843 -0
  18. data/lib/google/cloud/network_services/v1beta1/network_services/paths.rb +126 -0
  19. data/lib/google/cloud/network_services/v1beta1/network_services/rest/client.rb +878 -0
  20. data/lib/google/cloud/network_services/v1beta1/network_services/rest/operations.rb +927 -0
  21. data/lib/google/cloud/network_services/v1beta1/network_services/rest/service_stub.rb +388 -0
  22. data/lib/google/cloud/network_services/v1beta1/network_services/rest.rb +54 -0
  23. data/lib/google/cloud/network_services/v1beta1/network_services.rb +56 -0
  24. data/lib/google/cloud/network_services/v1beta1/rest.rb +39 -0
  25. data/lib/google/cloud/network_services/v1beta1/version.rb +7 -2
  26. data/lib/google/cloud/network_services/v1beta1.rb +46 -0
  27. data/lib/google/cloud/networkservices/v1beta1/common_pb.rb +29 -0
  28. data/lib/google/cloud/networkservices/v1beta1/dep_pb.rb +67 -0
  29. data/lib/google/cloud/networkservices/v1beta1/dep_services_pb.rb +74 -0
  30. data/lib/google/cloud/networkservices/v1beta1/endpoint_policy_pb.rb +34 -0
  31. data/lib/google/cloud/networkservices/v1beta1/network_services_pb.rb +25 -0
  32. data/lib/google/cloud/networkservices/v1beta1/network_services_services_pb.rb +53 -0
  33. data/lib/google-cloud-network_services-v1beta1.rb +21 -0
  34. data/proto_docs/README.md +4 -0
  35. data/proto_docs/google/api/client.rb +593 -0
  36. data/proto_docs/google/api/field_behavior.rb +85 -0
  37. data/proto_docs/google/api/field_info.rb +88 -0
  38. data/proto_docs/google/api/launch_stage.rb +71 -0
  39. data/proto_docs/google/api/resource.rb +227 -0
  40. data/proto_docs/google/cloud/networkservices/v1beta1/common.rb +147 -0
  41. data/proto_docs/google/cloud/networkservices/v1beta1/dep.rb +928 -0
  42. data/proto_docs/google/cloud/networkservices/v1beta1/endpoint_policy.rb +196 -0
  43. data/proto_docs/google/longrunning/operations.rb +191 -0
  44. data/proto_docs/google/protobuf/any.rb +145 -0
  45. data/proto_docs/google/protobuf/duration.rb +98 -0
  46. data/proto_docs/google/protobuf/empty.rb +34 -0
  47. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  48. data/proto_docs/google/protobuf/timestamp.rb +128 -0
  49. data/proto_docs/google/rpc/status.rb +48 -0
  50. metadata +111 -9
@@ -0,0 +1,878 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/networkservices/v1beta1/network_services_pb"
21
+ require "google/cloud/network_services/v1beta1/network_services/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module NetworkServices
28
+ module V1beta1
29
+ module NetworkServices
30
+ module Rest
31
+ ##
32
+ # REST client for the NetworkServices service.
33
+ #
34
+ # Service describing handlers for resources.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "networkservices.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :network_services_stub
47
+
48
+ ##
49
+ # Configure the NetworkServices Client class.
50
+ #
51
+ # See {::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all NetworkServices clients
57
+ # ::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "NetworkServices", "V1beta1"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.timeout = 60.0
78
+
79
+ default_config
80
+ end
81
+ yield @configure if block_given?
82
+ @configure
83
+ end
84
+
85
+ ##
86
+ # Configure the NetworkServices Client instance.
87
+ #
88
+ # The configuration is set to the derived mode, meaning that values can be changed,
89
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
90
+ # should be made on {Client.configure}.
91
+ #
92
+ # See {::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client::Configuration}
93
+ # for a description of the configuration fields.
94
+ #
95
+ # @yield [config] Configure the Client client.
96
+ # @yieldparam config [Client::Configuration]
97
+ #
98
+ # @return [Client::Configuration]
99
+ #
100
+ def configure
101
+ yield @config if block_given?
102
+ @config
103
+ end
104
+
105
+ ##
106
+ # The effective universe domain
107
+ #
108
+ # @return [String]
109
+ #
110
+ def universe_domain
111
+ @network_services_stub.universe_domain
112
+ end
113
+
114
+ ##
115
+ # Create a new NetworkServices REST client object.
116
+ #
117
+ # @example
118
+ #
119
+ # # Create a client using the default configuration
120
+ # client = ::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new
121
+ #
122
+ # # Create a client using a custom configuration
123
+ # client = ::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the NetworkServices client.
128
+ # @yieldparam config [Client::Configuration]
129
+ #
130
+ def initialize
131
+ # Create the configuration object
132
+ @config = Configuration.new Client.configure
133
+
134
+ # Yield the configuration if needed
135
+ yield @config if block_given?
136
+
137
+ # Create credentials
138
+ credentials = @config.credentials
139
+ # Use self-signed JWT if the endpoint is unchanged from default,
140
+ # but only if the default endpoint does not have a region prefix.
141
+ enable_self_signed_jwt = @config.endpoint.nil? ||
142
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
143
+ !@config.endpoint.split(".").first.include?("-"))
144
+ credentials ||= Credentials.default scope: @config.scope,
145
+ enable_self_signed_jwt: enable_self_signed_jwt
146
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
147
+ credentials = Credentials.new credentials, scope: @config.scope
148
+ end
149
+
150
+ @quota_project_id = @config.quota_project
151
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
152
+
153
+ @operations_client = ::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Operations.new do |config|
154
+ config.credentials = credentials
155
+ config.quota_project = @quota_project_id
156
+ config.endpoint = @config.endpoint
157
+ config.universe_domain = @config.universe_domain
158
+ end
159
+
160
+ @network_services_stub = ::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::ServiceStub.new(
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ credentials: credentials,
165
+ logger: @config.logger
166
+ )
167
+
168
+ @network_services_stub.logger(stub: true)&.info do |entry|
169
+ entry.set_system_name
170
+ entry.set_service
171
+ entry.message = "Created client for #{entry.service}"
172
+ entry.set_credentials_fields credentials
173
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
174
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
175
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
176
+ end
177
+
178
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
179
+ config.credentials = credentials
180
+ config.quota_project = @quota_project_id
181
+ config.endpoint = @network_services_stub.endpoint
182
+ config.universe_domain = @network_services_stub.universe_domain
183
+ config.bindings_override = @config.bindings_override
184
+ config.logger = @network_services_stub.logger if config.respond_to? :logger=
185
+ end
186
+
187
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
188
+ config.credentials = credentials
189
+ config.quota_project = @quota_project_id
190
+ config.endpoint = @network_services_stub.endpoint
191
+ config.universe_domain = @network_services_stub.universe_domain
192
+ config.bindings_override = @config.bindings_override
193
+ config.logger = @network_services_stub.logger if config.respond_to? :logger=
194
+ end
195
+ end
196
+
197
+ ##
198
+ # Get the associated client for long-running operations.
199
+ #
200
+ # @return [::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Operations]
201
+ #
202
+ attr_reader :operations_client
203
+
204
+ ##
205
+ # Get the associated client for mix-in of the Locations.
206
+ #
207
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
208
+ #
209
+ attr_reader :location_client
210
+
211
+ ##
212
+ # Get the associated client for mix-in of the IAMPolicy.
213
+ #
214
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
215
+ #
216
+ attr_reader :iam_policy_client
217
+
218
+ ##
219
+ # The logger used for request/response debug logging.
220
+ #
221
+ # @return [Logger]
222
+ #
223
+ def logger
224
+ @network_services_stub.logger
225
+ end
226
+
227
+ # Service calls
228
+
229
+ ##
230
+ # Lists EndpointPolicies in a given project and location.
231
+ #
232
+ # @overload list_endpoint_policies(request, options = nil)
233
+ # Pass arguments to `list_endpoint_policies` via a request object, either of type
234
+ # {::Google::Cloud::NetworkServices::V1beta1::ListEndpointPoliciesRequest} or an equivalent Hash.
235
+ #
236
+ # @param request [::Google::Cloud::NetworkServices::V1beta1::ListEndpointPoliciesRequest, ::Hash]
237
+ # A request object representing the call parameters. Required. To specify no
238
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
239
+ # @param options [::Gapic::CallOptions, ::Hash]
240
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
241
+ #
242
+ # @overload list_endpoint_policies(parent: nil, page_size: nil, page_token: nil)
243
+ # Pass arguments to `list_endpoint_policies` via keyword arguments. Note that at
244
+ # least one keyword argument is required. To specify no parameters, or to keep all
245
+ # the default parameter values, pass an empty Hash as a request object (see above).
246
+ #
247
+ # @param parent [::String]
248
+ # Required. The project and location from which the EndpointPolicies should
249
+ # be listed, specified in the format `projects/*/locations/global`.
250
+ # @param page_size [::Integer]
251
+ # Maximum number of EndpointPolicies to return per call.
252
+ # @param page_token [::String]
253
+ # The value returned by the last `ListEndpointPoliciesResponse`
254
+ # Indicates that this is a continuation of a prior
255
+ # `ListEndpointPolicies` call, and that the system should return the
256
+ # next page of data.
257
+ # @yield [result, operation] Access the result along with the TransportOperation object
258
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::NetworkServices::V1beta1::EndpointPolicy>]
259
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
260
+ #
261
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::NetworkServices::V1beta1::EndpointPolicy>]
262
+ #
263
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
264
+ #
265
+ # @example Basic example
266
+ # require "google/cloud/network_services/v1beta1"
267
+ #
268
+ # # Create a client object. The client can be reused for multiple calls.
269
+ # client = Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new
270
+ #
271
+ # # Create a request. To set request fields, pass in keyword arguments.
272
+ # request = Google::Cloud::NetworkServices::V1beta1::ListEndpointPoliciesRequest.new
273
+ #
274
+ # # Call the list_endpoint_policies method.
275
+ # result = client.list_endpoint_policies request
276
+ #
277
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
278
+ # # over elements, and API calls will be issued to fetch pages as needed.
279
+ # result.each do |item|
280
+ # # Each element is of type ::Google::Cloud::NetworkServices::V1beta1::EndpointPolicy.
281
+ # p item
282
+ # end
283
+ #
284
+ def list_endpoint_policies request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkServices::V1beta1::ListEndpointPoliciesRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ call_metadata = @config.rpcs.list_endpoint_policies.metadata.to_h
294
+
295
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
296
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::NetworkServices::V1beta1::VERSION,
299
+ transports_version_send: [:rest]
300
+
301
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
302
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
303
+
304
+ options.apply_defaults timeout: @config.rpcs.list_endpoint_policies.timeout,
305
+ metadata: call_metadata,
306
+ retry_policy: @config.rpcs.list_endpoint_policies.retry_policy
307
+
308
+ options.apply_defaults timeout: @config.timeout,
309
+ metadata: @config.metadata,
310
+ retry_policy: @config.retry_policy
311
+
312
+ @network_services_stub.list_endpoint_policies request, options do |result, operation|
313
+ result = ::Gapic::Rest::PagedEnumerable.new @network_services_stub, :list_endpoint_policies, "endpoint_policies", request, result, options
314
+ yield result, operation if block_given?
315
+ throw :response, result
316
+ end
317
+ rescue ::Gapic::Rest::Error => e
318
+ raise ::Google::Cloud::Error.from_error(e)
319
+ end
320
+
321
+ ##
322
+ # Gets details of a single EndpointPolicy.
323
+ #
324
+ # @overload get_endpoint_policy(request, options = nil)
325
+ # Pass arguments to `get_endpoint_policy` via a request object, either of type
326
+ # {::Google::Cloud::NetworkServices::V1beta1::GetEndpointPolicyRequest} or an equivalent Hash.
327
+ #
328
+ # @param request [::Google::Cloud::NetworkServices::V1beta1::GetEndpointPolicyRequest, ::Hash]
329
+ # A request object representing the call parameters. Required. To specify no
330
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
331
+ # @param options [::Gapic::CallOptions, ::Hash]
332
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
333
+ #
334
+ # @overload get_endpoint_policy(name: nil)
335
+ # Pass arguments to `get_endpoint_policy` via keyword arguments. Note that at
336
+ # least one keyword argument is required. To specify no parameters, or to keep all
337
+ # the default parameter values, pass an empty Hash as a request object (see above).
338
+ #
339
+ # @param name [::String]
340
+ # Required. A name of the EndpointPolicy to get. Must be in the format
341
+ # `projects/*/locations/global/endpointPolicies/*`.
342
+ # @yield [result, operation] Access the result along with the TransportOperation object
343
+ # @yieldparam result [::Google::Cloud::NetworkServices::V1beta1::EndpointPolicy]
344
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
345
+ #
346
+ # @return [::Google::Cloud::NetworkServices::V1beta1::EndpointPolicy]
347
+ #
348
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
349
+ #
350
+ # @example Basic example
351
+ # require "google/cloud/network_services/v1beta1"
352
+ #
353
+ # # Create a client object. The client can be reused for multiple calls.
354
+ # client = Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new
355
+ #
356
+ # # Create a request. To set request fields, pass in keyword arguments.
357
+ # request = Google::Cloud::NetworkServices::V1beta1::GetEndpointPolicyRequest.new
358
+ #
359
+ # # Call the get_endpoint_policy method.
360
+ # result = client.get_endpoint_policy request
361
+ #
362
+ # # The returned object is of type Google::Cloud::NetworkServices::V1beta1::EndpointPolicy.
363
+ # p result
364
+ #
365
+ def get_endpoint_policy request, options = nil
366
+ raise ::ArgumentError, "request must be provided" if request.nil?
367
+
368
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkServices::V1beta1::GetEndpointPolicyRequest
369
+
370
+ # Converts hash and nil to an options object
371
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
372
+
373
+ # Customize the options with defaults
374
+ call_metadata = @config.rpcs.get_endpoint_policy.metadata.to_h
375
+
376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
377
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
378
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
379
+ gapic_version: ::Google::Cloud::NetworkServices::V1beta1::VERSION,
380
+ transports_version_send: [:rest]
381
+
382
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
383
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
384
+
385
+ options.apply_defaults timeout: @config.rpcs.get_endpoint_policy.timeout,
386
+ metadata: call_metadata,
387
+ retry_policy: @config.rpcs.get_endpoint_policy.retry_policy
388
+
389
+ options.apply_defaults timeout: @config.timeout,
390
+ metadata: @config.metadata,
391
+ retry_policy: @config.retry_policy
392
+
393
+ @network_services_stub.get_endpoint_policy request, options do |result, operation|
394
+ yield result, operation if block_given?
395
+ end
396
+ rescue ::Gapic::Rest::Error => e
397
+ raise ::Google::Cloud::Error.from_error(e)
398
+ end
399
+
400
+ ##
401
+ # Creates a new EndpointPolicy in a given project and location.
402
+ #
403
+ # @overload create_endpoint_policy(request, options = nil)
404
+ # Pass arguments to `create_endpoint_policy` via a request object, either of type
405
+ # {::Google::Cloud::NetworkServices::V1beta1::CreateEndpointPolicyRequest} or an equivalent Hash.
406
+ #
407
+ # @param request [::Google::Cloud::NetworkServices::V1beta1::CreateEndpointPolicyRequest, ::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 create_endpoint_policy(parent: nil, endpoint_policy_id: nil, endpoint_policy: nil)
414
+ # Pass arguments to `create_endpoint_policy` 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. The parent resource of the EndpointPolicy. Must be in the
420
+ # format `projects/*/locations/global`.
421
+ # @param endpoint_policy_id [::String]
422
+ # Required. Short name of the EndpointPolicy resource to be created.
423
+ # E.g. "CustomECS".
424
+ # @param endpoint_policy [::Google::Cloud::NetworkServices::V1beta1::EndpointPolicy, ::Hash]
425
+ # Required. EndpointPolicy resource to be created.
426
+ # @yield [result, operation] Access the result along with the TransportOperation object
427
+ # @yieldparam result [::Gapic::Operation]
428
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
429
+ #
430
+ # @return [::Gapic::Operation]
431
+ #
432
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
433
+ #
434
+ # @example Basic example
435
+ # require "google/cloud/network_services/v1beta1"
436
+ #
437
+ # # Create a client object. The client can be reused for multiple calls.
438
+ # client = Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new
439
+ #
440
+ # # Create a request. To set request fields, pass in keyword arguments.
441
+ # request = Google::Cloud::NetworkServices::V1beta1::CreateEndpointPolicyRequest.new
442
+ #
443
+ # # Call the create_endpoint_policy method.
444
+ # result = client.create_endpoint_policy request
445
+ #
446
+ # # The returned object is of type Gapic::Operation. You can use it to
447
+ # # check the status of an operation, cancel it, or wait for results.
448
+ # # Here is how to wait for a response.
449
+ # result.wait_until_done! timeout: 60
450
+ # if result.response?
451
+ # p result.response
452
+ # else
453
+ # puts "No response received."
454
+ # end
455
+ #
456
+ def create_endpoint_policy request, options = nil
457
+ raise ::ArgumentError, "request must be provided" if request.nil?
458
+
459
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkServices::V1beta1::CreateEndpointPolicyRequest
460
+
461
+ # Converts hash and nil to an options object
462
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
463
+
464
+ # Customize the options with defaults
465
+ call_metadata = @config.rpcs.create_endpoint_policy.metadata.to_h
466
+
467
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
468
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
469
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
470
+ gapic_version: ::Google::Cloud::NetworkServices::V1beta1::VERSION,
471
+ transports_version_send: [:rest]
472
+
473
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
474
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
475
+
476
+ options.apply_defaults timeout: @config.rpcs.create_endpoint_policy.timeout,
477
+ metadata: call_metadata,
478
+ retry_policy: @config.rpcs.create_endpoint_policy.retry_policy
479
+
480
+ options.apply_defaults timeout: @config.timeout,
481
+ metadata: @config.metadata,
482
+ retry_policy: @config.retry_policy
483
+
484
+ @network_services_stub.create_endpoint_policy request, options do |result, operation|
485
+ result = ::Gapic::Operation.new result, @operations_client, options: options
486
+ yield result, operation if block_given?
487
+ throw :response, result
488
+ end
489
+ rescue ::Gapic::Rest::Error => e
490
+ raise ::Google::Cloud::Error.from_error(e)
491
+ end
492
+
493
+ ##
494
+ # Updates the parameters of a single EndpointPolicy.
495
+ #
496
+ # @overload update_endpoint_policy(request, options = nil)
497
+ # Pass arguments to `update_endpoint_policy` via a request object, either of type
498
+ # {::Google::Cloud::NetworkServices::V1beta1::UpdateEndpointPolicyRequest} or an equivalent Hash.
499
+ #
500
+ # @param request [::Google::Cloud::NetworkServices::V1beta1::UpdateEndpointPolicyRequest, ::Hash]
501
+ # A request object representing the call parameters. Required. To specify no
502
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
503
+ # @param options [::Gapic::CallOptions, ::Hash]
504
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
505
+ #
506
+ # @overload update_endpoint_policy(update_mask: nil, endpoint_policy: nil)
507
+ # Pass arguments to `update_endpoint_policy` via keyword arguments. Note that at
508
+ # least one keyword argument is required. To specify no parameters, or to keep all
509
+ # the default parameter values, pass an empty Hash as a request object (see above).
510
+ #
511
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
512
+ # Optional. Field mask is used to specify the fields to be overwritten in the
513
+ # EndpointPolicy resource by the update.
514
+ # The fields specified in the update_mask are relative to the resource, not
515
+ # the full request. A field will be overwritten if it is in the mask. If the
516
+ # user does not provide a mask then all fields will be overwritten.
517
+ # @param endpoint_policy [::Google::Cloud::NetworkServices::V1beta1::EndpointPolicy, ::Hash]
518
+ # Required. Updated EndpointPolicy resource.
519
+ # @yield [result, operation] Access the result along with the TransportOperation object
520
+ # @yieldparam result [::Gapic::Operation]
521
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
522
+ #
523
+ # @return [::Gapic::Operation]
524
+ #
525
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
526
+ #
527
+ # @example Basic example
528
+ # require "google/cloud/network_services/v1beta1"
529
+ #
530
+ # # Create a client object. The client can be reused for multiple calls.
531
+ # client = Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new
532
+ #
533
+ # # Create a request. To set request fields, pass in keyword arguments.
534
+ # request = Google::Cloud::NetworkServices::V1beta1::UpdateEndpointPolicyRequest.new
535
+ #
536
+ # # Call the update_endpoint_policy method.
537
+ # result = client.update_endpoint_policy request
538
+ #
539
+ # # The returned object is of type Gapic::Operation. You can use it to
540
+ # # check the status of an operation, cancel it, or wait for results.
541
+ # # Here is how to wait for a response.
542
+ # result.wait_until_done! timeout: 60
543
+ # if result.response?
544
+ # p result.response
545
+ # else
546
+ # puts "No response received."
547
+ # end
548
+ #
549
+ def update_endpoint_policy request, options = nil
550
+ raise ::ArgumentError, "request must be provided" if request.nil?
551
+
552
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkServices::V1beta1::UpdateEndpointPolicyRequest
553
+
554
+ # Converts hash and nil to an options object
555
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
556
+
557
+ # Customize the options with defaults
558
+ call_metadata = @config.rpcs.update_endpoint_policy.metadata.to_h
559
+
560
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
561
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
562
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
563
+ gapic_version: ::Google::Cloud::NetworkServices::V1beta1::VERSION,
564
+ transports_version_send: [:rest]
565
+
566
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
567
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
568
+
569
+ options.apply_defaults timeout: @config.rpcs.update_endpoint_policy.timeout,
570
+ metadata: call_metadata,
571
+ retry_policy: @config.rpcs.update_endpoint_policy.retry_policy
572
+
573
+ options.apply_defaults timeout: @config.timeout,
574
+ metadata: @config.metadata,
575
+ retry_policy: @config.retry_policy
576
+
577
+ @network_services_stub.update_endpoint_policy request, options do |result, operation|
578
+ result = ::Gapic::Operation.new result, @operations_client, options: options
579
+ yield result, operation if block_given?
580
+ throw :response, result
581
+ end
582
+ rescue ::Gapic::Rest::Error => e
583
+ raise ::Google::Cloud::Error.from_error(e)
584
+ end
585
+
586
+ ##
587
+ # Deletes a single EndpointPolicy.
588
+ #
589
+ # @overload delete_endpoint_policy(request, options = nil)
590
+ # Pass arguments to `delete_endpoint_policy` via a request object, either of type
591
+ # {::Google::Cloud::NetworkServices::V1beta1::DeleteEndpointPolicyRequest} or an equivalent Hash.
592
+ #
593
+ # @param request [::Google::Cloud::NetworkServices::V1beta1::DeleteEndpointPolicyRequest, ::Hash]
594
+ # A request object representing the call parameters. Required. To specify no
595
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
596
+ # @param options [::Gapic::CallOptions, ::Hash]
597
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
598
+ #
599
+ # @overload delete_endpoint_policy(name: nil)
600
+ # Pass arguments to `delete_endpoint_policy` via keyword arguments. Note that at
601
+ # least one keyword argument is required. To specify no parameters, or to keep all
602
+ # the default parameter values, pass an empty Hash as a request object (see above).
603
+ #
604
+ # @param name [::String]
605
+ # Required. A name of the EndpointPolicy to delete. Must be in the format
606
+ # `projects/*/locations/global/endpointPolicies/*`.
607
+ # @yield [result, operation] Access the result along with the TransportOperation object
608
+ # @yieldparam result [::Gapic::Operation]
609
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
610
+ #
611
+ # @return [::Gapic::Operation]
612
+ #
613
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
614
+ #
615
+ # @example Basic example
616
+ # require "google/cloud/network_services/v1beta1"
617
+ #
618
+ # # Create a client object. The client can be reused for multiple calls.
619
+ # client = Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new
620
+ #
621
+ # # Create a request. To set request fields, pass in keyword arguments.
622
+ # request = Google::Cloud::NetworkServices::V1beta1::DeleteEndpointPolicyRequest.new
623
+ #
624
+ # # Call the delete_endpoint_policy method.
625
+ # result = client.delete_endpoint_policy request
626
+ #
627
+ # # The returned object is of type Gapic::Operation. You can use it to
628
+ # # check the status of an operation, cancel it, or wait for results.
629
+ # # Here is how to wait for a response.
630
+ # result.wait_until_done! timeout: 60
631
+ # if result.response?
632
+ # p result.response
633
+ # else
634
+ # puts "No response received."
635
+ # end
636
+ #
637
+ def delete_endpoint_policy request, options = nil
638
+ raise ::ArgumentError, "request must be provided" if request.nil?
639
+
640
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::NetworkServices::V1beta1::DeleteEndpointPolicyRequest
641
+
642
+ # Converts hash and nil to an options object
643
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
644
+
645
+ # Customize the options with defaults
646
+ call_metadata = @config.rpcs.delete_endpoint_policy.metadata.to_h
647
+
648
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
649
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
650
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
651
+ gapic_version: ::Google::Cloud::NetworkServices::V1beta1::VERSION,
652
+ transports_version_send: [:rest]
653
+
654
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
655
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
656
+
657
+ options.apply_defaults timeout: @config.rpcs.delete_endpoint_policy.timeout,
658
+ metadata: call_metadata,
659
+ retry_policy: @config.rpcs.delete_endpoint_policy.retry_policy
660
+
661
+ options.apply_defaults timeout: @config.timeout,
662
+ metadata: @config.metadata,
663
+ retry_policy: @config.retry_policy
664
+
665
+ @network_services_stub.delete_endpoint_policy request, options do |result, operation|
666
+ result = ::Gapic::Operation.new result, @operations_client, options: options
667
+ yield result, operation if block_given?
668
+ throw :response, result
669
+ end
670
+ rescue ::Gapic::Rest::Error => e
671
+ raise ::Google::Cloud::Error.from_error(e)
672
+ end
673
+
674
+ ##
675
+ # Configuration class for the NetworkServices REST API.
676
+ #
677
+ # This class represents the configuration for NetworkServices REST,
678
+ # providing control over timeouts, retry behavior, logging, transport
679
+ # parameters, and other low-level controls. Certain parameters can also be
680
+ # applied individually to specific RPCs. See
681
+ # {::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client::Configuration::Rpcs}
682
+ # for a list of RPCs that can be configured independently.
683
+ #
684
+ # Configuration can be applied globally to all clients, or to a single client
685
+ # on construction.
686
+ #
687
+ # @example
688
+ #
689
+ # # Modify the global config, setting the timeout for
690
+ # # list_endpoint_policies to 20 seconds,
691
+ # # and all remaining timeouts to 10 seconds.
692
+ # ::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.configure do |config|
693
+ # config.timeout = 10.0
694
+ # config.rpcs.list_endpoint_policies.timeout = 20.0
695
+ # end
696
+ #
697
+ # # Apply the above configuration only to a new client.
698
+ # client = ::Google::Cloud::NetworkServices::V1beta1::NetworkServices::Rest::Client.new do |config|
699
+ # config.timeout = 10.0
700
+ # config.rpcs.list_endpoint_policies.timeout = 20.0
701
+ # end
702
+ #
703
+ # @!attribute [rw] endpoint
704
+ # A custom service endpoint, as a hostname or hostname:port. The default is
705
+ # nil, indicating to use the default endpoint in the current universe domain.
706
+ # @return [::String,nil]
707
+ # @!attribute [rw] credentials
708
+ # Credentials to send with calls. You may provide any of the following types:
709
+ # * (`String`) The path to a service account key file in JSON format
710
+ # * (`Hash`) A service account key as a Hash
711
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
712
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
713
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
714
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
715
+ # * (`nil`) indicating no credentials
716
+ #
717
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
718
+ # external source for authentication to Google Cloud, you must validate it before
719
+ # providing it to a Google API client library. Providing an unvalidated credential
720
+ # configuration to Google APIs can compromise the security of your systems and data.
721
+ # For more information, refer to [Validate credential configurations from external
722
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
723
+ # @return [::Object]
724
+ # @!attribute [rw] scope
725
+ # The OAuth scopes
726
+ # @return [::Array<::String>]
727
+ # @!attribute [rw] lib_name
728
+ # The library name as recorded in instrumentation and logging
729
+ # @return [::String]
730
+ # @!attribute [rw] lib_version
731
+ # The library version as recorded in instrumentation and logging
732
+ # @return [::String]
733
+ # @!attribute [rw] timeout
734
+ # The call timeout in seconds.
735
+ # @return [::Numeric]
736
+ # @!attribute [rw] metadata
737
+ # Additional headers to be sent with the call.
738
+ # @return [::Hash{::Symbol=>::String}]
739
+ # @!attribute [rw] retry_policy
740
+ # The retry policy. The value is a hash with the following keys:
741
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
742
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
743
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
744
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
745
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
746
+ # trigger a retry.
747
+ # @return [::Hash]
748
+ # @!attribute [rw] quota_project
749
+ # A separate project against which to charge quota.
750
+ # @return [::String]
751
+ # @!attribute [rw] universe_domain
752
+ # The universe domain within which to make requests. This determines the
753
+ # default endpoint URL. The default value of nil uses the environment
754
+ # universe (usually the default "googleapis.com" universe).
755
+ # @return [::String,nil]
756
+ # @!attribute [rw] logger
757
+ # A custom logger to use for request/response debug logging, or the value
758
+ # `:default` (the default) to construct a default logger, or `nil` to
759
+ # explicitly disable logging.
760
+ # @return [::Logger,:default,nil]
761
+ #
762
+ class Configuration
763
+ extend ::Gapic::Config
764
+
765
+ # @private
766
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
767
+ DEFAULT_ENDPOINT = "networkservices.googleapis.com"
768
+
769
+ config_attr :endpoint, nil, ::String, nil
770
+ config_attr :credentials, nil do |value|
771
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
772
+ allowed.any? { |klass| klass === value }
773
+ end
774
+ config_attr :scope, nil, ::String, ::Array, nil
775
+ config_attr :lib_name, nil, ::String, nil
776
+ config_attr :lib_version, nil, ::String, nil
777
+ config_attr :timeout, nil, ::Numeric, nil
778
+ config_attr :metadata, nil, ::Hash, nil
779
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
780
+ config_attr :quota_project, nil, ::String, nil
781
+ config_attr :universe_domain, nil, ::String, nil
782
+
783
+ # @private
784
+ # Overrides for http bindings for the RPCs of this service
785
+ # are only used when this service is used as mixin, and only
786
+ # by the host service.
787
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
788
+ config_attr :bindings_override, {}, ::Hash, nil
789
+ config_attr :logger, :default, ::Logger, nil, :default
790
+
791
+ # @private
792
+ def initialize parent_config = nil
793
+ @parent_config = parent_config unless parent_config.nil?
794
+
795
+ yield self if block_given?
796
+ end
797
+
798
+ ##
799
+ # Configurations for individual RPCs
800
+ # @return [Rpcs]
801
+ #
802
+ def rpcs
803
+ @rpcs ||= begin
804
+ parent_rpcs = nil
805
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
806
+ Rpcs.new parent_rpcs
807
+ end
808
+ end
809
+
810
+ ##
811
+ # Configuration RPC class for the NetworkServices API.
812
+ #
813
+ # Includes fields providing the configuration for each RPC in this service.
814
+ # Each configuration object is of type `Gapic::Config::Method` and includes
815
+ # the following configuration fields:
816
+ #
817
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
818
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
819
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
820
+ # include the following keys:
821
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
822
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
823
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
824
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
825
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
826
+ # trigger a retry.
827
+ #
828
+ class Rpcs
829
+ ##
830
+ # RPC-specific configuration for `list_endpoint_policies`
831
+ # @return [::Gapic::Config::Method]
832
+ #
833
+ attr_reader :list_endpoint_policies
834
+ ##
835
+ # RPC-specific configuration for `get_endpoint_policy`
836
+ # @return [::Gapic::Config::Method]
837
+ #
838
+ attr_reader :get_endpoint_policy
839
+ ##
840
+ # RPC-specific configuration for `create_endpoint_policy`
841
+ # @return [::Gapic::Config::Method]
842
+ #
843
+ attr_reader :create_endpoint_policy
844
+ ##
845
+ # RPC-specific configuration for `update_endpoint_policy`
846
+ # @return [::Gapic::Config::Method]
847
+ #
848
+ attr_reader :update_endpoint_policy
849
+ ##
850
+ # RPC-specific configuration for `delete_endpoint_policy`
851
+ # @return [::Gapic::Config::Method]
852
+ #
853
+ attr_reader :delete_endpoint_policy
854
+
855
+ # @private
856
+ def initialize parent_rpcs = nil
857
+ list_endpoint_policies_config = parent_rpcs.list_endpoint_policies if parent_rpcs.respond_to? :list_endpoint_policies
858
+ @list_endpoint_policies = ::Gapic::Config::Method.new list_endpoint_policies_config
859
+ get_endpoint_policy_config = parent_rpcs.get_endpoint_policy if parent_rpcs.respond_to? :get_endpoint_policy
860
+ @get_endpoint_policy = ::Gapic::Config::Method.new get_endpoint_policy_config
861
+ create_endpoint_policy_config = parent_rpcs.create_endpoint_policy if parent_rpcs.respond_to? :create_endpoint_policy
862
+ @create_endpoint_policy = ::Gapic::Config::Method.new create_endpoint_policy_config
863
+ update_endpoint_policy_config = parent_rpcs.update_endpoint_policy if parent_rpcs.respond_to? :update_endpoint_policy
864
+ @update_endpoint_policy = ::Gapic::Config::Method.new update_endpoint_policy_config
865
+ delete_endpoint_policy_config = parent_rpcs.delete_endpoint_policy if parent_rpcs.respond_to? :delete_endpoint_policy
866
+ @delete_endpoint_policy = ::Gapic::Config::Method.new delete_endpoint_policy_config
867
+
868
+ yield self if block_given?
869
+ end
870
+ end
871
+ end
872
+ end
873
+ end
874
+ end
875
+ end
876
+ end
877
+ end
878
+ end