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