Class AutokeyAdminClient (2.55.0)

GitHub RepositoryProduct Reference

Service Description: Provides interfaces for managing Cloud KMS Autokey folder-level configurations. A configuration is inherited by all descendent projects. A configuration at one folder overrides any other configurations in its ancestry. Setting a configuration on a folder is a prerequisite for Cloud KMS Autokey, so that users working in a descendant project can request provisioned CryptoKeys, ready for Customer Managed Encryption Key (CMEK) use, on-demand.

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().

Methods
Method Description Method Variants

UpdateAutokeyConfig

Updates the 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 creation in the folder's descendant projects will use this configuration to determine where to create the resulting CryptoKey.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateAutokeyConfig(UpdateAutokeyConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateAutokeyConfig(AutokeyConfig autokeyConfig, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateAutokeyConfigCallable()

GetAutokeyConfig

Returns the AutokeyConfig for a folder.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getAutokeyConfig(GetAutokeyConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getAutokeyConfig(AutokeyConfigName name)

  • getAutokeyConfig(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getAutokeyConfigCallable()

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.

  • showEffectiveAutokeyConfig(ShowEffectiveAutokeyConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • showEffectiveAutokeyConfig(ProjectName parent)

  • showEffectiveAutokeyConfig(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • showEffectiveAutokeyConfigCallable()

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.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

SetIamPolicy

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • setIamPolicy(SetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setIamPolicyCallable()

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.

  • getIamPolicy(GetIamPolicyRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIamPolicyCallable()

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.

  • testIamPermissions(TestIamPermissionsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • testIamPermissionsCallable()

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.

Inheritance

java.lang.Object > AutokeyAdminClient

Static Methods

create()

public static final AutokeyAdminClient create()

Constructs an instance of AutokeyAdminClient with default settings.

Returns
Type Description
AutokeyAdminClient
Exceptions
Type Description
IOException

create(AutokeyAdminSettings settings)

public static final AutokeyAdminClient create(AutokeyAdminSettings settings)

Constructs an instance of AutokeyAdminClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings AutokeyAdminSettings
Returns
Type Description
AutokeyAdminClient
Exceptions
Type Description
IOException

create(AutokeyAdminStub stub)

public static final AutokeyAdminClient create(AutokeyAdminStub stub)

Constructs an instance of AutokeyAdminClient, using the given stub for making calls. This is for advanced usage - prefer using create(AutokeyAdminSettings).

Parameter
Name Description
stub AutokeyAdminStub
Returns
Type Description
AutokeyAdminClient

Constructors

AutokeyAdminClient(AutokeyAdminSettings settings)

protected AutokeyAdminClient(AutokeyAdminSettings settings)

Constructs an instance of AutokeyAdminClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings AutokeyAdminSettings

AutokeyAdminClient(AutokeyAdminStub stub)

protected AutokeyAdminClient(AutokeyAdminStub stub)
Parameter
Name Description
stub AutokeyAdminStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

getAutokeyConfig(AutokeyConfigName name)

public final AutokeyConfig getAutokeyConfig(AutokeyConfigName name)

Returns the AutokeyConfig for a folder.

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);
 }
 
Parameter
Name Description
name AutokeyConfigName

Required. Name of the AutokeyConfig resource, e.g. folders/{FOLDER_NUMBER}/autokeyConfig.

Returns
Type Description
AutokeyConfig

getAutokeyConfig(GetAutokeyConfigRequest request)

public final AutokeyConfig getAutokeyConfig(GetAutokeyConfigRequest request)

Returns the AutokeyConfig for a folder.

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);
 }
 
Parameter
Name Description
request GetAutokeyConfigRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AutokeyConfig

getAutokeyConfig(String name)

public final AutokeyConfig getAutokeyConfig(String name)

Returns the AutokeyConfig for a folder.

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);
 }
 
Parameter
Name Description
name String

Required. Name of the AutokeyConfig resource, e.g. folders/{FOLDER_NUMBER}/autokeyConfig.

Returns
Type Description
AutokeyConfig

getAutokeyConfigCallable()

public final UnaryCallable<GetAutokeyConfigRequest,AutokeyConfig> getAutokeyConfigCallable()

Returns the AutokeyConfig for a folder.

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();
 }
 
