Class LabelServiceClient (0.54.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   LabelName name = LabelName.of("[NETWORK_CODE]", "[LABEL]");
   Label response = labelServiceClient.getLabel(name);
 }
 

Note: close() needs to be called on the LabelServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

GetLabel

Retrieves a Label object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLabel(GetLabelRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getLabel(LabelName name)

  • getLabel(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLabelCallable()

ListLabels

Lists Label objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLabels(ListLabelsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listLabels(NetworkName parent)

  • listLabels(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLabelsPagedCallable()

  • listLabelsCallable()

CreateLabel

Creates a Label object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createLabel(CreateLabelRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createLabel(NetworkName parent, Label label)

  • createLabel(String parent, Label label)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createLabelCallable()

BatchCreateLabels

Creates Label objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchCreateLabels(NetworkName parent, List<CreateLabelRequest> requests)

  • batchCreateLabels(String parent, List<CreateLabelRequest> requests)

  • batchCreateLabels(BatchCreateLabelsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchCreateLabelsCallable()

UpdateLabel

Updates a Label object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateLabel(UpdateLabelRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateLabel(Label label, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateLabelCallable()

BatchUpdateLabels

Batch updates Label objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchUpdateLabels(NetworkName parent, List<UpdateLabelRequest> requests)

  • batchUpdateLabels(String parent, List<UpdateLabelRequest> requests)

  • batchUpdateLabels(BatchUpdateLabelsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchUpdateLabelsCallable()

BatchActivateLabels

Activates Label objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchActivateLabels(BatchActivateLabelsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • batchActivateLabels(NetworkName parent, List<String> names)

  • batchActivateLabels(String parent, List<String> names)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchActivateLabelsCallable()

BatchDeactivateLabels

Deactivates Label objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchDeactivateLabels(BatchDeactivateLabelsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • batchDeactivateLabels(NetworkName parent, List<String> names)

  • batchDeactivateLabels(String parent, List<String> names)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchDeactivateLabelsCallable()

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 LabelServiceSettings 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
 LabelServiceSettings labelServiceSettings =
     LabelServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 LabelServiceClient labelServiceClient = LabelServiceClient.create(labelServiceSettings);
 

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
 LabelServiceSettings labelServiceSettings =
     LabelServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 LabelServiceClient labelServiceClient = LabelServiceClient.create(labelServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > LabelServiceClient

Static Methods

create()

public static final LabelServiceClient create()

Constructs an instance of LabelServiceClient with default settings.

Returns
Type Description
LabelServiceClient
Exceptions
Type Description
IOException

create(LabelServiceSettings settings)

public static final LabelServiceClient create(LabelServiceSettings settings)

Constructs an instance of LabelServiceClient, 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 LabelServiceSettings
Returns
Type Description
LabelServiceClient
Exceptions
Type Description
IOException

create(LabelServiceStub stub)

public static final LabelServiceClient create(LabelServiceStub stub)

Constructs an instance of LabelServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(LabelServiceSettings).

Parameter
Name Description
stub LabelServiceStub
Returns
Type Description
LabelServiceClient

Constructors

LabelServiceClient(LabelServiceSettings settings)

protected LabelServiceClient(LabelServiceSettings settings)

Constructs an instance of LabelServiceClient, 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 LabelServiceSettings

LabelServiceClient(LabelServiceStub stub)

protected LabelServiceClient(LabelServiceStub stub)
Parameter
Name Description
stub LabelServiceStub

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

batchActivateLabels(@Nullable NetworkName parent, List<String> names)

public final BatchActivateLabelsResponse batchActivateLabels(@Nullable NetworkName parent, List<String> names)

Activates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchActivateLabelsResponse response = labelServiceClient.batchActivateLabels(parent, names);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. Resource names for the Label. Format: networks/{network_code}/labels/{label_id}

Returns
Type Description
BatchActivateLabelsResponse

batchActivateLabels(BatchActivateLabelsRequest request)

public final BatchActivateLabelsResponse batchActivateLabels(BatchActivateLabelsRequest request)

Activates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchActivateLabelsRequest request =
       BatchActivateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchActivateLabelsResponse response = labelServiceClient.batchActivateLabels(request);
 }
 
Parameter
Name Description
request BatchActivateLabelsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchActivateLabelsResponse

batchActivateLabels(String parent, List<String> names)

public final BatchActivateLabelsResponse batchActivateLabels(String parent, List<String> names)

Activates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchActivateLabelsResponse response = labelServiceClient.batchActivateLabels(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. Resource names for the Label. Format: networks/{network_code}/labels/{label_id}

Returns
Type Description
BatchActivateLabelsResponse

batchActivateLabelsCallable()

public final UnaryCallable<BatchActivateLabelsRequest,BatchActivateLabelsResponse> batchActivateLabelsCallable()

Activates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchActivateLabelsRequest request =
       BatchActivateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchActivateLabelsResponse> future =
       labelServiceClient.batchActivateLabelsCallable().futureCall(request);
   // Do something.
   BatchActivateLabelsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchActivateLabelsRequest,BatchActivateLabelsResponse>

batchCreateLabels(@Nullable NetworkName parent, List<CreateLabelRequest> requests)

public final BatchCreateLabelsResponse batchCreateLabels(@Nullable NetworkName parent, List<CreateLabelRequest> requests)

Creates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<CreateLabelRequest> requests = new ArrayList<>();
   BatchCreateLabelsResponse response = labelServiceClient.batchCreateLabels(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where Labels will be created. Format: networks/{network_code} The parent field in the CreateLabelRequest must match this field.

requests List<CreateLabelRequest>

Required. The Label objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateLabelsResponse

batchCreateLabels(BatchCreateLabelsRequest request)

public final BatchCreateLabelsResponse batchCreateLabels(BatchCreateLabelsRequest request)

Creates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchCreateLabelsRequest request =
       BatchCreateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateLabelRequest>())
           .build();
   BatchCreateLabelsResponse response = labelServiceClient.batchCreateLabels(request);
 }
 
Parameter
Name Description
request BatchCreateLabelsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchCreateLabelsResponse

batchCreateLabels(String parent, List<CreateLabelRequest> requests)

public final BatchCreateLabelsResponse batchCreateLabels(String parent, List<CreateLabelRequest> requests)

Creates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<CreateLabelRequest> requests = new ArrayList<>();
   BatchCreateLabelsResponse response = labelServiceClient.batchCreateLabels(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where Labels will be created. Format: networks/{network_code} The parent field in the CreateLabelRequest must match this field.

requests List<CreateLabelRequest>

Required. The Label objects to create. A maximum of 100 objects can be created in a batch.

Returns
Type Description
BatchCreateLabelsResponse

batchCreateLabelsCallable()

public final UnaryCallable<BatchCreateLabelsRequest,BatchCreateLabelsResponse> batchCreateLabelsCallable()

Creates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchCreateLabelsRequest request =
       BatchCreateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateLabelRequest>())
           .build();
   ApiFuture<BatchCreateLabelsResponse> future =
       labelServiceClient.batchCreateLabelsCallable().futureCall(request);
   // Do something.
   BatchCreateLabelsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchCreateLabelsRequest,BatchCreateLabelsResponse>

batchDeactivateLabels(@Nullable NetworkName parent, List<String> names)

public final BatchDeactivateLabelsResponse batchDeactivateLabels(@Nullable NetworkName parent, List<String> names)

Deactivates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchDeactivateLabelsResponse response =
       labelServiceClient.batchDeactivateLabels(parent, names);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. Resource names for the Label. Format: networks/{network_code}/labels/{label_id}

Returns
Type Description
BatchDeactivateLabelsResponse

batchDeactivateLabels(BatchDeactivateLabelsRequest request)

public final BatchDeactivateLabelsResponse batchDeactivateLabels(BatchDeactivateLabelsRequest request)

Deactivates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchDeactivateLabelsRequest request =
       BatchDeactivateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchDeactivateLabelsResponse response = labelServiceClient.batchDeactivateLabels(request);
 }
 
Parameter
Name Description
request BatchDeactivateLabelsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchDeactivateLabelsResponse

batchDeactivateLabels(String parent, List<String> names)

public final BatchDeactivateLabelsResponse batchDeactivateLabels(String parent, List<String> names)

Deactivates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchDeactivateLabelsResponse response =
       labelServiceClient.batchDeactivateLabels(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. Resource names for the Label. Format: networks/{network_code}/labels/{label_id}

Returns
Type Description
BatchDeactivateLabelsResponse

batchDeactivateLabelsCallable()

public final UnaryCallable<BatchDeactivateLabelsRequest,BatchDeactivateLabelsResponse> batchDeactivateLabelsCallable()

Deactivates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchDeactivateLabelsRequest request =
       BatchDeactivateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchDeactivateLabelsResponse> future =
       labelServiceClient.batchDeactivateLabelsCallable().futureCall(request);
   // Do something.
   BatchDeactivateLabelsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchDeactivateLabelsRequest,BatchDeactivateLabelsResponse>

batchUpdateLabels(@Nullable NetworkName parent, List<UpdateLabelRequest> requests)

public final BatchUpdateLabelsResponse batchUpdateLabels(@Nullable NetworkName parent, List<UpdateLabelRequest> requests)

Batch updates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<UpdateLabelRequest> requests = new ArrayList<>();
   BatchUpdateLabelsResponse response = labelServiceClient.batchUpdateLabels(parent, requests);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where Labels will be updated. Format: networks/{network_code} The parent field in the UpdateLabelRequest must match this field.

requests List<UpdateLabelRequest>

Required. The Label objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateLabelsResponse

batchUpdateLabels(BatchUpdateLabelsRequest request)

public final BatchUpdateLabelsResponse batchUpdateLabels(BatchUpdateLabelsRequest request)

Batch updates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchUpdateLabelsRequest request =
       BatchUpdateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateLabelRequest>())
           .build();
   BatchUpdateLabelsResponse response = labelServiceClient.batchUpdateLabels(request);
 }
 
Parameter
Name Description
request BatchUpdateLabelsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchUpdateLabelsResponse

batchUpdateLabels(String parent, List<UpdateLabelRequest> requests)

public final BatchUpdateLabelsResponse batchUpdateLabels(String parent, List<UpdateLabelRequest> requests)

Batch updates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<UpdateLabelRequest> requests = new ArrayList<>();
   BatchUpdateLabelsResponse response = labelServiceClient.batchUpdateLabels(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where Labels will be updated. Format: networks/{network_code} The parent field in the UpdateLabelRequest must match this field.

requests List<UpdateLabelRequest>

Required. The Label objects to update. A maximum of 100 objects can be updated in a batch.

Returns
Type Description
BatchUpdateLabelsResponse

batchUpdateLabelsCallable()

public final UnaryCallable<BatchUpdateLabelsRequest,BatchUpdateLabelsResponse> batchUpdateLabelsCallable()

Batch updates Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   BatchUpdateLabelsRequest request =
       BatchUpdateLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateLabelRequest>())
           .build();
   ApiFuture<BatchUpdateLabelsResponse> future =
       labelServiceClient.batchUpdateLabelsCallable().futureCall(request);
   // Do something.
   BatchUpdateLabelsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchUpdateLabelsRequest,BatchUpdateLabelsResponse>

close()

public final void close()

createLabel(@Nullable NetworkName parent, Label label)

public final Label createLabel(@Nullable NetworkName parent, Label label)

Creates a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   Label label = Label.newBuilder().build();
   Label response = labelServiceClient.createLabel(parent, label);
 }
 
Parameters
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent resource where this Label will be created. Format: networks/{network_code}

label Label

Required. The Label to create.

Returns
Type Description
Label

createLabel(CreateLabelRequest request)

public final Label createLabel(CreateLabelRequest request)

Creates a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   CreateLabelRequest request =
       CreateLabelRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setLabel(Label.newBuilder().build())
           .build();
   Label response = labelServiceClient.createLabel(request);
 }
 
Parameter
Name Description
request CreateLabelRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Label

createLabel(String parent, Label label)

public final Label createLabel(String parent, Label label)

Creates a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   Label label = Label.newBuilder().build();
   Label response = labelServiceClient.createLabel(parent, label);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where this Label will be created. Format: networks/{network_code}

label Label

Required. The Label to create.

Returns
Type Description
Label

createLabelCallable()

public final UnaryCallable<CreateLabelRequest,Label> createLabelCallable()

Creates a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   CreateLabelRequest request =
       CreateLabelRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setLabel(Label.newBuilder().build())
           .build();
   ApiFuture<Label> future = labelServiceClient.createLabelCallable().futureCall(request);
   // Do something.
   Label response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateLabelRequest,Label>

getLabel(@Nullable LabelName name)

public final Label getLabel(@Nullable LabelName name)

Retrieves a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   LabelName name = LabelName.of("[NETWORK_CODE]", "[LABEL]");
   Label response = labelServiceClient.getLabel(name);
 }
 
Parameter
Name Description
name @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.LabelName

Required. The resource name of the Label. Format: networks/{network_code}/labels/{label_id}

Returns
Type Description
Label

getLabel(GetLabelRequest request)

public final Label getLabel(GetLabelRequest request)

Retrieves a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   GetLabelRequest request =
       GetLabelRequest.newBuilder()
           .setName(LabelName.of("[NETWORK_CODE]", "[LABEL]").toString())
           .build();
   Label response = labelServiceClient.getLabel(request);
 }
 
Parameter
Name Description
request GetLabelRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Label

getLabel(String name)

public final Label getLabel(String name)

Retrieves a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   String name = LabelName.of("[NETWORK_CODE]", "[LABEL]").toString();
   Label response = labelServiceClient.getLabel(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the Label. Format: networks/{network_code}/labels/{label_id}

Returns
Type Description
Label

getLabelCallable()

public final UnaryCallable<GetLabelRequest,Label> getLabelCallable()

Retrieves a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   GetLabelRequest request =
       GetLabelRequest.newBuilder()
           .setName(LabelName.of("[NETWORK_CODE]", "[LABEL]").toString())
           .build();
   ApiFuture<Label> future = labelServiceClient.getLabelCallable().futureCall(request);
   // Do something.
   Label response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetLabelRequest,Label>

getSettings()

public final @Nullable LabelServiceSettings getSettings()
Returns
Type Description
@org.jspecify.annotations.Nullable com.google.ads.admanager.v1.LabelServiceSettings

getStub()

public LabelServiceStub getStub()
Returns
Type Description
LabelServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listLabels(@Nullable NetworkName parent)

public final LabelServiceClient.ListLabelsPagedResponse listLabels(@Nullable NetworkName parent)

Lists Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (Label element : labelServiceClient.listLabels(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent @org.jspecify.annotations.Nullable com.google.ads.admanager.v1.NetworkName

Required. The parent, which owns this collection of Labels. Format: networks/{network_code}

Returns
Type Description
LabelServiceClient.ListLabelsPagedResponse

listLabels(ListLabelsRequest request)

public final LabelServiceClient.ListLabelsPagedResponse listLabels(ListLabelsRequest request)

Lists Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   ListLabelsRequest request =
       ListLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   for (Label element : labelServiceClient.listLabels(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListLabelsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
LabelServiceClient.ListLabelsPagedResponse

listLabels(String parent)

public final LabelServiceClient.ListLabelsPagedResponse listLabels(String parent)

Lists Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (Label element : labelServiceClient.listLabels(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent, which owns this collection of Labels. Format: networks/{network_code}

Returns
Type Description
LabelServiceClient.ListLabelsPagedResponse

listLabelsCallable()

public final UnaryCallable<ListLabelsRequest,ListLabelsResponse> listLabelsCallable()

Lists Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   ListLabelsRequest request =
       ListLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   while (true) {
     ListLabelsResponse response = labelServiceClient.listLabelsCallable().call(request);
     for (Label element : response.getLabelsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListLabelsRequest,ListLabelsResponse>

listLabelsPagedCallable()

public final UnaryCallable<ListLabelsRequest,LabelServiceClient.ListLabelsPagedResponse> listLabelsPagedCallable()

Lists Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   ListLabelsRequest request =
       ListLabelsRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   ApiFuture<Label> future = labelServiceClient.listLabelsPagedCallable().futureCall(request);
   // Do something.
   for (Label element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListLabelsRequest,ListLabelsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateLabel(Label label, FieldMask updateMask)

public final Label updateLabel(Label label, FieldMask updateMask)

Updates a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   Label label = Label.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Label response = labelServiceClient.updateLabel(label, updateMask);
 }
 
Parameters
Name Description
label Label

Required. The Label to update.

The Label's name is used to identify the Label to update.

updateMask FieldMask

Optional. The list of fields to update.

Returns
Type Description
Label

updateLabel(UpdateLabelRequest request)

public final Label updateLabel(UpdateLabelRequest request)

Updates a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   UpdateLabelRequest request =
       UpdateLabelRequest.newBuilder()
           .setLabel(Label.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Label response = labelServiceClient.updateLabel(request);
 }
 
Parameter
Name Description
request UpdateLabelRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Label

updateLabelCallable()

public final UnaryCallable<UpdateLabelRequest,Label> updateLabelCallable()

Updates a Label 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 (LabelServiceClient labelServiceClient = LabelServiceClient.create()) {
   UpdateLabelRequest request =
       UpdateLabelRequest.newBuilder()
           .setLabel(Label.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Label> future = labelServiceClient.updateLabelCallable().futureCall(request);
   // Do something.
   Label response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateLabelRequest,Label>