@Generated(value="by gapic-generator-java") public class AutokeyAdminClient 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
AutokeyConfig autokeyConfig = AutokeyConfig.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
AutokeyConfig response = autokeyAdminClient.updateAutokeyConfig(autokeyConfig, updateMask);
}
Note: close() needs to be called on the AutokeyAdminClient 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 |
|---|---|---|
UpdateAutokeyConfig |
Updates the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder. The caller must have both `cloudkms.autokeyConfigs.update` permission on the parent folder and `cloudkms.cryptoKeys.setIamPolicy` permission on the provided key project. A [KeyHandle][google.cloud.kms.v1.KeyHandle] creation in the folder's descendant projects will use this configuration to determine where to create the resulting [CryptoKey][google.cloud.kms.v1.CryptoKey]. |
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.
|
GetAutokeyConfig |
Returns the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder. |
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.
|
ShowEffectiveAutokeyConfig |
Returns the effective Cloud KMS Autokey configuration for a given 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.
|
ListLocations |
Lists information about the supported locations for this service. |
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.
|
GetLocation |
Gets information about a location. |
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 access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
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.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
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 permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
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 AutokeyAdminSettings 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
AutokeyAdminSettings autokeyAdminSettings =
AutokeyAdminSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create(autokeyAdminSettings);
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
AutokeyAdminSettings autokeyAdminSettings =
AutokeyAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create(autokeyAdminSettings);
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
AutokeyAdminSettings autokeyAdminSettings = AutokeyAdminSettings.newHttpJsonBuilder().build();
AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create(autokeyAdminSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
AutokeyAdminClient.ListLocationsFixedSizeCollection |
static class |
AutokeyAdminClient.ListLocationsPage |
static class |
AutokeyAdminClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
AutokeyAdminClient(AutokeyAdminSettings settings)
Constructs an instance of AutokeyAdminClient, using the given settings.
|
protected |
AutokeyAdminClient(AutokeyAdminStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static AutokeyAdminClient |
create()
Constructs an instance of AutokeyAdminClient with default settings.
|
static AutokeyAdminClient |
create(AutokeyAdminSettings settings)
Constructs an instance of AutokeyAdminClient, using the given settings.
|
static AutokeyAdminClient |
create(AutokeyAdminStub stub)
Constructs an instance of AutokeyAdminClient, using the given stub for making calls.
|
AutokeyConfig |
getAutokeyConfig(AutokeyConfigName name)
Returns the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder.
|
AutokeyConfig |
getAutokeyConfig(GetAutokeyConfigRequest request)
Returns the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder.
|
AutokeyConfig |
getAutokeyConfig(String name)
Returns the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder.
|
com.google.api.gax.rpc.UnaryCallable<GetAutokeyConfigRequest,AutokeyConfig> |
getAutokeyConfigCallable()
Returns the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
AutokeyAdminSettings |
getSettings() |
AutokeyAdminStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
AutokeyAdminClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,AutokeyAdminClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
ShowEffectiveAutokeyConfigResponse |
showEffectiveAutokeyConfig(ProjectName parent)
Returns the effective Cloud KMS Autokey configuration for a given project.
|
ShowEffectiveAutokeyConfigResponse |
showEffectiveAutokeyConfig(ShowEffectiveAutokeyConfigRequest request)
Returns the effective Cloud KMS Autokey configuration for a given project.
|
ShowEffectiveAutokeyConfigResponse |
showEffectiveAutokeyConfig(String parent)
Returns the effective Cloud KMS Autokey configuration for a given project.
|
com.google.api.gax.rpc.UnaryCallable<ShowEffectiveAutokeyConfigRequest,ShowEffectiveAutokeyConfigResponse> |
showEffectiveAutokeyConfigCallable()
Returns the effective Cloud KMS Autokey configuration for a given project.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
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 resource.
|
AutokeyConfig |
updateAutokeyConfig(AutokeyConfig autokeyConfig,
com.google.protobuf.FieldMask updateMask)
Updates the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder.
|
AutokeyConfig |
updateAutokeyConfig(UpdateAutokeyConfigRequest request)
Updates the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder.
|
com.google.api.gax.rpc.UnaryCallable<UpdateAutokeyConfigRequest,AutokeyConfig> |
updateAutokeyConfigCallable()
Updates the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a folder.
|
protected AutokeyAdminClient(AutokeyAdminSettings settings) throws IOException
IOExceptionprotected AutokeyAdminClient(AutokeyAdminStub stub)
public static final AutokeyAdminClient create() throws IOException
IOExceptionpublic static final AutokeyAdminClient create(AutokeyAdminSettings settings) throws IOException
IOExceptionpublic static final AutokeyAdminClient create(AutokeyAdminStub stub)
public final AutokeyAdminSettings getSettings()
public AutokeyAdminStub getStub()
public final AutokeyConfig updateAutokeyConfig(AutokeyConfig autokeyConfig, 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
AutokeyConfig autokeyConfig = AutokeyConfig.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
AutokeyConfig response = autokeyAdminClient.updateAutokeyConfig(autokeyConfig, updateMask);
}
autokeyConfig - Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values
to update.updateMask - Required. Masks which fields of the
[AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g. `keyProject`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AutokeyConfig updateAutokeyConfig(UpdateAutokeyConfigRequest 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
UpdateAutokeyConfigRequest request =
UpdateAutokeyConfigRequest.newBuilder()
.setAutokeyConfig(AutokeyConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
AutokeyConfig response = autokeyAdminClient.updateAutokeyConfig(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<UpdateAutokeyConfigRequest,AutokeyConfig> updateAutokeyConfigCallable()
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
UpdateAutokeyConfigRequest request =
UpdateAutokeyConfigRequest.newBuilder()
.setAutokeyConfig(AutokeyConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<AutokeyConfig> future =
autokeyAdminClient.updateAutokeyConfigCallable().futureCall(request);
// Do something.
AutokeyConfig response = future.get();
}
public final AutokeyConfig getAutokeyConfig(AutokeyConfigName 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
AutokeyConfigName name = AutokeyConfigName.of("[FOLDER]");
AutokeyConfig response = autokeyAdminClient.getAutokeyConfig(name);
}
name - Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] resource,
e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AutokeyConfig getAutokeyConfig(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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
String name = AutokeyConfigName.of("[FOLDER]").toString();
AutokeyConfig response = autokeyAdminClient.getAutokeyConfig(name);
}
name - Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] resource,
e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AutokeyConfig getAutokeyConfig(GetAutokeyConfigRequest 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
GetAutokeyConfigRequest request =
GetAutokeyConfigRequest.newBuilder()
.setName(AutokeyConfigName.of("[FOLDER]").toString())
.build();
AutokeyConfig response = autokeyAdminClient.getAutokeyConfig(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<GetAutokeyConfigRequest,AutokeyConfig> getAutokeyConfigCallable()
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
GetAutokeyConfigRequest request =
GetAutokeyConfigRequest.newBuilder()
.setName(AutokeyConfigName.of("[FOLDER]").toString())
.build();
ApiFuture<AutokeyConfig> future =
autokeyAdminClient.getAutokeyConfigCallable().futureCall(request);
// Do something.
AutokeyConfig response = future.get();
}
public final ShowEffectiveAutokeyConfigResponse showEffectiveAutokeyConfig(ProjectName 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ShowEffectiveAutokeyConfigResponse response =
autokeyAdminClient.showEffectiveAutokeyConfig(parent);
}
parent - Required. Name of the resource project to the show effective Cloud KMS Autokey
configuration for. This may be helpful for interrogating the effect of nested folder
configurations on a given resource project.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ShowEffectiveAutokeyConfigResponse showEffectiveAutokeyConfig(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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
ShowEffectiveAutokeyConfigResponse response =
autokeyAdminClient.showEffectiveAutokeyConfig(parent);
}
parent - Required. Name of the resource project to the show effective Cloud KMS Autokey
configuration for. This may be helpful for interrogating the effect of nested folder
configurations on a given resource project.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ShowEffectiveAutokeyConfigResponse showEffectiveAutokeyConfig(ShowEffectiveAutokeyConfigRequest 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
ShowEffectiveAutokeyConfigRequest request =
ShowEffectiveAutokeyConfigRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.build();
ShowEffectiveAutokeyConfigResponse response =
autokeyAdminClient.showEffectiveAutokeyConfig(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<ShowEffectiveAutokeyConfigRequest,ShowEffectiveAutokeyConfigResponse> showEffectiveAutokeyConfigCallable()
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
ShowEffectiveAutokeyConfigRequest request =
ShowEffectiveAutokeyConfigRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.build();
ApiFuture<ShowEffectiveAutokeyConfigResponse> future =
autokeyAdminClient.showEffectiveAutokeyConfigCallable().futureCall(request);
// Do something.
ShowEffectiveAutokeyConfigResponse response = future.get();
}
public final AutokeyAdminClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : autokeyAdminClient.listLocations(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<com.google.cloud.location.ListLocationsRequest,AutokeyAdminClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
autokeyAdminClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = autokeyAdminClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = autokeyAdminClient.getLocation(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.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = autokeyAdminClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = autokeyAdminClient.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()
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future = autokeyAdminClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy 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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = autokeyAdminClient.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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = autokeyAdminClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = autokeyAdminClient.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()
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (AutokeyAdminClient autokeyAdminClient = AutokeyAdminClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
autokeyAdminClient.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.