Returns
Type Description
UnaryCallable<GetAutokeyConfigRequest,AutokeyConfig>

getIamPolicy(GetIamPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyRequest request)

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

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);
 }
 
Parameter
Name Description
request com.google.iam.v1.GetIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.iam.v1.Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

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();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

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);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

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();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getSettings()

public final AutokeyAdminSettings getSettings()
Returns
Type Description
AutokeyAdminSettings

getStub()

public AutokeyAdminStub getStub()
Returns
Type Description
AutokeyAdminStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listLocations(ListLocationsRequest request)

public final AutokeyAdminClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

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);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AutokeyAdminClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,AutokeyAdminClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

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);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

setIamPolicy(SetIamPolicyRequest request)

public final Policy setIamPolicy(SetIamPolicyRequest request)

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

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);
 }
 
Parameter
Name Description
request com.google.iam.v1.SetIamPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.iam.v1.Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replacesany existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIEDerrors.

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();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>

showEffectiveAutokeyConfig(ProjectName parent)

public final ShowEffectiveAutokeyConfigResponse showEffectiveAutokeyConfig(ProjectName parent)

Returns the effective Cloud KMS Autokey configuration for a given project.

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);
 }
 
Parameter
Name Description
parent ProjectName

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.

Returns
Type Description
ShowEffectiveAutokeyConfigResponse

showEffectiveAutokeyConfig(ShowEffectiveAutokeyConfigRequest request)

public final ShowEffectiveAutokeyConfigResponse showEffectiveAutokeyConfig(ShowEffectiveAutokeyConfigRequest request)

Returns the effective Cloud KMS Autokey configuration for a given project.

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);
 }
 
Parameter
Name Description
request ShowEffectiveAutokeyConfigRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ShowEffectiveAutokeyConfigResponse

showEffectiveAutokeyConfig(String parent)

public final ShowEffectiveAutokeyConfigResponse showEffectiveAutokeyConfig(String parent)

Returns the effective Cloud KMS Autokey configuration for a given project.

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);
 }
 
Parameter
Name Description
parent String

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.

Returns
Type Description
ShowEffectiveAutokeyConfigResponse

showEffectiveAutokeyConfigCallable()

public final UnaryCallable<ShowEffectiveAutokeyConfigRequest,ShowEffectiveAutokeyConfigResponse> showEffectiveAutokeyConfigCallable()

Returns the effective Cloud KMS Autokey configuration for a given project.

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();
 }
 
Returns
Type Description
UnaryCallable<ShowEffectiveAutokeyConfigRequest,ShowEffectiveAutokeyConfigResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsRequest request)

public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request)

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.

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);
 }
 
Parameter
Name Description
request com.google.iam.v1.TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.iam.v1.TestIamPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()

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.

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();
 }
 
Returns
Type Description
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>

updateAutokeyConfig(AutokeyConfig autokeyConfig, FieldMask updateMask)

public final AutokeyConfig updateAutokeyConfig(AutokeyConfig autokeyConfig, FieldMask updateMask)

Updates the 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 creation in the folder's descendant projects will use this configuration to determine where to create the resulting CryptoKey.

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);
 }
 
Parameters
Name Description
autokeyConfig AutokeyConfig

Required. AutokeyConfig with values to update.

updateMask FieldMask

Required. Masks which fields of the AutokeyConfig to update, e.g. keyProject.

Returns
Type Description
AutokeyConfig

updateAutokeyConfig(UpdateAutokeyConfigRequest request)

public final AutokeyConfig updateAutokeyConfig(UpdateAutokeyConfigRequest request)

Updates the 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 creation in the folder's descendant projects will use this configuration to determine where to create the resulting CryptoKey.

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);
 }
 
Parameter
Name Description
request UpdateAutokeyConfigRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AutokeyConfig

updateAutokeyConfigCallable()

public final UnaryCallable<UpdateAutokeyConfigRequest,AutokeyConfig> updateAutokeyConfigCallable()

Updates the 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 creation in the folder's descendant projects will use this configuration to determine where to create the resulting CryptoKey.

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();
 }
 
Returns
Type Description
UnaryCallable<UpdateAutokeyConfigRequest,AutokeyConfig>