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