Class DnsThreatDetectorServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient =
DnsThreatDetectorServiceClient.create()) {
DnsThreatDetectorName name =
DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]");
DnsThreatDetector response = dnsThreatDetectorServiceClient.getDnsThreatDetector(name);
}
Note: close() needs to be called on the DnsThreatDetectorServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListDnsThreatDetectors |
Lists DnsThreatDetectors in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDnsThreatDetector |
Gets the details of a single DnsThreatDetector. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateDnsThreatDetector |
Creates a new DnsThreatDetector in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateDnsThreatDetector |
Updates a single DnsThreatDetector. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteDnsThreatDetector |
Deletes a single DnsThreatDetector. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of DnsThreatDetectorServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DnsThreatDetectorServiceSettings dnsThreatDetectorServiceSettings =
DnsThreatDetectorServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient =
DnsThreatDetectorServiceClient.create(dnsThreatDetectorServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DnsThreatDetectorServiceSettings dnsThreatDetectorServiceSettings =
DnsThreatDetectorServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient =
DnsThreatDetectorServiceClient.create(dnsThreatDetectorServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DnsThreatDetectorServiceSettings dnsThreatDetectorServiceSettings =
DnsThreatDetectorServiceSettings.newHttpJsonBuilder().build();
DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient =
DnsThreatDetectorServiceClient.create(dnsThreatDetectorServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of DnsThreatDetectorServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final DnsThreatDetectorServiceClientcreate()Constructs an instance of DnsThreatDetectorServiceClient with default settings.static final DnsThreatDetectorServiceClientcreate(DnsThreatDetectorServiceSettings settings) Constructs an instance of DnsThreatDetectorServiceClient, using the given settings.static final DnsThreatDetectorServiceClientConstructs an instance of DnsThreatDetectorServiceClient, using the given stub for making calls.final DnsThreatDetectorCreates a new DnsThreatDetector in a given project and location.final DnsThreatDetectorcreateDnsThreatDetector(LocationName parent, DnsThreatDetector dnsThreatDetector, String dnsThreatDetectorId) Creates a new DnsThreatDetector in a given project and location.final DnsThreatDetectorcreateDnsThreatDetector(String parent, DnsThreatDetector dnsThreatDetector, String dnsThreatDetectorId) Creates a new DnsThreatDetector in a given project and location.Creates a new DnsThreatDetector in a given project and location.final voidDeletes a single DnsThreatDetector.final voidDeletes a single DnsThreatDetector.final voidDeletes a single DnsThreatDetector.final UnaryCallable<DeleteDnsThreatDetectorRequest,com.google.protobuf.Empty> Deletes a single DnsThreatDetector.final DnsThreatDetectorGets the details of a single DnsThreatDetector.final DnsThreatDetectorGets the details of a single DnsThreatDetector.final DnsThreatDetectorgetDnsThreatDetector(String name) Gets the details of a single DnsThreatDetector.Gets the details of a single DnsThreatDetector.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.getStub()booleanbooleanLists DnsThreatDetectors in a given project and location.listDnsThreatDetectors(LocationName parent) Lists DnsThreatDetectors in a given project and location.listDnsThreatDetectors(String parent) Lists DnsThreatDetectors in a given project and location.Lists DnsThreatDetectors in a given project and location.final UnaryCallable<ListDnsThreatDetectorsRequest,DnsThreatDetectorServiceClient.ListDnsThreatDetectorsPagedResponse> Lists DnsThreatDetectors in a given project and location.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidReturns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.final DnsThreatDetectorupdateDnsThreatDetector(DnsThreatDetector dnsThreatDetector, com.google.protobuf.FieldMask updateMask) Updates a single DnsThreatDetector.final DnsThreatDetectorUpdates a single DnsThreatDetector.Updates a single DnsThreatDetector.
-
Constructor Details
-
DnsThreatDetectorServiceClient
protected DnsThreatDetectorServiceClient(DnsThreatDetectorServiceSettings settings) throws IOException Constructs an instance of DnsThreatDetectorServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
DnsThreatDetectorServiceClient
-
-
Method Details
-
create
Constructs an instance of DnsThreatDetectorServiceClient with default settings.- Throws:
IOException
-
create
public static final DnsThreatDetectorServiceClient create(DnsThreatDetectorServiceSettings settings) throws IOException Constructs an instance of DnsThreatDetectorServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of DnsThreatDetectorServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DnsThreatDetectorServiceSettings). -
getSettings
-
getStub
-
listDnsThreatDetectors
public final DnsThreatDetectorServiceClient.ListDnsThreatDetectorsPagedResponse listDnsThreatDetectors(LocationName parent) Lists DnsThreatDetectors in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (DnsThreatDetector element : dnsThreatDetectorServiceClient.listDnsThreatDetectors(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent value for `ListDnsThreatDetectorsRequest`.- Throws:
ApiException- if the remote call fails
-
listDnsThreatDetectors
public final DnsThreatDetectorServiceClient.ListDnsThreatDetectorsPagedResponse listDnsThreatDetectors(String parent) Lists DnsThreatDetectors in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (DnsThreatDetector element : dnsThreatDetectorServiceClient.listDnsThreatDetectors(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent value for `ListDnsThreatDetectorsRequest`.- Throws:
ApiException- if the remote call fails
-
listDnsThreatDetectors
public final DnsThreatDetectorServiceClient.ListDnsThreatDetectorsPagedResponse listDnsThreatDetectors(ListDnsThreatDetectorsRequest request) Lists DnsThreatDetectors in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { ListDnsThreatDetectorsRequest request = ListDnsThreatDetectorsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (DnsThreatDetector element : dnsThreatDetectorServiceClient.listDnsThreatDetectors(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listDnsThreatDetectorsPagedCallable
public final UnaryCallable<ListDnsThreatDetectorsRequest,DnsThreatDetectorServiceClient.ListDnsThreatDetectorsPagedResponse> listDnsThreatDetectorsPagedCallable()Lists DnsThreatDetectors in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { ListDnsThreatDetectorsRequest request = ListDnsThreatDetectorsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<DnsThreatDetector> future = dnsThreatDetectorServiceClient.listDnsThreatDetectorsPagedCallable().futureCall(request); // Do something. for (DnsThreatDetector element : future.get().iterateAll()) { // doThingsWith(element); } } -
listDnsThreatDetectorsCallable
public final UnaryCallable<ListDnsThreatDetectorsRequest,ListDnsThreatDetectorsResponse> listDnsThreatDetectorsCallable()Lists DnsThreatDetectors in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { ListDnsThreatDetectorsRequest request = ListDnsThreatDetectorsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListDnsThreatDetectorsResponse response = dnsThreatDetectorServiceClient.listDnsThreatDetectorsCallable().call(request); for (DnsThreatDetector element : response.getDnsThreatDetectorsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getDnsThreatDetector
Gets the details of a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { DnsThreatDetectorName name = DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]"); DnsThreatDetector response = dnsThreatDetectorServiceClient.getDnsThreatDetector(name); }- Parameters:
name- Required. Name of the DnsThreatDetector resource.- Throws:
ApiException- if the remote call fails
-
getDnsThreatDetector
Gets the details of a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { String name = DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]").toString(); DnsThreatDetector response = dnsThreatDetectorServiceClient.getDnsThreatDetector(name); }- Parameters:
name- Required. Name of the DnsThreatDetector resource.- Throws:
ApiException- if the remote call fails
-
getDnsThreatDetector
Gets the details of a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { GetDnsThreatDetectorRequest request = GetDnsThreatDetectorRequest.newBuilder() .setName( DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]") .toString()) .build(); DnsThreatDetector response = dnsThreatDetectorServiceClient.getDnsThreatDetector(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getDnsThreatDetectorCallable
public final UnaryCallable<GetDnsThreatDetectorRequest,DnsThreatDetector> getDnsThreatDetectorCallable()Gets the details of a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { GetDnsThreatDetectorRequest request = GetDnsThreatDetectorRequest.newBuilder() .setName( DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]") .toString()) .build(); ApiFuture<DnsThreatDetector> future = dnsThreatDetectorServiceClient.getDnsThreatDetectorCallable().futureCall(request); // Do something. DnsThreatDetector response = future.get(); } -
createDnsThreatDetector
public final DnsThreatDetector createDnsThreatDetector(LocationName parent, DnsThreatDetector dnsThreatDetector, String dnsThreatDetectorId) Creates a new DnsThreatDetector in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); DnsThreatDetector dnsThreatDetector = DnsThreatDetector.newBuilder().build(); String dnsThreatDetectorId = "dnsThreatDetectorId-1579667324"; DnsThreatDetector response = dnsThreatDetectorServiceClient.createDnsThreatDetector( parent, dnsThreatDetector, dnsThreatDetectorId); }- Parameters:
parent- Required. The value for the parent of the DnsThreatDetector resource.dnsThreatDetector- Required. The `DnsThreatDetector` resource to create.dnsThreatDetectorId- Optional. The ID of the requesting DnsThreatDetector object. If this field is not supplied, the service generates an identifier.- Throws:
ApiException- if the remote call fails
-
createDnsThreatDetector
public final DnsThreatDetector createDnsThreatDetector(String parent, DnsThreatDetector dnsThreatDetector, String dnsThreatDetectorId) Creates a new DnsThreatDetector in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); DnsThreatDetector dnsThreatDetector = DnsThreatDetector.newBuilder().build(); String dnsThreatDetectorId = "dnsThreatDetectorId-1579667324"; DnsThreatDetector response = dnsThreatDetectorServiceClient.createDnsThreatDetector( parent, dnsThreatDetector, dnsThreatDetectorId); }- Parameters:
parent- Required. The value for the parent of the DnsThreatDetector resource.dnsThreatDetector- Required. The `DnsThreatDetector` resource to create.dnsThreatDetectorId- Optional. The ID of the requesting DnsThreatDetector object. If this field is not supplied, the service generates an identifier.- Throws:
ApiException- if the remote call fails
-
createDnsThreatDetector
Creates a new DnsThreatDetector in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { CreateDnsThreatDetectorRequest request = CreateDnsThreatDetectorRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setDnsThreatDetectorId("dnsThreatDetectorId-1579667324") .setDnsThreatDetector(DnsThreatDetector.newBuilder().build()) .build(); DnsThreatDetector response = dnsThreatDetectorServiceClient.createDnsThreatDetector(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createDnsThreatDetectorCallable
public final UnaryCallable<CreateDnsThreatDetectorRequest,DnsThreatDetector> createDnsThreatDetectorCallable()Creates a new DnsThreatDetector in a given project and location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { CreateDnsThreatDetectorRequest request = CreateDnsThreatDetectorRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setDnsThreatDetectorId("dnsThreatDetectorId-1579667324") .setDnsThreatDetector(DnsThreatDetector.newBuilder().build()) .build(); ApiFuture<DnsThreatDetector> future = dnsThreatDetectorServiceClient.createDnsThreatDetectorCallable().futureCall(request); // Do something. DnsThreatDetector response = future.get(); } -
updateDnsThreatDetector
public final DnsThreatDetector updateDnsThreatDetector(DnsThreatDetector dnsThreatDetector, com.google.protobuf.FieldMask updateMask) Updates a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { DnsThreatDetector dnsThreatDetector = DnsThreatDetector.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); DnsThreatDetector response = dnsThreatDetectorServiceClient.updateDnsThreatDetector(dnsThreatDetector, updateMask); }- Parameters:
dnsThreatDetector- Required. The DnsThreatDetector resource being updated.updateMask- Optional. The field mask is used to specify the fields to be overwritten in the DnsThreatDetector resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the mask is not provided then all fields present in the request will be overwritten.- Throws:
ApiException- if the remote call fails
-
updateDnsThreatDetector
Updates a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { UpdateDnsThreatDetectorRequest request = UpdateDnsThreatDetectorRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setDnsThreatDetector(DnsThreatDetector.newBuilder().build()) .build(); DnsThreatDetector response = dnsThreatDetectorServiceClient.updateDnsThreatDetector(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateDnsThreatDetectorCallable
public final UnaryCallable<UpdateDnsThreatDetectorRequest,DnsThreatDetector> updateDnsThreatDetectorCallable()Updates a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { UpdateDnsThreatDetectorRequest request = UpdateDnsThreatDetectorRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setDnsThreatDetector(DnsThreatDetector.newBuilder().build()) .build(); ApiFuture<DnsThreatDetector> future = dnsThreatDetectorServiceClient.updateDnsThreatDetectorCallable().futureCall(request); // Do something. DnsThreatDetector response = future.get(); } -
deleteDnsThreatDetector
Deletes a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { DnsThreatDetectorName name = DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]"); dnsThreatDetectorServiceClient.deleteDnsThreatDetector(name); }- Parameters:
name- Required. Name of the DnsThreatDetector resource.- Throws:
ApiException- if the remote call fails
-
deleteDnsThreatDetector
Deletes a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { String name = DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]").toString(); dnsThreatDetectorServiceClient.deleteDnsThreatDetector(name); }- Parameters:
name- Required. Name of the DnsThreatDetector resource.- Throws:
ApiException- if the remote call fails
-
deleteDnsThreatDetector
Deletes a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { DeleteDnsThreatDetectorRequest request = DeleteDnsThreatDetectorRequest.newBuilder() .setName( DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]") .toString()) .build(); dnsThreatDetectorServiceClient.deleteDnsThreatDetector(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteDnsThreatDetectorCallable
public final UnaryCallable<DeleteDnsThreatDetectorRequest,com.google.protobuf.Empty> deleteDnsThreatDetectorCallable()Deletes a single DnsThreatDetector.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { DeleteDnsThreatDetectorRequest request = DeleteDnsThreatDetectorRequest.newBuilder() .setName( DnsThreatDetectorName.of("[PROJECT]", "[LOCATION]", "[DNS_THREAT_DETECTOR]") .toString()) .build(); ApiFuture<Empty> future = dnsThreatDetectorServiceClient.deleteDnsThreatDetectorCallable().futureCall(request); // Do something. future.get(); } -
listLocations
public final DnsThreatDetectorServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : dnsThreatDetectorServiceClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,DnsThreatDetectorServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = dnsThreatDetectorServiceClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = dnsThreatDetectorServiceClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLocation
Gets information about a location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = dnsThreatDetectorServiceClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = dnsThreatDetectorServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
setIamPolicy
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = dnsThreatDetectorServiceClient.setIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
setIamPolicyCallable
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = dnsThreatDetectorServiceClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
getIamPolicy
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = dnsThreatDetectorServiceClient.getIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getIamPolicyCallable
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = dnsThreatDetectorServiceClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
testIamPermissions
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = dnsThreatDetectorServiceClient.testIamPermissions(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
testIamPermissionsCallable
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DnsThreatDetectorServiceClient dnsThreatDetectorServiceClient = DnsThreatDetectorServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = dnsThreatDetectorServiceClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-