- 1.56.0 (latest)
- 1.55.0
- 1.54.0
- 1.53.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.26.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.6
- 1.4.0
- 1.3.2
- 1.2.12
GitHub Repository | Product Reference |
Service Description: Allow users to create and manage TagHolds for TagValues. TagHolds represent the use of a Tag Value that is not captured by TagBindings but should still block TagValue deletion (such as a reference in a policy condition). This service provides isolated failure domains by cloud location so that TagHolds can be managed in the same location as their usage.
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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
TagValueName parent = TagValueName.of("[TAG_VALUE]");
TagHold tagHold = TagHold.newBuilder().build();
TagHold response = tagHoldsClient.createTagHoldAsync(parent, tagHold).get();
}
Note: close() needs to be called on the TagHoldsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 TagHoldsSettings 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
TagHoldsSettings tagHoldsSettings =
TagHoldsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TagHoldsClient tagHoldsClient = TagHoldsClient.create(tagHoldsSettings);
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
TagHoldsSettings tagHoldsSettings =
TagHoldsSettings.newBuilder().setEndpoint(myEndpoint).build();
TagHoldsClient tagHoldsClient = TagHoldsClient.create(tagHoldsSettings);
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
TagHoldsSettings tagHoldsSettings = TagHoldsSettings.newHttpJsonBuilder().build();
TagHoldsClient tagHoldsClient = TagHoldsClient.create(tagHoldsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final TagHoldsClient create()
Constructs an instance of TagHoldsClient with default settings.
Returns | |
---|---|
Type | Description |
TagHoldsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(TagHoldsSettings settings)
public static final TagHoldsClient create(TagHoldsSettings settings)
Constructs an instance of TagHoldsClient, 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 | TagHoldsSettings |
Returns | |
---|---|
Type | Description |
TagHoldsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(TagHoldsStub stub)
public static final TagHoldsClient create(TagHoldsStub stub)
Constructs an instance of TagHoldsClient, using the given stub for making calls. This is for advanced usage - prefer using create(TagHoldsSettings).
Parameter | |
---|---|
Name | Description |
stub | TagHoldsStub |
Returns | |
---|---|
Type | Description |
TagHoldsClient |
Constructors
TagHoldsClient(TagHoldsSettings settings)
protected TagHoldsClient(TagHoldsSettings settings)
Constructs an instance of TagHoldsClient, 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 | TagHoldsSettings |
TagHoldsClient(TagHoldsStub stub)
protected TagHoldsClient(TagHoldsStub stub)
Parameter | |
---|---|
Name | Description |
stub | TagHoldsStub |
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 |
close()
public final void close()
createTagHoldAsync(CreateTagHoldRequest request)
public final OperationFuture<TagHold,CreateTagHoldMetadata> createTagHoldAsync(CreateTagHoldRequest request)
Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
CreateTagHoldRequest request =
CreateTagHoldRequest.newBuilder()
.setParent(TagValueName.of("[TAG_VALUE]").toString())
.setTagHold(TagHold.newBuilder().build())
.setValidateOnly(true)
.build();
TagHold response = tagHoldsClient.createTagHoldAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | CreateTagHoldRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<TagHold,CreateTagHoldMetadata> |
createTagHoldAsync(TagValueName parent, TagHold tagHold)
public final OperationFuture<TagHold,CreateTagHoldMetadata> createTagHoldAsync(TagValueName parent, TagHold tagHold)
Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
TagValueName parent = TagValueName.of("[TAG_VALUE]");
TagHold tagHold = TagHold.newBuilder().build();
TagHold response = tagHoldsClient.createTagHoldAsync(parent, tagHold).get();
}
Parameters | |
---|---|
Name | Description |
parent | TagValueName Required. The resource name of the TagHold's parent TagValue. Must be of the
form: |
tagHold | TagHold Required. The TagHold to be created. |
Returns | |
---|---|
Type | Description |
OperationFuture<TagHold,CreateTagHoldMetadata> |
createTagHoldAsync(String parent, TagHold tagHold)
public final OperationFuture<TagHold,CreateTagHoldMetadata> createTagHoldAsync(String parent, TagHold tagHold)
Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
String parent = TagValueName.of("[TAG_VALUE]").toString();
TagHold tagHold = TagHold.newBuilder().build();
TagHold response = tagHoldsClient.createTagHoldAsync(parent, tagHold).get();
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The resource name of the TagHold's parent TagValue. Must be of the
form: |
tagHold | TagHold Required. The TagHold to be created. |
Returns | |
---|---|
Type | Description |
OperationFuture<TagHold,CreateTagHoldMetadata> |
createTagHoldCallable()
public final UnaryCallable<CreateTagHoldRequest,Operation> createTagHoldCallable()
Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
CreateTagHoldRequest request =
CreateTagHoldRequest.newBuilder()
.setParent(TagValueName.of("[TAG_VALUE]").toString())
.setTagHold(TagHold.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future = tagHoldsClient.createTagHoldCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateTagHoldRequest,Operation> |
createTagHoldOperationCallable()
public final OperationCallable<CreateTagHoldRequest,TagHold,CreateTagHoldMetadata> createTagHoldOperationCallable()
Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
CreateTagHoldRequest request =
CreateTagHoldRequest.newBuilder()
.setParent(TagValueName.of("[TAG_VALUE]").toString())
.setTagHold(TagHold.newBuilder().build())
.setValidateOnly(true)
.build();
OperationFuture<TagHold, CreateTagHoldMetadata> future =
tagHoldsClient.createTagHoldOperationCallable().futureCall(request);
// Do something.
TagHold response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateTagHoldRequest,TagHold,CreateTagHoldMetadata> |
deleteTagHoldAsync(DeleteTagHoldRequest request)
public final OperationFuture<Empty,DeleteTagHoldMetadata> deleteTagHoldAsync(DeleteTagHoldRequest request)
Deletes a TagHold.
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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
DeleteTagHoldRequest request =
DeleteTagHoldRequest.newBuilder()
.setName(TagHoldName.of("[TAG_VALUE]", "[TAG_HOLD]").toString())
.setValidateOnly(true)
.build();
tagHoldsClient.deleteTagHoldAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | DeleteTagHoldRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,DeleteTagHoldMetadata> |
deleteTagHoldAsync(TagHoldName name)
public final OperationFuture<Empty,DeleteTagHoldMetadata> deleteTagHoldAsync(TagHoldName name)
Deletes a TagHold.
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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
TagHoldName name = TagHoldName.of("[TAG_VALUE]", "[TAG_HOLD]");
tagHoldsClient.deleteTagHoldAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | TagHoldName Required. The resource name of the TagHold to delete. Must be of the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,DeleteTagHoldMetadata> |
deleteTagHoldAsync(String name)
public final OperationFuture<Empty,DeleteTagHoldMetadata> deleteTagHoldAsync(String name)
Deletes a TagHold.
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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
String name = TagHoldName.of("[TAG_VALUE]", "[TAG_HOLD]").toString();
tagHoldsClient.deleteTagHoldAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | String Required. The resource name of the TagHold to delete. Must be of the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,DeleteTagHoldMetadata> |
deleteTagHoldCallable()
public final UnaryCallable<DeleteTagHoldRequest,Operation> deleteTagHoldCallable()
Deletes a TagHold.
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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
DeleteTagHoldRequest request =
DeleteTagHoldRequest.newBuilder()
.setName(TagHoldName.of("[TAG_VALUE]", "[TAG_HOLD]").toString())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future = tagHoldsClient.deleteTagHoldCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteTagHoldRequest,Operation> |
deleteTagHoldOperationCallable()
public final OperationCallable<DeleteTagHoldRequest,Empty,DeleteTagHoldMetadata> deleteTagHoldOperationCallable()
Deletes a TagHold.
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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
DeleteTagHoldRequest request =
DeleteTagHoldRequest.newBuilder()
.setName(TagHoldName.of("[TAG_VALUE]", "[TAG_HOLD]").toString())
.setValidateOnly(true)
.build();
OperationFuture<Empty, DeleteTagHoldMetadata> future =
tagHoldsClient.deleteTagHoldOperationCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<DeleteTagHoldRequest,Empty,DeleteTagHoldMetadata> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final TagHoldsSettings getSettings()
Returns | |
---|---|
Type | Description |
TagHoldsSettings |
getStub()
public TagHoldsStub getStub()
Returns | |
---|---|
Type | Description |
TagHoldsStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listTagHolds(ListTagHoldsRequest request)
public final TagHoldsClient.ListTagHoldsPagedResponse listTagHolds(ListTagHoldsRequest request)
Lists TagHolds under a 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
ListTagHoldsRequest request =
ListTagHoldsRequest.newBuilder()
.setParent(TagValueName.of("[TAG_VALUE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (TagHold element : tagHoldsClient.listTagHolds(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListTagHoldsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
TagHoldsClient.ListTagHoldsPagedResponse |
listTagHolds(TagValueName parent)
public final TagHoldsClient.ListTagHoldsPagedResponse listTagHolds(TagValueName parent)
Lists TagHolds under a 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
TagValueName parent = TagValueName.of("[TAG_VALUE]");
for (TagHold element : tagHoldsClient.listTagHolds(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | TagValueName Required. The resource name of the parent TagValue. Must be of the form:
|
Returns | |
---|---|
Type | Description |
TagHoldsClient.ListTagHoldsPagedResponse |
listTagHolds(String parent)
public final TagHoldsClient.ListTagHoldsPagedResponse listTagHolds(String parent)
Lists TagHolds under a 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
String parent = TagValueName.of("[TAG_VALUE]").toString();
for (TagHold element : tagHoldsClient.listTagHolds(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The resource name of the parent TagValue. Must be of the form:
|
Returns | |
---|---|
Type | Description |
TagHoldsClient.ListTagHoldsPagedResponse |
listTagHoldsCallable()
public final UnaryCallable<ListTagHoldsRequest,ListTagHoldsResponse> listTagHoldsCallable()
Lists TagHolds under a 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
ListTagHoldsRequest request =
ListTagHoldsRequest.newBuilder()
.setParent(TagValueName.of("[TAG_VALUE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListTagHoldsResponse response = tagHoldsClient.listTagHoldsCallable().call(request);
for (TagHold element : response.getTagHoldsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListTagHoldsRequest,ListTagHoldsResponse> |
listTagHoldsPagedCallable()
public final UnaryCallable<ListTagHoldsRequest,TagHoldsClient.ListTagHoldsPagedResponse> listTagHoldsPagedCallable()
Lists TagHolds under a 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 (TagHoldsClient tagHoldsClient = TagHoldsClient.create()) {
ListTagHoldsRequest request =
ListTagHoldsRequest.newBuilder()
.setParent(TagValueName.of("[TAG_VALUE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<TagHold> future = tagHoldsClient.listTagHoldsPagedCallable().futureCall(request);
// Do something.
for (TagHold element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListTagHoldsRequest,ListTagHoldsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()