| GitHub Repository | Product Reference |
Service Description: Provides methods for handling AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
AdRuleName name = AdRuleName.of("[NETWORK_CODE]", "[AD_RULE]");
AdRule response = adRuleServiceClient.getAdRule(name);
}
Note: close() needs to be called on the AdRuleServiceClient 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 |
|---|---|---|
GetAdRule |
Retrieves an |
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.
|
ListAdRules |
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.
|
CreateAdRule |
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.
|
BatchCreateAdRules |
Batch 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.
|
UpdateAdRule |
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.
|
BatchUpdateAdRules |
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.
|
BatchActivateAdRules |
Activates a list of |
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.
|
BatchDeactivateAdRules |
Deactivates a list of |
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.
|
BatchDeleteAdRules |
Deletes a list of |
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.
|
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 AdRuleServiceSettings 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
AdRuleServiceSettings adRuleServiceSettings =
AdRuleServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create(adRuleServiceSettings);
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
AdRuleServiceSettings adRuleServiceSettings =
AdRuleServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create(adRuleServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final AdRuleServiceClient create()Constructs an instance of AdRuleServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
AdRuleServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(AdRuleServiceSettings settings)
public static final AdRuleServiceClient create(AdRuleServiceSettings settings)Constructs an instance of AdRuleServiceClient, 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 |
AdRuleServiceSettings |
| Returns | |
|---|---|
| Type | Description |
AdRuleServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(AdRuleServiceStub stub)
public static final AdRuleServiceClient create(AdRuleServiceStub stub)Constructs an instance of AdRuleServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AdRuleServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
AdRuleServiceStub |
| Returns | |
|---|---|
| Type | Description |
AdRuleServiceClient |
|
Constructors
AdRuleServiceClient(AdRuleServiceSettings settings)
protected AdRuleServiceClient(AdRuleServiceSettings settings)Constructs an instance of AdRuleServiceClient, 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 |
AdRuleServiceSettings |
AdRuleServiceClient(AdRuleServiceStub stub)
protected AdRuleServiceClient(AdRuleServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
AdRuleServiceStub |
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 |
|
batchActivateAdRules(@Nullable NetworkName parent, List<String> names)
public final BatchActivateAdRulesResponse batchActivateAdRules(@Nullable NetworkName parent, List<String> names)Activates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchActivateAdRulesResponse response =
adRuleServiceClient.batchActivateAdRules(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. Format: |
names |
List<String>Required. Resource names for the AdRule. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchActivateAdRulesResponse |
|
batchActivateAdRules(BatchActivateAdRulesRequest request)
public final BatchActivateAdRulesResponse batchActivateAdRules(BatchActivateAdRulesRequest request)Activates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchActivateAdRulesRequest request =
BatchActivateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchActivateAdRulesResponse response = adRuleServiceClient.batchActivateAdRules(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchActivateAdRulesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchActivateAdRulesResponse |
|
batchActivateAdRules(String parent, List<String> names)
public final BatchActivateAdRulesResponse batchActivateAdRules(String parent, List<String> names)Activates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchActivateAdRulesResponse response =
adRuleServiceClient.batchActivateAdRules(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. Resource names for the AdRule. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchActivateAdRulesResponse |
|
batchActivateAdRulesCallable()
public final UnaryCallable<BatchActivateAdRulesRequest,BatchActivateAdRulesResponse> batchActivateAdRulesCallable()Activates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchActivateAdRulesRequest request =
BatchActivateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchActivateAdRulesResponse> future =
adRuleServiceClient.batchActivateAdRulesCallable().futureCall(request);
// Do something.
BatchActivateAdRulesResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchActivateAdRulesRequest,BatchActivateAdRulesResponse> |
|
batchCreateAdRules(@Nullable NetworkName parent, List<CreateAdRuleRequest> requests)
public final BatchCreateAdRulesResponse batchCreateAdRules(@Nullable NetworkName parent, List<CreateAdRuleRequest> requests)Batch creates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<CreateAdRuleRequest> requests = new ArrayList<>();
BatchCreateAdRulesResponse response =
adRuleServiceClient.batchCreateAdRules(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where |
requests |
List<CreateAdRuleRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateAdRulesResponse |
|
batchCreateAdRules(BatchCreateAdRulesRequest request)
public final BatchCreateAdRulesResponse batchCreateAdRules(BatchCreateAdRulesRequest request)Batch creates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchCreateAdRulesRequest request =
BatchCreateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreateAdRuleRequest>())
.build();
BatchCreateAdRulesResponse response = adRuleServiceClient.batchCreateAdRules(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchCreateAdRulesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchCreateAdRulesResponse |
|
batchCreateAdRules(String parent, List<CreateAdRuleRequest> requests)
public final BatchCreateAdRulesResponse batchCreateAdRules(String parent, List<CreateAdRuleRequest> requests)Batch creates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<CreateAdRuleRequest> requests = new ArrayList<>();
BatchCreateAdRulesResponse response =
adRuleServiceClient.batchCreateAdRules(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where |
requests |
List<CreateAdRuleRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateAdRulesResponse |
|
batchCreateAdRulesCallable()
public final UnaryCallable<BatchCreateAdRulesRequest,BatchCreateAdRulesResponse> batchCreateAdRulesCallable()Batch creates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchCreateAdRulesRequest request =
BatchCreateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreateAdRuleRequest>())
.build();
ApiFuture<BatchCreateAdRulesResponse> future =
adRuleServiceClient.batchCreateAdRulesCallable().futureCall(request);
// Do something.
BatchCreateAdRulesResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchCreateAdRulesRequest,BatchCreateAdRulesResponse> |
|
batchDeactivateAdRules(@Nullable NetworkName parent, List<String> names)
public final BatchDeactivateAdRulesResponse batchDeactivateAdRules(@Nullable NetworkName parent, List<String> names)Deactivates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchDeactivateAdRulesResponse response =
adRuleServiceClient.batchDeactivateAdRules(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. Format: |
names |
List<String>Required. Resource names for the AdRule. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateAdRulesResponse |
|
batchDeactivateAdRules(BatchDeactivateAdRulesRequest request)
public final BatchDeactivateAdRulesResponse batchDeactivateAdRules(BatchDeactivateAdRulesRequest request)Deactivates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchDeactivateAdRulesRequest request =
BatchDeactivateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchDeactivateAdRulesResponse response = adRuleServiceClient.batchDeactivateAdRules(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchDeactivateAdRulesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateAdRulesResponse |
|
batchDeactivateAdRules(String parent, List<String> names)
public final BatchDeactivateAdRulesResponse batchDeactivateAdRules(String parent, List<String> names)Deactivates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchDeactivateAdRulesResponse response =
adRuleServiceClient.batchDeactivateAdRules(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. Resource names for the AdRule. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateAdRulesResponse |
|
batchDeactivateAdRulesCallable()
public final UnaryCallable<BatchDeactivateAdRulesRequest,BatchDeactivateAdRulesResponse> batchDeactivateAdRulesCallable()Deactivates a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchDeactivateAdRulesRequest request =
BatchDeactivateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchDeactivateAdRulesResponse> future =
adRuleServiceClient.batchDeactivateAdRulesCallable().futureCall(request);
// Do something.
BatchDeactivateAdRulesResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchDeactivateAdRulesRequest,BatchDeactivateAdRulesResponse> |
|
batchDeleteAdRules(@Nullable NetworkName parent, List<String> names)
public final void batchDeleteAdRules(@Nullable NetworkName parent, List<String> names)Deletes a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
adRuleServiceClient.batchDeleteAdRules(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. Format: |
names |
List<String>Required. Resource names for the AdRule. Format:
|
batchDeleteAdRules(BatchDeleteAdRulesRequest request)
public final void batchDeleteAdRules(BatchDeleteAdRulesRequest request)Deletes a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchDeleteAdRulesRequest request =
BatchDeleteAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
adRuleServiceClient.batchDeleteAdRules(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchDeleteAdRulesRequestThe request object containing all of the parameters for the API call. |
batchDeleteAdRules(String parent, List<String> names)
public final void batchDeleteAdRules(String parent, List<String> names)Deletes a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
adRuleServiceClient.batchDeleteAdRules(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. Resource names for the AdRule. Format:
|
batchDeleteAdRulesCallable()
public final UnaryCallable<BatchDeleteAdRulesRequest,Empty> batchDeleteAdRulesCallable()Deletes a list of AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchDeleteAdRulesRequest request =
BatchDeleteAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<Empty> future =
adRuleServiceClient.batchDeleteAdRulesCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchDeleteAdRulesRequest,Empty> |
|
batchUpdateAdRules(@Nullable NetworkName parent, List<UpdateAdRuleRequest> requests)
public final BatchUpdateAdRulesResponse batchUpdateAdRules(@Nullable NetworkName parent, List<UpdateAdRuleRequest> requests)Batch updates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<UpdateAdRuleRequest> requests = new ArrayList<>();
BatchUpdateAdRulesResponse response =
adRuleServiceClient.batchUpdateAdRules(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where |
requests |
List<UpdateAdRuleRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateAdRulesResponse |
|
batchUpdateAdRules(BatchUpdateAdRulesRequest request)
public final BatchUpdateAdRulesResponse batchUpdateAdRules(BatchUpdateAdRulesRequest request)Batch updates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchUpdateAdRulesRequest request =
BatchUpdateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdateAdRuleRequest>())
.build();
BatchUpdateAdRulesResponse response = adRuleServiceClient.batchUpdateAdRules(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchUpdateAdRulesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateAdRulesResponse |
|
batchUpdateAdRules(String parent, List<UpdateAdRuleRequest> requests)
public final BatchUpdateAdRulesResponse batchUpdateAdRules(String parent, List<UpdateAdRuleRequest> requests)Batch updates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<UpdateAdRuleRequest> requests = new ArrayList<>();
BatchUpdateAdRulesResponse response =
adRuleServiceClient.batchUpdateAdRules(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where |
requests |
List<UpdateAdRuleRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateAdRulesResponse |
|
batchUpdateAdRulesCallable()
public final UnaryCallable<BatchUpdateAdRulesRequest,BatchUpdateAdRulesResponse> batchUpdateAdRulesCallable()Batch updates AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
BatchUpdateAdRulesRequest request =
BatchUpdateAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdateAdRuleRequest>())
.build();
ApiFuture<BatchUpdateAdRulesResponse> future =
adRuleServiceClient.batchUpdateAdRulesCallable().futureCall(request);
// Do something.
BatchUpdateAdRulesResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchUpdateAdRulesRequest,BatchUpdateAdRulesResponse> |
|
close()
public final void close()createAdRule(@Nullable NetworkName parent, AdRule adRule)
public final AdRule createAdRule(@Nullable NetworkName parent, AdRule adRule)Creates a AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
AdRule adRule = AdRule.newBuilder().build();
AdRule response = adRuleServiceClient.createAdRule(parent, adRule);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkNameRequired. The parent resource where this |
adRule |
AdRuleRequired. The |
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
createAdRule(CreateAdRuleRequest request)
public final AdRule createAdRule(CreateAdRuleRequest request)Creates a AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
CreateAdRuleRequest request =
CreateAdRuleRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setAdRule(AdRule.newBuilder().build())
.build();
AdRule response = adRuleServiceClient.createAdRule(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateAdRuleRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
createAdRule(String parent, AdRule adRule)
public final AdRule createAdRule(String parent, AdRule adRule)Creates a AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
AdRule adRule = AdRule.newBuilder().build();
AdRule response = adRuleServiceClient.createAdRule(parent, adRule);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where this |
adRule |
AdRuleRequired. The |
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
createAdRuleCallable()
public final UnaryCallable<CreateAdRuleRequest,AdRule> createAdRuleCallable()Creates a AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
CreateAdRuleRequest request =
CreateAdRuleRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setAdRule(AdRule.newBuilder().build())
.build();
ApiFuture<AdRule> future = adRuleServiceClient.createAdRuleCallable().futureCall(request);
// Do something.
AdRule response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateAdRuleRequest,AdRule> |
|
getAdRule(@Nullable AdRuleName name)
public final AdRule getAdRule(@Nullable AdRuleName name)Retrieves an AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
AdRuleName name = AdRuleName.of("[NETWORK_CODE]", "[AD_RULE]");
AdRule response = adRuleServiceClient.getAdRule(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.AdRuleNameRequired. The resource name of the AdRule. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
getAdRule(GetAdRuleRequest request)
public final AdRule getAdRule(GetAdRuleRequest request)Retrieves an AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
GetAdRuleRequest request =
GetAdRuleRequest.newBuilder()
.setName(AdRuleName.of("[NETWORK_CODE]", "[AD_RULE]").toString())
.build();
AdRule response = adRuleServiceClient.getAdRule(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetAdRuleRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
getAdRule(String name)
public final AdRule getAdRule(String name)Retrieves an AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String name = AdRuleName.of("[NETWORK_CODE]", "[AD_RULE]").toString();
AdRule response = adRuleServiceClient.getAdRule(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the AdRule. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
getAdRuleCallable()
public final UnaryCallable<GetAdRuleRequest,AdRule> getAdRuleCallable()Retrieves an AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
GetAdRuleRequest request =
GetAdRuleRequest.newBuilder()
.setName(AdRuleName.of("[NETWORK_CODE]", "[AD_RULE]").toString())
.build();
ApiFuture<AdRule> future = adRuleServiceClient.getAdRuleCallable().futureCall(request);
// Do something.
AdRule response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetAdRuleRequest,AdRule> |
|
getSettings()
public final @Nullable AdRuleServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.AdRuleServiceSettings |
|
getStub()
public AdRuleServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
AdRuleServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listAdRules(@Nullable NetworkName parent)
public final AdRuleServiceClient.ListAdRulesPagedResponse listAdRules(@Nullable NetworkName parent)Lists AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (AdRule element : adRuleServiceClient.listAdRules(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 AdRules. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdRuleServiceClient.ListAdRulesPagedResponse |
|
listAdRules(ListAdRulesRequest request)
public final AdRuleServiceClient.ListAdRulesPagedResponse listAdRules(ListAdRulesRequest request)Lists AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
ListAdRulesRequest request =
ListAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (AdRule element : adRuleServiceClient.listAdRules(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListAdRulesRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdRuleServiceClient.ListAdRulesPagedResponse |
|
listAdRules(String parent)
public final AdRuleServiceClient.ListAdRulesPagedResponse listAdRules(String parent)Lists AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (AdRule element : adRuleServiceClient.listAdRules(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of AdRules. Format:
|
| Returns | |
|---|---|
| Type | Description |
AdRuleServiceClient.ListAdRulesPagedResponse |
|
listAdRulesCallable()
public final UnaryCallable<ListAdRulesRequest,ListAdRulesResponse> listAdRulesCallable()Lists AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
ListAdRulesRequest request =
ListAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListAdRulesResponse response = adRuleServiceClient.listAdRulesCallable().call(request);
for (AdRule element : response.getAdRulesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdRulesRequest,ListAdRulesResponse> |
|
listAdRulesPagedCallable()
public final UnaryCallable<ListAdRulesRequest,AdRuleServiceClient.ListAdRulesPagedResponse> listAdRulesPagedCallable()Lists AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
ListAdRulesRequest request =
ListAdRulesRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<AdRule> future = adRuleServiceClient.listAdRulesPagedCallable().futureCall(request);
// Do something.
for (AdRule element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAdRulesRequest,ListAdRulesPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateAdRule(AdRule adRule, FieldMask updateMask)
public final AdRule updateAdRule(AdRule adRule, FieldMask updateMask)Updates a AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
AdRule adRule = AdRule.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
AdRule response = adRuleServiceClient.updateAdRule(adRule, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
adRule |
AdRuleRequired. The The |
updateMask |
FieldMaskOptional. The list of fields to update. |
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
updateAdRule(UpdateAdRuleRequest request)
public final AdRule updateAdRule(UpdateAdRuleRequest request)Updates a AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
UpdateAdRuleRequest request =
UpdateAdRuleRequest.newBuilder()
.setAdRule(AdRule.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
AdRule response = adRuleServiceClient.updateAdRule(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateAdRuleRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AdRule |
|
updateAdRuleCallable()
public final UnaryCallable<UpdateAdRuleRequest,AdRule> updateAdRuleCallable()Updates a AdRule 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 (AdRuleServiceClient adRuleServiceClient = AdRuleServiceClient.create()) {
UpdateAdRuleRequest request =
UpdateAdRuleRequest.newBuilder()
.setAdRule(AdRule.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<AdRule> future = adRuleServiceClient.updateAdRuleCallable().futureCall(request);
// Do something.
AdRule response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateAdRuleRequest,AdRule> |
|