| GitHub Repository | Product Reference |
Service Description: Provides methods for handling TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
TargetingPresetName name = TargetingPresetName.of("[NETWORK_CODE]", "[TARGETING_PRESET]");
TargetingPreset response = targetingPresetServiceClient.getTargetingPreset(name);
}
Note: close() needs to be called on the TargetingPresetServiceClient 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 |
|---|---|---|
GetTargetingPreset |
Retrieves a |
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.
|
ListTargetingPresets |
Lists |
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.
|
CreateTargetingPreset |
Creates a |
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.
|
BatchCreateTargetingPresets |
Creates |
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.
|
UpdateTargetingPreset |
Updates a |
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.
|
BatchUpdateTargetingPresets |
Batch updates |
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.
|
BatchDeactivateTargetingPresets |
Batch deactivates |
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 TargetingPresetServiceSettings 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
TargetingPresetServiceSettings targetingPresetServiceSettings =
TargetingPresetServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create(targetingPresetServiceSettings);
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
TargetingPresetServiceSettings targetingPresetServiceSettings =
TargetingPresetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create(targetingPresetServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final TargetingPresetServiceClient create()Constructs an instance of TargetingPresetServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
TargetingPresetServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(TargetingPresetServiceSettings settings)
public static final TargetingPresetServiceClient create(TargetingPresetServiceSettings settings)Constructs an instance of TargetingPresetServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
TargetingPresetServiceSettings |
| Returns | |
|---|---|
| Type | Description |
TargetingPresetServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(TargetingPresetServiceStub stub)
public static final TargetingPresetServiceClient create(TargetingPresetServiceStub stub)Constructs an instance of TargetingPresetServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(TargetingPresetServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
TargetingPresetServiceStub |
| Returns | |
|---|---|
| Type | Description |
TargetingPresetServiceClient |
|
Constructors
TargetingPresetServiceClient(TargetingPresetServiceSettings settings)
protected TargetingPresetServiceClient(TargetingPresetServiceSettings settings)Constructs an instance of TargetingPresetServiceClient, 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.
| Parameter | |
|---|---|
| Name | Description |
settings |
TargetingPresetServiceSettings |
TargetingPresetServiceClient(TargetingPresetServiceStub stub)
protected TargetingPresetServiceClient(TargetingPresetServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
TargetingPresetServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
batchCreateTargetingPresets(@Nullable NetworkName parent, List<CreateTargetingPresetRequest> requests)
public final BatchCreateTargetingPresetsResponse batchCreateTargetingPresets(@Nullable NetworkName parent, List<CreateTargetingPresetRequest> requests)Creates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<CreateTargetingPresetRequest> requests = new ArrayList<>();
BatchCreateTargetingPresetsResponse response =
targetingPresetServiceClient.batchCreateTargetingPresets(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where |
requests |
List<CreateTargetingPresetRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateTargetingPresetsResponse |
|
batchCreateTargetingPresets(BatchCreateTargetingPresetsRequest request)
public final BatchCreateTargetingPresetsResponse batchCreateTargetingPresets(BatchCreateTargetingPresetsRequest request)Creates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
BatchCreateTargetingPresetsRequest request =
BatchCreateTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreateTargetingPresetRequest>())
.build();
BatchCreateTargetingPresetsResponse response =
targetingPresetServiceClient.batchCreateTargetingPresets(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchCreateTargetingPresetsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchCreateTargetingPresetsResponse |
|
batchCreateTargetingPresets(String parent, List<CreateTargetingPresetRequest> requests)
public final BatchCreateTargetingPresetsResponse batchCreateTargetingPresets(String parent, List<CreateTargetingPresetRequest> requests)Creates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<CreateTargetingPresetRequest> requests = new ArrayList<>();
BatchCreateTargetingPresetsResponse response =
targetingPresetServiceClient.batchCreateTargetingPresets(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where |
requests |
List<CreateTargetingPresetRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateTargetingPresetsResponse |
|
batchCreateTargetingPresetsCallable()
public final UnaryCallable<BatchCreateTargetingPresetsRequest,BatchCreateTargetingPresetsResponse> batchCreateTargetingPresetsCallable()Creates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
BatchCreateTargetingPresetsRequest request =
BatchCreateTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreateTargetingPresetRequest>())
.build();
ApiFuture<BatchCreateTargetingPresetsResponse> future =
targetingPresetServiceClient.batchCreateTargetingPresetsCallable().futureCall(request);
// Do something.
BatchCreateTargetingPresetsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchCreateTargetingPresetsRequest,BatchCreateTargetingPresetsResponse> |
|
batchDeactivateTargetingPresets(@Nullable NetworkName parent, List<DeactivateTargetingPresetRequest> requests)
public final BatchDeactivateTargetingPresetsResponse batchDeactivateTargetingPresets(@Nullable NetworkName parent, List<DeactivateTargetingPresetRequest> requests)Batch deactivates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<DeactivateTargetingPresetRequest> requests = new ArrayList<>();
BatchDeactivateTargetingPresetsResponse response =
targetingPresetServiceClient.batchDeactivateTargetingPresets(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. Format: |
requests |
List<DeactivateTargetingPresetRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateTargetingPresetsResponse |
|
batchDeactivateTargetingPresets(BatchDeactivateTargetingPresetsRequest request)
public final BatchDeactivateTargetingPresetsResponse batchDeactivateTargetingPresets(BatchDeactivateTargetingPresetsRequest request)Batch deactivates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
BatchDeactivateTargetingPresetsRequest request =
BatchDeactivateTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<DeactivateTargetingPresetRequest>())
.build();
BatchDeactivateTargetingPresetsResponse response =
targetingPresetServiceClient.batchDeactivateTargetingPresets(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchDeactivateTargetingPresetsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateTargetingPresetsResponse |
|
batchDeactivateTargetingPresets(String parent, List<DeactivateTargetingPresetRequest> requests)
public final BatchDeactivateTargetingPresetsResponse batchDeactivateTargetingPresets(String parent, List<DeactivateTargetingPresetRequest> requests)Batch deactivates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<DeactivateTargetingPresetRequest> requests = new ArrayList<>();
BatchDeactivateTargetingPresetsResponse response =
targetingPresetServiceClient.batchDeactivateTargetingPresets(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
requests |
List<DeactivateTargetingPresetRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateTargetingPresetsResponse |
|
batchDeactivateTargetingPresetsCallable()
public final UnaryCallable<BatchDeactivateTargetingPresetsRequest,BatchDeactivateTargetingPresetsResponse> batchDeactivateTargetingPresetsCallable()Batch deactivates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
BatchDeactivateTargetingPresetsRequest request =
BatchDeactivateTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<DeactivateTargetingPresetRequest>())
.build();
ApiFuture<BatchDeactivateTargetingPresetsResponse> future =
targetingPresetServiceClient
.batchDeactivateTargetingPresetsCallable()
.futureCall(request);
// Do something.
BatchDeactivateTargetingPresetsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchDeactivateTargetingPresetsRequest,BatchDeactivateTargetingPresetsResponse> |
|
batchUpdateTargetingPresets(@Nullable NetworkName parent, List<UpdateTargetingPresetRequest> requests)
public final BatchUpdateTargetingPresetsResponse batchUpdateTargetingPresets(@Nullable NetworkName parent, List<UpdateTargetingPresetRequest> requests)Batch updates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<UpdateTargetingPresetRequest> requests = new ArrayList<>();
BatchUpdateTargetingPresetsResponse response =
targetingPresetServiceClient.batchUpdateTargetingPresets(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where |
requests |
List<UpdateTargetingPresetRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateTargetingPresetsResponse |
|
batchUpdateTargetingPresets(BatchUpdateTargetingPresetsRequest request)
public final BatchUpdateTargetingPresetsResponse batchUpdateTargetingPresets(BatchUpdateTargetingPresetsRequest request)Batch updates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
BatchUpdateTargetingPresetsRequest request =
BatchUpdateTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdateTargetingPresetRequest>())
.build();
BatchUpdateTargetingPresetsResponse response =
targetingPresetServiceClient.batchUpdateTargetingPresets(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchUpdateTargetingPresetsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateTargetingPresetsResponse |
|
batchUpdateTargetingPresets(String parent, List<UpdateTargetingPresetRequest> requests)
public final BatchUpdateTargetingPresetsResponse batchUpdateTargetingPresets(String parent, List<UpdateTargetingPresetRequest> requests)Batch updates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<UpdateTargetingPresetRequest> requests = new ArrayList<>();
BatchUpdateTargetingPresetsResponse response =
targetingPresetServiceClient.batchUpdateTargetingPresets(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where |
requests |
List<UpdateTargetingPresetRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateTargetingPresetsResponse |
|
batchUpdateTargetingPresetsCallable()
public final UnaryCallable<BatchUpdateTargetingPresetsRequest,BatchUpdateTargetingPresetsResponse> batchUpdateTargetingPresetsCallable()Batch updates TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
BatchUpdateTargetingPresetsRequest request =
BatchUpdateTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdateTargetingPresetRequest>())
.build();
ApiFuture<BatchUpdateTargetingPresetsResponse> future =
targetingPresetServiceClient.batchUpdateTargetingPresetsCallable().futureCall(request);
// Do something.
BatchUpdateTargetingPresetsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchUpdateTargetingPresetsRequest,BatchUpdateTargetingPresetsResponse> |
|
close()
public final void close()createTargetingPreset(@Nullable NetworkName parent, TargetingPreset targetingPreset)
public final TargetingPreset createTargetingPreset(@Nullable NetworkName parent, TargetingPreset targetingPreset)Creates a TargetingPreset object.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
TargetingPreset targetingPreset = TargetingPreset.newBuilder().build();
TargetingPreset response =
targetingPresetServiceClient.createTargetingPreset(parent, targetingPreset);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where this |
targetingPreset |
TargetingPresetRequired. The |
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
createTargetingPreset(CreateTargetingPresetRequest request)
public final TargetingPreset createTargetingPreset(CreateTargetingPresetRequest request)Creates a TargetingPreset object.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
CreateTargetingPresetRequest request =
CreateTargetingPresetRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setTargetingPreset(TargetingPreset.newBuilder().build())
.build();
TargetingPreset response = targetingPresetServiceClient.createTargetingPreset(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateTargetingPresetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
createTargetingPreset(String parent, TargetingPreset targetingPreset)
public final TargetingPreset createTargetingPreset(String parent, TargetingPreset targetingPreset)Creates a TargetingPreset object.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
TargetingPreset targetingPreset = TargetingPreset.newBuilder().build();
TargetingPreset response =
targetingPresetServiceClient.createTargetingPreset(parent, targetingPreset);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where this |
targetingPreset |
TargetingPresetRequired. The |
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
createTargetingPresetCallable()
public final UnaryCallable<CreateTargetingPresetRequest,TargetingPreset> createTargetingPresetCallable()Creates a TargetingPreset object.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
CreateTargetingPresetRequest request =
CreateTargetingPresetRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setTargetingPreset(TargetingPreset.newBuilder().build())
.build();
ApiFuture<TargetingPreset> future =
targetingPresetServiceClient.createTargetingPresetCallable().futureCall(request);
// Do something.
TargetingPreset response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateTargetingPresetRequest,TargetingPreset> |
|
getSettings()
public final @Nullable TargetingPresetServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.TargetingPresetServiceSettings |
|
getStub()
public TargetingPresetServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
TargetingPresetServiceStub |
|
getTargetingPreset(@Nullable TargetingPresetName name)
public final TargetingPreset getTargetingPreset(@Nullable TargetingPresetName name)Retrieves a TargetingPreset object. Note: Deactivated targeting presets are "logically
deleted" (filtered out) by the get logic in the manager layer, so they will not be returned by
the GetTargetingPreset RPC.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
TargetingPresetName name = TargetingPresetName.of("[NETWORK_CODE]", "[TARGETING_PRESET]");
TargetingPreset response = targetingPresetServiceClient.getTargetingPreset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.TargetingPresetNameRequired. The resource name of the TargetingPreset. Format:
|
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
getTargetingPreset(GetTargetingPresetRequest request)
public final TargetingPreset getTargetingPreset(GetTargetingPresetRequest request)Retrieves a TargetingPreset object. Note: Deactivated targeting presets are "logically
deleted" (filtered out) by the get logic in the manager layer, so they will not be returned by
the GetTargetingPreset RPC.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
GetTargetingPresetRequest request =
GetTargetingPresetRequest.newBuilder()
.setName(TargetingPresetName.of("[NETWORK_CODE]", "[TARGETING_PRESET]").toString())
.build();
TargetingPreset response = targetingPresetServiceClient.getTargetingPreset(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetTargetingPresetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
getTargetingPreset(String name)
public final TargetingPreset getTargetingPreset(String name)Retrieves a TargetingPreset object. Note: Deactivated targeting presets are "logically
deleted" (filtered out) by the get logic in the manager layer, so they will not be returned by
the GetTargetingPreset RPC.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
String name = TargetingPresetName.of("[NETWORK_CODE]", "[TARGETING_PRESET]").toString();
TargetingPreset response = targetingPresetServiceClient.getTargetingPreset(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the TargetingPreset. Format:
|
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
getTargetingPresetCallable()
public final UnaryCallable<GetTargetingPresetRequest,TargetingPreset> getTargetingPresetCallable()Retrieves a TargetingPreset object. Note: Deactivated targeting presets are "logically
deleted" (filtered out) by the get logic in the manager layer, so they will not be returned by
the GetTargetingPreset RPC.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
GetTargetingPresetRequest request =
GetTargetingPresetRequest.newBuilder()
.setName(TargetingPresetName.of("[NETWORK_CODE]", "[TARGETING_PRESET]").toString())
.build();
ApiFuture<TargetingPreset> future =
targetingPresetServiceClient.getTargetingPresetCallable().futureCall(request);
// Do something.
TargetingPreset response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetTargetingPresetRequest,TargetingPreset> |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listTargetingPresets(@Nullable NetworkName parent)
public final TargetingPresetServiceClient.ListTargetingPresetsPagedResponse listTargetingPresets(@Nullable NetworkName parent)Lists TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (TargetingPreset element :
targetingPresetServiceClient.listTargetingPresets(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent, which owns this collection of TargetingPresets. Format:
|
| Returns | |
|---|---|
| Type | Description |
TargetingPresetServiceClient.ListTargetingPresetsPagedResponse |
|
listTargetingPresets(ListTargetingPresetsRequest request)
public final TargetingPresetServiceClient.ListTargetingPresetsPagedResponse listTargetingPresets(ListTargetingPresetsRequest request)Lists TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
ListTargetingPresetsRequest request =
ListTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (TargetingPreset element :
targetingPresetServiceClient.listTargetingPresets(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListTargetingPresetsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TargetingPresetServiceClient.ListTargetingPresetsPagedResponse |
|
listTargetingPresets(String parent)
public final TargetingPresetServiceClient.ListTargetingPresetsPagedResponse listTargetingPresets(String parent)Lists TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (TargetingPreset element :
targetingPresetServiceClient.listTargetingPresets(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of TargetingPresets. Format:
|
| Returns | |
|---|---|
| Type | Description |
TargetingPresetServiceClient.ListTargetingPresetsPagedResponse |
|
listTargetingPresetsCallable()
public final UnaryCallable<ListTargetingPresetsRequest,ListTargetingPresetsResponse> listTargetingPresetsCallable()Lists TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
ListTargetingPresetsRequest request =
ListTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListTargetingPresetsResponse response =
targetingPresetServiceClient.listTargetingPresetsCallable().call(request);
for (TargetingPreset element : response.getTargetingPresetsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListTargetingPresetsRequest,ListTargetingPresetsResponse> |
|
listTargetingPresetsPagedCallable()
public final UnaryCallable<ListTargetingPresetsRequest,TargetingPresetServiceClient.ListTargetingPresetsPagedResponse> listTargetingPresetsPagedCallable()Lists TargetingPreset objects.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
ListTargetingPresetsRequest request =
ListTargetingPresetsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<TargetingPreset> future =
targetingPresetServiceClient.listTargetingPresetsPagedCallable().futureCall(request);
// Do something.
for (TargetingPreset element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListTargetingPresetsRequest,ListTargetingPresetsPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateTargetingPreset(TargetingPreset targetingPreset, FieldMask updateMask)
public final TargetingPreset updateTargetingPreset(TargetingPreset targetingPreset, FieldMask updateMask)Updates a TargetingPreset object.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
TargetingPreset targetingPreset = TargetingPreset.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
TargetingPreset response =
targetingPresetServiceClient.updateTargetingPreset(targetingPreset, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
targetingPreset |
TargetingPresetRequired. The The |
updateMask |
FieldMaskOptional. The list of fields to update. |
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
updateTargetingPreset(UpdateTargetingPresetRequest request)
public final TargetingPreset updateTargetingPreset(UpdateTargetingPresetRequest request)Updates a TargetingPreset object.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
UpdateTargetingPresetRequest request =
UpdateTargetingPresetRequest.newBuilder()
.setTargetingPreset(TargetingPreset.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
TargetingPreset response = targetingPresetServiceClient.updateTargetingPreset(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateTargetingPresetRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
TargetingPreset |
|
updateTargetingPresetCallable()
public final UnaryCallable<UpdateTargetingPresetRequest,TargetingPreset> updateTargetingPresetCallable()Updates a TargetingPreset object.
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 (TargetingPresetServiceClient targetingPresetServiceClient =
TargetingPresetServiceClient.create()) {
UpdateTargetingPresetRequest request =
UpdateTargetingPresetRequest.newBuilder()
.setTargetingPreset(TargetingPreset.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<TargetingPreset> future =
targetingPresetServiceClient.updateTargetingPresetCallable().futureCall(request);
// Do something.
TargetingPreset response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateTargetingPresetRequest,TargetingPreset> |
|