| GitHub Repository | Product 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().
| Method | Description | Method Variants |
|---|---|---|
GetLabel |
API to retrieve 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.
|
ListLabels |
API to retrieve 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.
|
CreateLabel |
API to create 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.
|
BatchCreateLabels |
API to batch create |
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.
|
UpdateLabel |
API to update 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.
|
BatchUpdateLabels |
API to batch update |
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.
|
BatchActivateLabels |
API to activate |
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.
|
BatchDeactivateLabels |
API to deactivate |
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 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.
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(BatchActivateLabelsRequest request)
public final BatchActivateLabelsResponse batchActivateLabels(BatchActivateLabelsRequest request)API to activate 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 |
BatchActivateLabelsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchActivateLabelsResponse |
|
batchActivateLabels(NetworkName parent, List<String> names)
public final BatchActivateLabelsResponse batchActivateLabels(NetworkName parent, List<String> names)API to activate 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 |
NetworkNameRequired. Format: |
names |
List<String>Required. Resource names for the Label. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchActivateLabelsResponse |
|
batchActivateLabels(String parent, List<String> names)
public final BatchActivateLabelsResponse batchActivateLabels(String parent, List<String> names)API to activate 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 |
StringRequired. Format: |
names |
List<String>Required. Resource names for the Label. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchActivateLabelsResponse |
|
batchActivateLabelsCallable()
public final UnaryCallable<BatchActivateLabelsRequest,BatchActivateLabelsResponse> batchActivateLabelsCallable()API to activate 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(BatchCreateLabelsRequest request)
public final BatchCreateLabelsResponse batchCreateLabels(BatchCreateLabelsRequest request)API to batch create 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 |
BatchCreateLabelsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchCreateLabelsResponse |
|
batchCreateLabels(NetworkName parent, List<CreateLabelRequest> requests)
public final BatchCreateLabelsResponse batchCreateLabels(NetworkName parent, List<CreateLabelRequest> requests)API to batch create 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 |
NetworkNameRequired. The parent resource where |
requests |
List<CreateLabelRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateLabelsResponse |
|
batchCreateLabels(String parent, List<CreateLabelRequest> requests)
public final BatchCreateLabelsResponse batchCreateLabels(String parent, List<CreateLabelRequest> requests)API to batch create 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 |
StringRequired. The parent resource where |
requests |
List<CreateLabelRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreateLabelsResponse |
|
batchCreateLabelsCallable()
public final UnaryCallable<BatchCreateLabelsRequest,BatchCreateLabelsResponse> batchCreateLabelsCallable()API to batch create 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(BatchDeactivateLabelsRequest request)
public final BatchDeactivateLabelsResponse batchDeactivateLabels(BatchDeactivateLabelsRequest request)API to deactivate 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 |
BatchDeactivateLabelsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateLabelsResponse |
|
batchDeactivateLabels(NetworkName parent, List<String> names)
public final BatchDeactivateLabelsResponse batchDeactivateLabels(NetworkName parent, List<String> names)API to deactivate 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 |
NetworkNameRequired. Format: |
names |
List<String>Required. Resource names for the Label. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateLabelsResponse |
|
batchDeactivateLabels(String parent, List<String> names)
public final BatchDeactivateLabelsResponse batchDeactivateLabels(String parent, List<String> names)API to deactivate 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 |
StringRequired. Format: |
names |
List<String>Required. Resource names for the Label. Format:
|
| Returns | |
|---|---|
| Type | Description |
BatchDeactivateLabelsResponse |
|
batchDeactivateLabelsCallable()
public final UnaryCallable<BatchDeactivateLabelsRequest,BatchDeactivateLabelsResponse> batchDeactivateLabelsCallable()API to deactivate 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(BatchUpdateLabelsRequest request)
public final BatchUpdateLabelsResponse batchUpdateLabels(BatchUpdateLabelsRequest request)API to batch update 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 |
BatchUpdateLabelsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateLabelsResponse |
|
batchUpdateLabels(NetworkName parent, List<UpdateLabelRequest> requests)
public final BatchUpdateLabelsResponse batchUpdateLabels(NetworkName parent, List<UpdateLabelRequest> requests)API to batch update 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 |
NetworkNameRequired. The parent resource where |
requests |
List<UpdateLabelRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateLabelsResponse |
|
batchUpdateLabels(String parent, List<UpdateLabelRequest> requests)
public final BatchUpdateLabelsResponse batchUpdateLabels(String parent, List<UpdateLabelRequest> requests)API to batch update 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 |
StringRequired. The parent resource where |
requests |
List<UpdateLabelRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdateLabelsResponse |
|
batchUpdateLabelsCallable()
public final UnaryCallable<BatchUpdateLabelsRequest,BatchUpdateLabelsResponse> batchUpdateLabelsCallable()API to batch update 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(CreateLabelRequest request)
public final Label createLabel(CreateLabelRequest request)API to create 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 |
CreateLabelRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Label |
|
createLabel(NetworkName parent, Label label)
public final Label createLabel(NetworkName parent, Label label)API to create 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 |
NetworkNameRequired. The parent resource where this |
label |
LabelRequired. The |
| Returns | |
|---|---|
| Type | Description |
Label |
|
createLabel(String parent, Label label)
public final Label createLabel(String parent, Label label)API to create 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 |
StringRequired. The parent resource where this |
label |
LabelRequired. The |
| Returns | |
|---|---|
| Type | Description |
Label |
|
createLabelCallable()
public final UnaryCallable<CreateLabelRequest,Label> createLabelCallable()API to create 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(GetLabelRequest request)
public final Label getLabel(GetLabelRequest request)API to retrieve 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 |
GetLabelRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Label |
|
getLabel(LabelName name)
public final Label getLabel(LabelName name)API to retrieve 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 |
LabelNameRequired. The resource name of the Label. Format:
|
| Returns | |
|---|---|
| Type | Description |
Label |
|
getLabel(String name)
public final Label getLabel(String name)API to retrieve 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 |
StringRequired. The resource name of the Label. Format:
|
| Returns | |
|---|---|
| Type | Description |
Label |
|
getLabelCallable()
public final UnaryCallable<GetLabelRequest,Label> getLabelCallable()API to retrieve 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 LabelServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
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(ListLabelsRequest request)
public final LabelServiceClient.ListLabelsPagedResponse listLabels(ListLabelsRequest request)API to retrieve a list of 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 |
ListLabelsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
LabelServiceClient.ListLabelsPagedResponse |
|
listLabels(NetworkName parent)
public final LabelServiceClient.ListLabelsPagedResponse listLabels(NetworkName parent)API to retrieve a list of 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 |
NetworkNameRequired. The parent, which owns this collection of Labels. Format:
|
| Returns | |
|---|---|
| Type | Description |
LabelServiceClient.ListLabelsPagedResponse |
|
listLabels(String parent)
public final LabelServiceClient.ListLabelsPagedResponse listLabels(String parent)API to retrieve a list of 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 |
StringRequired. The parent, which owns this collection of Labels. Format:
|
| Returns | |
|---|---|
| Type | Description |
LabelServiceClient.ListLabelsPagedResponse |
|
listLabelsCallable()
public final UnaryCallable<ListLabelsRequest,ListLabelsResponse> listLabelsCallable()API to retrieve a list of 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()API to retrieve a list of 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)API to update 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 |
LabelRequired. The The |
updateMask |
FieldMaskOptional. The list of fields to update. |
| Returns | |
|---|---|
| Type | Description |
Label |
|
updateLabel(UpdateLabelRequest request)
public final Label updateLabel(UpdateLabelRequest request)API to update 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 |
UpdateLabelRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Label |
|
updateLabelCallable()
public final UnaryCallable<UpdateLabelRequest,Label> updateLabelCallable()API to update 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> |
|