@Generated(value="by gapic-generator-java") public class TagValuesClient extends Object implements com.google.api.gax.core.BackgroundResource
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TagValueName name = TagValueName.of("[TAG_VALUE]");
TagValue response = tagValuesClient.getTagValue(name);
}
Note: close() needs to be called on the TagValuesClient 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 |
|---|---|---|
ListTagValues |
Lists all TagValues for a specific TagKey. |
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.
|
GetTagValue |
Retrieves a TagValue. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it. |
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.
|
GetNamespacedTagValue |
Retrieves a TagValue by its namespaced name. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it. |
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.
|
CreateTagValue |
Creates a TagValue as a child of the specified TagKey. If a another request with the same parameters is sent while the original request is in process the second request will receive an error. A maximum of 1000 TagValues can exist under a TagKey at any given time. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateTagValue |
Updates the attributes of the TagValue resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteTagValue |
Deletes a TagValue. The TagValue cannot have any bindings when it is deleted. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a TagValue. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. The caller must have the `cloudresourcemanager.googleapis.com/tagValues.getIamPolicy` permission on the identified TagValue to get the access control policy. |
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.
|
SetIamPolicy |
Sets the access control policy on a TagValue, replacing any existing policy. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. The caller must have `resourcemanager.tagValues.setIamPolicy` permission on the identified tagValue. |
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.
|
TestIamPermissions |
Returns permissions that a caller has on the specified TagValue. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. There are no permissions required for making this API call. |
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 TagValuesSettings 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
TagValuesSettings tagValuesSettings =
TagValuesSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TagValuesClient tagValuesClient = TagValuesClient.create(tagValuesSettings);
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
TagValuesSettings tagValuesSettings =
TagValuesSettings.newBuilder().setEndpoint(myEndpoint).build();
TagValuesClient tagValuesClient = TagValuesClient.create(tagValuesSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
TagValuesSettings tagValuesSettings = TagValuesSettings.newHttpJsonBuilder().build();
TagValuesClient tagValuesClient = TagValuesClient.create(tagValuesSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
TagValuesClient.ListTagValuesFixedSizeCollection |
static class |
TagValuesClient.ListTagValuesPage |
static class |
TagValuesClient.ListTagValuesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
TagValuesClient(TagValuesSettings settings)
Constructs an instance of TagValuesClient, using the given settings.
|
protected |
TagValuesClient(TagValuesStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static TagValuesClient |
create()
Constructs an instance of TagValuesClient with default settings.
|
static TagValuesClient |
create(TagValuesSettings settings)
Constructs an instance of TagValuesClient, using the given settings.
|
static TagValuesClient |
create(TagValuesStub stub)
Constructs an instance of TagValuesClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<TagValue,CreateTagValueMetadata> |
createTagValueAsync(CreateTagValueRequest request)
Creates a TagValue as a child of the specified TagKey.
|
com.google.api.gax.longrunning.OperationFuture<TagValue,CreateTagValueMetadata> |
createTagValueAsync(TagValue tagValue)
Creates a TagValue as a child of the specified TagKey.
|
com.google.api.gax.rpc.UnaryCallable<CreateTagValueRequest,com.google.longrunning.Operation> |
createTagValueCallable()
Creates a TagValue as a child of the specified TagKey.
|
com.google.api.gax.rpc.OperationCallable<CreateTagValueRequest,TagValue,CreateTagValueMetadata> |
createTagValueOperationCallable()
Creates a TagValue as a child of the specified TagKey.
|
com.google.api.gax.longrunning.OperationFuture<TagValue,DeleteTagValueMetadata> |
deleteTagValueAsync(DeleteTagValueRequest request)
Deletes a TagValue.
|
com.google.api.gax.longrunning.OperationFuture<TagValue,DeleteTagValueMetadata> |
deleteTagValueAsync(String name)
Deletes a TagValue.
|
com.google.api.gax.longrunning.OperationFuture<TagValue,DeleteTagValueMetadata> |
deleteTagValueAsync(TagValueName name)
Deletes a TagValue.
|
com.google.api.gax.rpc.UnaryCallable<DeleteTagValueRequest,com.google.longrunning.Operation> |
deleteTagValueCallable()
Deletes a TagValue.
|
com.google.api.gax.rpc.OperationCallable<DeleteTagValueRequest,TagValue,DeleteTagValueMetadata> |
deleteTagValueOperationCallable()
Deletes a TagValue.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a TagValue.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.api.resourcenames.ResourceName resource)
Gets the access control policy for a TagValue.
|
com.google.iam.v1.Policy |
getIamPolicy(String resource)
Gets the access control policy for a TagValue.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a TagValue.
|
TagValue |
getNamespacedTagValue(GetNamespacedTagValueRequest request)
Retrieves a TagValue by its namespaced name.
|
TagValue |
getNamespacedTagValue(String name)
Retrieves a TagValue by its namespaced name.
|
TagValue |
getNamespacedTagValue(TagValueName name)
Retrieves a TagValue by its namespaced name.
|
com.google.api.gax.rpc.UnaryCallable<GetNamespacedTagValueRequest,TagValue> |
getNamespacedTagValueCallable()
Retrieves a TagValue by its namespaced name.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
TagValuesSettings |
getSettings() |
TagValuesStub |
getStub() |
TagValue |
getTagValue(GetTagValueRequest request)
Retrieves a TagValue.
|
TagValue |
getTagValue(String name)
Retrieves a TagValue.
|
TagValue |
getTagValue(TagValueName name)
Retrieves a TagValue.
|
com.google.api.gax.rpc.UnaryCallable<GetTagValueRequest,TagValue> |
getTagValueCallable()
Retrieves a TagValue.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
TagValuesClient.ListTagValuesPagedResponse |
listTagValues(ListTagValuesRequest request)
Lists all TagValues for a specific TagKey.
|
TagValuesClient.ListTagValuesPagedResponse |
listTagValues(com.google.api.resourcenames.ResourceName parent)
Lists all TagValues for a specific TagKey.
|
TagValuesClient.ListTagValuesPagedResponse |
listTagValues(String parent)
Lists all TagValues for a specific TagKey.
|
com.google.api.gax.rpc.UnaryCallable<ListTagValuesRequest,ListTagValuesResponse> |
listTagValuesCallable()
Lists all TagValues for a specific TagKey.
|
com.google.api.gax.rpc.UnaryCallable<ListTagValuesRequest,TagValuesClient.ListTagValuesPagedResponse> |
listTagValuesPagedCallable()
Lists all TagValues for a specific TagKey.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.api.resourcenames.ResourceName resource,
com.google.iam.v1.Policy policy)
Sets the access control policy on a TagValue, replacing any existing policy.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on a TagValue, replacing any existing policy.
|
com.google.iam.v1.Policy |
setIamPolicy(String resource,
com.google.iam.v1.Policy policy)
Sets the access control policy on a TagValue, replacing any existing policy.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on a TagValue, replacing any existing policy.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.api.resourcenames.ResourceName resource,
List<String> permissions)
Returns permissions that a caller has on the specified TagValue.
|
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(String resource,
List<String> permissions)
Returns permissions that a caller has on the specified TagValue.
|
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified TagValue.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified TagValue.
|
com.google.api.gax.longrunning.OperationFuture<TagValue,UpdateTagValueMetadata> |
updateTagValueAsync(TagValue tagValue,
com.google.protobuf.FieldMask updateMask)
Updates the attributes of the TagValue resource.
|
com.google.api.gax.longrunning.OperationFuture<TagValue,UpdateTagValueMetadata> |
updateTagValueAsync(UpdateTagValueRequest request)
Updates the attributes of the TagValue resource.
|
com.google.api.gax.rpc.UnaryCallable<UpdateTagValueRequest,com.google.longrunning.Operation> |
updateTagValueCallable()
Updates the attributes of the TagValue resource.
|
com.google.api.gax.rpc.OperationCallable<UpdateTagValueRequest,TagValue,UpdateTagValueMetadata> |
updateTagValueOperationCallable()
Updates the attributes of the TagValue resource.
|
protected TagValuesClient(TagValuesSettings settings) throws IOException
IOExceptionprotected TagValuesClient(TagValuesStub stub)
public static final TagValuesClient create() throws IOException
IOExceptionpublic static final TagValuesClient create(TagValuesSettings settings) throws IOException
IOExceptionpublic static final TagValuesClient create(TagValuesStub stub)
public final TagValuesSettings getSettings()
public TagValuesStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final TagValuesClient.ListTagValuesPagedResponse listTagValues(com.google.api.resourcenames.ResourceName parent)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
ResourceName parent = FolderName.of("[FOLDER]");
for (TagValue element : tagValuesClient.listTagValues(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TagValuesClient.ListTagValuesPagedResponse listTagValues(String parent)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
String parent = FolderName.of("[FOLDER]").toString();
for (TagValue element : tagValuesClient.listTagValues(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TagValuesClient.ListTagValuesPagedResponse listTagValues(ListTagValuesRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
ListTagValuesRequest request =
ListTagValuesRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (TagValue element : tagValuesClient.listTagValues(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListTagValuesRequest,TagValuesClient.ListTagValuesPagedResponse> listTagValuesPagedCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
ListTagValuesRequest request =
ListTagValuesRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<TagValue> future = tagValuesClient.listTagValuesPagedCallable().futureCall(request);
// Do something.
for (TagValue element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListTagValuesRequest,ListTagValuesResponse> listTagValuesCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
ListTagValuesRequest request =
ListTagValuesRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListTagValuesResponse response = tagValuesClient.listTagValuesCallable().call(request);
for (TagValue element : response.getTagValuesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final TagValue getTagValue(TagValueName name)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TagValueName name = TagValueName.of("[TAG_VALUE]");
TagValue response = tagValuesClient.getTagValue(name);
}
name - Required. Resource name for TagValue to be fetched in the format `tagValues/456`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TagValue getTagValue(String name)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
String name = TagValueName.of("[TAG_VALUE]").toString();
TagValue response = tagValuesClient.getTagValue(name);
}
name - Required. Resource name for TagValue to be fetched in the format `tagValues/456`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TagValue getTagValue(GetTagValueRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
GetTagValueRequest request =
GetTagValueRequest.newBuilder()
.setName(TagValueName.of("[TAG_VALUE]").toString())
.build();
TagValue response = tagValuesClient.getTagValue(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetTagValueRequest,TagValue> getTagValueCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
GetTagValueRequest request =
GetTagValueRequest.newBuilder()
.setName(TagValueName.of("[TAG_VALUE]").toString())
.build();
ApiFuture<TagValue> future = tagValuesClient.getTagValueCallable().futureCall(request);
// Do something.
TagValue response = future.get();
}
public final TagValue getNamespacedTagValue(TagValueName name)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TagValueName name = TagValueName.of("[TAG_VALUE]");
TagValue response = tagValuesClient.getNamespacedTagValue(name);
}
name - Required. A namespaced tag value name in the following format:
`{parentId}/{tagKeyShort}/{tagValueShort}`
Examples: - `42/foo/abc` for a value with short name "abc" under the key with short name "foo" under the organization with ID 42 - `r2-d2/bar/xyz` for a value with short name "xyz" under the key with short name "bar" under the project with ID "r2-d2"
com.google.api.gax.rpc.ApiException - if the remote call failspublic final TagValue getNamespacedTagValue(String name)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
String name = TagValueName.of("[TAG_VALUE]").toString();
TagValue response = tagValuesClient.getNamespacedTagValue(name);
}
name - Required. A namespaced tag value name in the following format:
`{parentId}/{tagKeyShort}/{tagValueShort}`
Examples: - `42/foo/abc` for a value with short name "abc" under the key with short name "foo" under the organization with ID 42 - `r2-d2/bar/xyz` for a value with short name "xyz" under the key with short name "bar" under the project with ID "r2-d2"
com.google.api.gax.rpc.ApiException - if the remote call failspublic final TagValue getNamespacedTagValue(GetNamespacedTagValueRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
GetNamespacedTagValueRequest request =
GetNamespacedTagValueRequest.newBuilder()
.setName(TagValueName.of("[TAG_VALUE]").toString())
.build();
TagValue response = tagValuesClient.getNamespacedTagValue(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetNamespacedTagValueRequest,TagValue> getNamespacedTagValueCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
GetNamespacedTagValueRequest request =
GetNamespacedTagValueRequest.newBuilder()
.setName(TagValueName.of("[TAG_VALUE]").toString())
.build();
ApiFuture<TagValue> future =
tagValuesClient.getNamespacedTagValueCallable().futureCall(request);
// Do something.
TagValue response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<TagValue,CreateTagValueMetadata> createTagValueAsync(TagValue tagValue)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TagValue tagValue = TagValue.newBuilder().build();
TagValue response = tagValuesClient.createTagValueAsync(tagValue).get();
}
tagValue - Required. The TagValue to be created. Only fields `short_name`, `description`,
and `parent` are considered during the creation request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<TagValue,CreateTagValueMetadata> createTagValueAsync(CreateTagValueRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
CreateTagValueRequest request =
CreateTagValueRequest.newBuilder()
.setTagValue(TagValue.newBuilder().build())
.setValidateOnly(true)
.build();
TagValue response = tagValuesClient.createTagValueAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateTagValueRequest,TagValue,CreateTagValueMetadata> createTagValueOperationCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
CreateTagValueRequest request =
CreateTagValueRequest.newBuilder()
.setTagValue(TagValue.newBuilder().build())
.setValidateOnly(true)
.build();
OperationFuture<TagValue, CreateTagValueMetadata> future =
tagValuesClient.createTagValueOperationCallable().futureCall(request);
// Do something.
TagValue response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateTagValueRequest,com.google.longrunning.Operation> createTagValueCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
CreateTagValueRequest request =
CreateTagValueRequest.newBuilder()
.setTagValue(TagValue.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future = tagValuesClient.createTagValueCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<TagValue,UpdateTagValueMetadata> updateTagValueAsync(TagValue tagValue, com.google.protobuf.FieldMask updateMask)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TagValue tagValue = TagValue.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
TagValue response = tagValuesClient.updateTagValueAsync(tagValue, updateMask).get();
}
tagValue - Required. The new definition of the TagValue. Only fields `description` and
`etag` fields can be updated by this request. If the `etag` field is nonempty, it must
match the `etag` field of the existing ControlGroup. Otherwise, `ABORTED` will be returned.updateMask - Optional. Fields to be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<TagValue,UpdateTagValueMetadata> updateTagValueAsync(UpdateTagValueRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
UpdateTagValueRequest request =
UpdateTagValueRequest.newBuilder()
.setTagValue(TagValue.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
TagValue response = tagValuesClient.updateTagValueAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateTagValueRequest,TagValue,UpdateTagValueMetadata> updateTagValueOperationCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
UpdateTagValueRequest request =
UpdateTagValueRequest.newBuilder()
.setTagValue(TagValue.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
OperationFuture<TagValue, UpdateTagValueMetadata> future =
tagValuesClient.updateTagValueOperationCallable().futureCall(request);
// Do something.
TagValue response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateTagValueRequest,com.google.longrunning.Operation> updateTagValueCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
UpdateTagValueRequest request =
UpdateTagValueRequest.newBuilder()
.setTagValue(TagValue.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future = tagValuesClient.updateTagValueCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<TagValue,DeleteTagValueMetadata> deleteTagValueAsync(TagValueName name)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TagValueName name = TagValueName.of("[TAG_VALUE]");
TagValue response = tagValuesClient.deleteTagValueAsync(name).get();
}
name - Required. Resource name for TagValue to be deleted in the format tagValues/456.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<TagValue,DeleteTagValueMetadata> deleteTagValueAsync(String name)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
String name = TagValueName.of("[TAG_VALUE]").toString();
TagValue response = tagValuesClient.deleteTagValueAsync(name).get();
}
name - Required. Resource name for TagValue to be deleted in the format tagValues/456.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<TagValue,DeleteTagValueMetadata> deleteTagValueAsync(DeleteTagValueRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
DeleteTagValueRequest request =
DeleteTagValueRequest.newBuilder()
.setName(TagValueName.of("[TAG_VALUE]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
TagValue response = tagValuesClient.deleteTagValueAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteTagValueRequest,TagValue,DeleteTagValueMetadata> deleteTagValueOperationCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
DeleteTagValueRequest request =
DeleteTagValueRequest.newBuilder()
.setName(TagValueName.of("[TAG_VALUE]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
OperationFuture<TagValue, DeleteTagValueMetadata> future =
tagValuesClient.deleteTagValueOperationCallable().futureCall(request);
// Do something.
TagValue response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteTagValueRequest,com.google.longrunning.Operation> deleteTagValueCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
DeleteTagValueRequest request =
DeleteTagValueRequest.newBuilder()
.setName(TagValueName.of("[TAG_VALUE]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = tagValuesClient.deleteTagValueCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.api.resourcenames.ResourceName resource)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
ResourceName resource = TagValueName.of("[TAG_VALUE]");
Policy response = tagValuesClient.getIamPolicy(resource);
}
resource - REQUIRED: The resource for which the policy is being requested. See the
operation documentation for the appropriate value for this field.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(String resource)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
String resource = FolderName.of("[FOLDER]").toString();
Policy response = tagValuesClient.getIamPolicy(resource);
}
resource - REQUIRED: The resource for which the policy is being requested. See the
operation documentation for the appropriate value for this field.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(TagValueName.of("[TAG_VALUE]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = tagValuesClient.getIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(TagValueName.of("[TAG_VALUE]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = tagValuesClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.api.resourcenames.ResourceName resource,
com.google.iam.v1.Policy policy)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
ResourceName resource = TagValueName.of("[TAG_VALUE]");
Policy policy = Policy.newBuilder().build();
Policy response = tagValuesClient.setIamPolicy(resource, policy);
}
resource - REQUIRED: The resource for which the policy is being specified. See the
operation documentation for the appropriate value for this field.policy - REQUIRED: The complete policy to be applied to the `resource`. The size of the
policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
Platform services (such as Projects) might reject them.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
String resource = FolderName.of("[FOLDER]").toString();
Policy policy = Policy.newBuilder().build();
Policy response = tagValuesClient.setIamPolicy(resource, policy);
}
resource - REQUIRED: The resource for which the policy is being specified. See the
operation documentation for the appropriate value for this field.policy - REQUIRED: The complete policy to be applied to the `resource`. The size of the
policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
Platform services (such as Projects) might reject them.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(TagValueName.of("[TAG_VALUE]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = tagValuesClient.setIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(TagValueName.of("[TAG_VALUE]").toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future = tagValuesClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.api.resourcenames.ResourceName resource,
List<String> permissions)
There are no permissions required for making this API call.
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
ResourceName resource = TagValueName.of("[TAG_VALUE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response =
tagValuesClient.testIamPermissions(resource, permissions);
}
resource - REQUIRED: The resource for which the policy detail is being requested. See the
operation documentation for the appropriate value for this field.permissions - The set of permissions to check for the `resource`. Permissions with
wildcards (such as '*' or 'storage.*') are not allowed. For more information see
[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)
There are no permissions required for making this API call.
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
String resource = FolderName.of("[FOLDER]").toString();
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response =
tagValuesClient.testIamPermissions(resource, permissions);
}
resource - REQUIRED: The resource for which the policy detail is being requested. See the
operation documentation for the appropriate value for this field.permissions - The set of permissions to check for the `resource`. Permissions with
wildcards (such as '*' or 'storage.*') are not allowed. For more information see
[IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
There are no permissions required for making this API call.
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(TagValueName.of("[TAG_VALUE]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = tagValuesClient.testIamPermissions(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
There are no permissions required for making this API call.
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 (TagValuesClient tagValuesClient = TagValuesClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(TagValueName.of("[TAG_VALUE]").toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
tagValuesClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.