@BetaApi @Generated(value="by gapic-generator-java") public class PolicyTagManagerClient 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Taxonomy taxonomy = Taxonomy.newBuilder().build();
Taxonomy response = policyTagManagerClient.createTaxonomy(parent, taxonomy);
}
Note: close() needs to be called on the PolicyTagManagerClient 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 |
|---|---|---|
CreateTaxonomy |
Creates a taxonomy in the specified project. |
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.
|
DeleteTaxonomy |
Deletes a taxonomy. This operation will also delete all policy tags in this taxonomy along with their associated policies. |
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.
|
UpdateTaxonomy |
Updates a taxonomy. |
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.
|
ListTaxonomies |
Lists all taxonomies in a project in a particular location that the caller has permission to view. |
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.
|
GetTaxonomy |
Gets a taxonomy. |
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.
|
CreatePolicyTag |
Creates a policy tag in the specified taxonomy. |
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.
|
DeletePolicyTag |
Deletes a policy tag. Also deletes all of its descendant policy tags. |
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.
|
UpdatePolicyTag |
Updates a policy tag. |
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.
|
ListPolicyTags |
Lists all policy tags in a taxonomy. |
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.
|
GetPolicyTag |
Gets a policy tag. |
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.
|
GetIamPolicy |
Gets the IAM policy for a taxonomy or a policy tag. |
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.
|
SetIamPolicy |
Sets the IAM policy for a taxonomy or a policy tag. |
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.
|
TestIamPermissions |
Returns the permissions that a caller has on the specified taxonomy or policy tag. |
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.
|
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 PolicyTagManagerSettings 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
PolicyTagManagerSettings policyTagManagerSettings =
PolicyTagManagerSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
PolicyTagManagerClient policyTagManagerClient =
PolicyTagManagerClient.create(policyTagManagerSettings);
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
PolicyTagManagerSettings policyTagManagerSettings =
PolicyTagManagerSettings.newBuilder().setEndpoint(myEndpoint).build();
PolicyTagManagerClient policyTagManagerClient =
PolicyTagManagerClient.create(policyTagManagerSettings);
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
PolicyTagManagerSettings policyTagManagerSettings =
PolicyTagManagerSettings.newHttpJsonBuilder().build();
PolicyTagManagerClient policyTagManagerClient =
PolicyTagManagerClient.create(policyTagManagerSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
PolicyTagManagerClient.ListPolicyTagsFixedSizeCollection |
static class |
PolicyTagManagerClient.ListPolicyTagsPage |
static class |
PolicyTagManagerClient.ListPolicyTagsPagedResponse |
static class |
PolicyTagManagerClient.ListTaxonomiesFixedSizeCollection |
static class |
PolicyTagManagerClient.ListTaxonomiesPage |
static class |
PolicyTagManagerClient.ListTaxonomiesPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
PolicyTagManagerClient(PolicyTagManagerSettings settings)
Constructs an instance of PolicyTagManagerClient, using the given settings.
|
protected |
PolicyTagManagerClient(PolicyTagManagerStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static PolicyTagManagerClient |
create()
Constructs an instance of PolicyTagManagerClient with default settings.
|
static PolicyTagManagerClient |
create(PolicyTagManagerSettings settings)
Constructs an instance of PolicyTagManagerClient, using the given settings.
|
static PolicyTagManagerClient |
create(PolicyTagManagerStub stub)
Constructs an instance of PolicyTagManagerClient, using the given stub for making calls.
|
PolicyTag |
createPolicyTag(CreatePolicyTagRequest request)
Creates a policy tag in the specified taxonomy.
|
PolicyTag |
createPolicyTag(String parent,
PolicyTag policyTag)
Creates a policy tag in the specified taxonomy.
|
PolicyTag |
createPolicyTag(TaxonomyName parent,
PolicyTag policyTag)
Creates a policy tag in the specified taxonomy.
|
com.google.api.gax.rpc.UnaryCallable<CreatePolicyTagRequest,PolicyTag> |
createPolicyTagCallable()
Creates a policy tag in the specified taxonomy.
|
Taxonomy |
createTaxonomy(CreateTaxonomyRequest request)
Creates a taxonomy in the specified project.
|
Taxonomy |
createTaxonomy(LocationName parent,
Taxonomy taxonomy)
Creates a taxonomy in the specified project.
|
Taxonomy |
createTaxonomy(String parent,
Taxonomy taxonomy)
Creates a taxonomy in the specified project.
|
com.google.api.gax.rpc.UnaryCallable<CreateTaxonomyRequest,Taxonomy> |
createTaxonomyCallable()
Creates a taxonomy in the specified project.
|
void |
deletePolicyTag(DeletePolicyTagRequest request)
Deletes a policy tag.
|
void |
deletePolicyTag(PolicyTagName name)
Deletes a policy tag.
|
void |
deletePolicyTag(String name)
Deletes a policy tag.
|
com.google.api.gax.rpc.UnaryCallable<DeletePolicyTagRequest,com.google.protobuf.Empty> |
deletePolicyTagCallable()
Deletes a policy tag.
|
void |
deleteTaxonomy(DeleteTaxonomyRequest request)
Deletes a taxonomy.
|
void |
deleteTaxonomy(String name)
Deletes a taxonomy.
|
void |
deleteTaxonomy(TaxonomyName name)
Deletes a taxonomy.
|
com.google.api.gax.rpc.UnaryCallable<DeleteTaxonomyRequest,com.google.protobuf.Empty> |
deleteTaxonomyCallable()
Deletes a taxonomy.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the IAM policy for a taxonomy or a policy tag.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the IAM policy for a taxonomy or a policy tag.
|
PolicyTag |
getPolicyTag(GetPolicyTagRequest request)
Gets a policy tag.
|
PolicyTag |
getPolicyTag(PolicyTagName name)
Gets a policy tag.
|
PolicyTag |
getPolicyTag(String name)
Gets a policy tag.
|
com.google.api.gax.rpc.UnaryCallable<GetPolicyTagRequest,PolicyTag> |
getPolicyTagCallable()
Gets a policy tag.
|
PolicyTagManagerSettings |
getSettings() |
PolicyTagManagerStub |
getStub() |
Taxonomy |
getTaxonomy(GetTaxonomyRequest request)
Gets a taxonomy.
|
Taxonomy |
getTaxonomy(String name)
Gets a taxonomy.
|
Taxonomy |
getTaxonomy(TaxonomyName name)
Gets a taxonomy.
|
com.google.api.gax.rpc.UnaryCallable<GetTaxonomyRequest,Taxonomy> |
getTaxonomyCallable()
Gets a taxonomy.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
PolicyTagManagerClient.ListPolicyTagsPagedResponse |
listPolicyTags(ListPolicyTagsRequest request)
Lists all policy tags in a taxonomy.
|
PolicyTagManagerClient.ListPolicyTagsPagedResponse |
listPolicyTags(String parent)
Lists all policy tags in a taxonomy.
|
PolicyTagManagerClient.ListPolicyTagsPagedResponse |
listPolicyTags(TaxonomyName parent)
Lists all policy tags in a taxonomy.
|
com.google.api.gax.rpc.UnaryCallable<ListPolicyTagsRequest,ListPolicyTagsResponse> |
listPolicyTagsCallable()
Lists all policy tags in a taxonomy.
|
com.google.api.gax.rpc.UnaryCallable<ListPolicyTagsRequest,PolicyTagManagerClient.ListPolicyTagsPagedResponse> |
listPolicyTagsPagedCallable()
Lists all policy tags in a taxonomy.
|
PolicyTagManagerClient.ListTaxonomiesPagedResponse |
listTaxonomies(ListTaxonomiesRequest request)
Lists all taxonomies in a project in a particular location that the caller has permission to
view.
|
PolicyTagManagerClient.ListTaxonomiesPagedResponse |
listTaxonomies(LocationName parent)
Lists all taxonomies in a project in a particular location that the caller has permission to
view.
|
PolicyTagManagerClient.ListTaxonomiesPagedResponse |
listTaxonomies(String parent)
Lists all taxonomies in a project in a particular location that the caller has permission to
view.
|
com.google.api.gax.rpc.UnaryCallable<ListTaxonomiesRequest,ListTaxonomiesResponse> |
listTaxonomiesCallable()
Lists all taxonomies in a project in a particular location that the caller has permission to
view.
|
com.google.api.gax.rpc.UnaryCallable<ListTaxonomiesRequest,PolicyTagManagerClient.ListTaxonomiesPagedResponse> |
listTaxonomiesPagedCallable()
Lists all taxonomies in a project in a particular location that the caller has permission to
view.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the IAM policy for a taxonomy or a policy tag.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the IAM policy for a taxonomy or a policy tag.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns the permissions that a caller has on the specified taxonomy or policy tag.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns the permissions that a caller has on the specified taxonomy or policy tag.
|
PolicyTag |
updatePolicyTag(PolicyTag policyTag)
Updates a policy tag.
|
PolicyTag |
updatePolicyTag(UpdatePolicyTagRequest request)
Updates a policy tag.
|
com.google.api.gax.rpc.UnaryCallable<UpdatePolicyTagRequest,PolicyTag> |
updatePolicyTagCallable()
Updates a policy tag.
|
Taxonomy |
updateTaxonomy(Taxonomy taxonomy)
Updates a taxonomy.
|
Taxonomy |
updateTaxonomy(UpdateTaxonomyRequest request)
Updates a taxonomy.
|
com.google.api.gax.rpc.UnaryCallable<UpdateTaxonomyRequest,Taxonomy> |
updateTaxonomyCallable()
Updates a taxonomy.
|
protected PolicyTagManagerClient(PolicyTagManagerSettings settings) throws IOException
IOExceptionprotected PolicyTagManagerClient(PolicyTagManagerStub stub)
public static final PolicyTagManagerClient create() throws IOException
IOExceptionpublic static final PolicyTagManagerClient create(PolicyTagManagerSettings settings) throws IOException
IOExceptionpublic static final PolicyTagManagerClient create(PolicyTagManagerStub stub)
public final PolicyTagManagerSettings getSettings()
public PolicyTagManagerStub getStub()
public final Taxonomy createTaxonomy(LocationName parent, Taxonomy taxonomy)
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Taxonomy taxonomy = Taxonomy.newBuilder().build();
Taxonomy response = policyTagManagerClient.createTaxonomy(parent, taxonomy);
}
parent - Required. Resource name of the project that the taxonomy will belong to.taxonomy - The taxonomy to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Taxonomy createTaxonomy(String parent, Taxonomy taxonomy)
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
Taxonomy taxonomy = Taxonomy.newBuilder().build();
Taxonomy response = policyTagManagerClient.createTaxonomy(parent, taxonomy);
}
parent - Required. Resource name of the project that the taxonomy will belong to.taxonomy - The taxonomy to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Taxonomy createTaxonomy(CreateTaxonomyRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
CreateTaxonomyRequest request =
CreateTaxonomyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setTaxonomy(Taxonomy.newBuilder().build())
.build();
Taxonomy response = policyTagManagerClient.createTaxonomy(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<CreateTaxonomyRequest,Taxonomy> createTaxonomyCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
CreateTaxonomyRequest request =
CreateTaxonomyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setTaxonomy(Taxonomy.newBuilder().build())
.build();
ApiFuture<Taxonomy> future =
policyTagManagerClient.createTaxonomyCallable().futureCall(request);
// Do something.
Taxonomy response = future.get();
}
public final void deleteTaxonomy(TaxonomyName 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
TaxonomyName name = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]");
policyTagManagerClient.deleteTaxonomy(name);
}
name - Required. Resource name of the taxonomy to be deleted. All policy tags in this
taxonomy will also be deleted.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTaxonomy(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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String name = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString();
policyTagManagerClient.deleteTaxonomy(name);
}
name - Required. Resource name of the taxonomy to be deleted. All policy tags in this
taxonomy will also be deleted.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTaxonomy(DeleteTaxonomyRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
DeleteTaxonomyRequest request =
DeleteTaxonomyRequest.newBuilder()
.setName(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.build();
policyTagManagerClient.deleteTaxonomy(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<DeleteTaxonomyRequest,com.google.protobuf.Empty> deleteTaxonomyCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
DeleteTaxonomyRequest request =
DeleteTaxonomyRequest.newBuilder()
.setName(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.build();
ApiFuture<Empty> future = policyTagManagerClient.deleteTaxonomyCallable().futureCall(request);
// Do something.
future.get();
}
public final Taxonomy updateTaxonomy(Taxonomy taxonomy)
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
Taxonomy taxonomy = Taxonomy.newBuilder().build();
Taxonomy response = policyTagManagerClient.updateTaxonomy(taxonomy);
}
taxonomy - The taxonomy to update. Only description, display_name, and activated policy
types can be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Taxonomy updateTaxonomy(UpdateTaxonomyRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
UpdateTaxonomyRequest request =
UpdateTaxonomyRequest.newBuilder()
.setTaxonomy(Taxonomy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Taxonomy response = policyTagManagerClient.updateTaxonomy(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<UpdateTaxonomyRequest,Taxonomy> updateTaxonomyCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
UpdateTaxonomyRequest request =
UpdateTaxonomyRequest.newBuilder()
.setTaxonomy(Taxonomy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Taxonomy> future =
policyTagManagerClient.updateTaxonomyCallable().futureCall(request);
// Do something.
Taxonomy response = future.get();
}
public final PolicyTagManagerClient.ListTaxonomiesPagedResponse listTaxonomies(LocationName 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Taxonomy element : policyTagManagerClient.listTaxonomies(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the project to list the taxonomies of.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTagManagerClient.ListTaxonomiesPagedResponse listTaxonomies(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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Taxonomy element : policyTagManagerClient.listTaxonomies(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the project to list the taxonomies of.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTagManagerClient.ListTaxonomiesPagedResponse listTaxonomies(ListTaxonomiesRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
ListTaxonomiesRequest request =
ListTaxonomiesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Taxonomy element : policyTagManagerClient.listTaxonomies(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<ListTaxonomiesRequest,PolicyTagManagerClient.ListTaxonomiesPagedResponse> listTaxonomiesPagedCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
ListTaxonomiesRequest request =
ListTaxonomiesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Taxonomy> future =
policyTagManagerClient.listTaxonomiesPagedCallable().futureCall(request);
// Do something.
for (Taxonomy element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListTaxonomiesRequest,ListTaxonomiesResponse> listTaxonomiesCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
ListTaxonomiesRequest request =
ListTaxonomiesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListTaxonomiesResponse response =
policyTagManagerClient.listTaxonomiesCallable().call(request);
for (Taxonomy element : response.getTaxonomiesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Taxonomy getTaxonomy(TaxonomyName 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
TaxonomyName name = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]");
Taxonomy response = policyTagManagerClient.getTaxonomy(name);
}
name - Required. Resource name of the requested taxonomy.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Taxonomy getTaxonomy(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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String name = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString();
Taxonomy response = policyTagManagerClient.getTaxonomy(name);
}
name - Required. Resource name of the requested taxonomy.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Taxonomy getTaxonomy(GetTaxonomyRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
GetTaxonomyRequest request =
GetTaxonomyRequest.newBuilder()
.setName(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.build();
Taxonomy response = policyTagManagerClient.getTaxonomy(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<GetTaxonomyRequest,Taxonomy> getTaxonomyCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
GetTaxonomyRequest request =
GetTaxonomyRequest.newBuilder()
.setName(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.build();
ApiFuture<Taxonomy> future = policyTagManagerClient.getTaxonomyCallable().futureCall(request);
// Do something.
Taxonomy response = future.get();
}
public final PolicyTag createPolicyTag(TaxonomyName parent, PolicyTag policyTag)
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
TaxonomyName parent = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]");
PolicyTag policyTag = PolicyTag.newBuilder().build();
PolicyTag response = policyTagManagerClient.createPolicyTag(parent, policyTag);
}
parent - Required. Resource name of the taxonomy that the policy tag will belong to.policyTag - The policy tag to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTag createPolicyTag(String parent, PolicyTag policyTag)
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String parent = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString();
PolicyTag policyTag = PolicyTag.newBuilder().build();
PolicyTag response = policyTagManagerClient.createPolicyTag(parent, policyTag);
}
parent - Required. Resource name of the taxonomy that the policy tag will belong to.policyTag - The policy tag to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTag createPolicyTag(CreatePolicyTagRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
CreatePolicyTagRequest request =
CreatePolicyTagRequest.newBuilder()
.setParent(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.setPolicyTag(PolicyTag.newBuilder().build())
.build();
PolicyTag response = policyTagManagerClient.createPolicyTag(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<CreatePolicyTagRequest,PolicyTag> createPolicyTagCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
CreatePolicyTagRequest request =
CreatePolicyTagRequest.newBuilder()
.setParent(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.setPolicyTag(PolicyTag.newBuilder().build())
.build();
ApiFuture<PolicyTag> future =
policyTagManagerClient.createPolicyTagCallable().futureCall(request);
// Do something.
PolicyTag response = future.get();
}
public final void deletePolicyTag(PolicyTagName 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
PolicyTagName name =
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]");
policyTagManagerClient.deletePolicyTag(name);
}
name - Required. Resource name of the policy tag to be deleted. All of its descendant
policy tags will also be deleted.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deletePolicyTag(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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String name =
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]").toString();
policyTagManagerClient.deletePolicyTag(name);
}
name - Required. Resource name of the policy tag to be deleted. All of its descendant
policy tags will also be deleted.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deletePolicyTag(DeletePolicyTagRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
DeletePolicyTagRequest request =
DeletePolicyTagRequest.newBuilder()
.setName(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.build();
policyTagManagerClient.deletePolicyTag(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<DeletePolicyTagRequest,com.google.protobuf.Empty> deletePolicyTagCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
DeletePolicyTagRequest request =
DeletePolicyTagRequest.newBuilder()
.setName(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.build();
ApiFuture<Empty> future =
policyTagManagerClient.deletePolicyTagCallable().futureCall(request);
// Do something.
future.get();
}
public final PolicyTag updatePolicyTag(PolicyTag policyTag)
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
PolicyTag policyTag = PolicyTag.newBuilder().build();
PolicyTag response = policyTagManagerClient.updatePolicyTag(policyTag);
}
policyTag - The policy tag to update. Only the description, display_name, and
parent_policy_tag fields can be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTag updatePolicyTag(UpdatePolicyTagRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
UpdatePolicyTagRequest request =
UpdatePolicyTagRequest.newBuilder()
.setPolicyTag(PolicyTag.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
PolicyTag response = policyTagManagerClient.updatePolicyTag(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<UpdatePolicyTagRequest,PolicyTag> updatePolicyTagCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
UpdatePolicyTagRequest request =
UpdatePolicyTagRequest.newBuilder()
.setPolicyTag(PolicyTag.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<PolicyTag> future =
policyTagManagerClient.updatePolicyTagCallable().futureCall(request);
// Do something.
PolicyTag response = future.get();
}
public final PolicyTagManagerClient.ListPolicyTagsPagedResponse listPolicyTags(TaxonomyName 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
TaxonomyName parent = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]");
for (PolicyTag element : policyTagManagerClient.listPolicyTags(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the taxonomy to list the policy tags of.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTagManagerClient.ListPolicyTagsPagedResponse listPolicyTags(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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String parent = TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString();
for (PolicyTag element : policyTagManagerClient.listPolicyTags(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the taxonomy to list the policy tags of.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTagManagerClient.ListPolicyTagsPagedResponse listPolicyTags(ListPolicyTagsRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
ListPolicyTagsRequest request =
ListPolicyTagsRequest.newBuilder()
.setParent(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (PolicyTag element : policyTagManagerClient.listPolicyTags(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<ListPolicyTagsRequest,PolicyTagManagerClient.ListPolicyTagsPagedResponse> listPolicyTagsPagedCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
ListPolicyTagsRequest request =
ListPolicyTagsRequest.newBuilder()
.setParent(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<PolicyTag> future =
policyTagManagerClient.listPolicyTagsPagedCallable().futureCall(request);
// Do something.
for (PolicyTag element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPolicyTagsRequest,ListPolicyTagsResponse> listPolicyTagsCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
ListPolicyTagsRequest request =
ListPolicyTagsRequest.newBuilder()
.setParent(TaxonomyName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListPolicyTagsResponse response =
policyTagManagerClient.listPolicyTagsCallable().call(request);
for (PolicyTag element : response.getPolicyTagsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final PolicyTag getPolicyTag(PolicyTagName 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
PolicyTagName name =
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]");
PolicyTag response = policyTagManagerClient.getPolicyTag(name);
}
name - Required. Resource name of the requested policy tag.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTag getPolicyTag(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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
String name =
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]").toString();
PolicyTag response = policyTagManagerClient.getPolicyTag(name);
}
name - Required. Resource name of the requested policy tag.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PolicyTag getPolicyTag(GetPolicyTagRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
GetPolicyTagRequest request =
GetPolicyTagRequest.newBuilder()
.setName(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.build();
PolicyTag response = policyTagManagerClient.getPolicyTag(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<GetPolicyTagRequest,PolicyTag> getPolicyTagCallable()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
GetPolicyTagRequest request =
GetPolicyTagRequest.newBuilder()
.setName(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.build();
ApiFuture<PolicyTag> future =
policyTagManagerClient.getPolicyTagCallable().futureCall(request);
// Do something.
PolicyTag response = future.get();
}
public 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = policyTagManagerClient.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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = policyTagManagerClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = policyTagManagerClient.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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future = policyTagManagerClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest 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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = policyTagManagerClient.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()
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 (PolicyTagManagerClient policyTagManagerClient = PolicyTagManagerClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
PolicyTagName.of("[PROJECT]", "[LOCATION]", "[TAXONOMY]", "[POLICY_TAG]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
policyTagManagerClient.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.