Class EkmServiceClient (2.6.6)

public class EkmServiceClient implements BackgroundResource

Service Description: Google Cloud Key Management EKM Service

Manages external cryptographic keys and operations using those keys. Implements a REST model with the following objects:

  • EkmConnection

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   EkmConnectionName name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]");
   EkmConnection response = ekmServiceClient.getEkmConnection(name);
 }
 

Note: close() needs to be called on the EkmServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of EkmServiceSettings 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
 EkmServiceSettings ekmServiceSettings =
     EkmServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 EkmServiceClient ekmServiceClient = EkmServiceClient.create(ekmServiceSettings);
 

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
 EkmServiceSettings ekmServiceSettings =
     EkmServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 EkmServiceClient ekmServiceClient = EkmServiceClient.create(ekmServiceSettings);
 

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
 EkmServiceSettings ekmServiceSettings =
     EkmServiceSettings.newBuilder()
         .setTransportChannelProvider(
             EkmServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 EkmServiceClient ekmServiceClient = EkmServiceClient.create(ekmServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > EkmServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final EkmServiceClient create()

Constructs an instance of EkmServiceClient with default settings.

Returns
TypeDescription
EkmServiceClient
Exceptions
TypeDescription
IOException

create(EkmServiceSettings settings)

public static final EkmServiceClient create(EkmServiceSettings settings)

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

Parameter
NameDescription
settingsEkmServiceSettings
Returns
TypeDescription
EkmServiceClient
Exceptions
TypeDescription
IOException

create(EkmServiceStub stub)

public static final EkmServiceClient create(EkmServiceStub stub)

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

Parameter
NameDescription
stubEkmServiceStub
Returns
TypeDescription
EkmServiceClient

Constructors

EkmServiceClient(EkmServiceSettings settings)

protected EkmServiceClient(EkmServiceSettings settings)

Constructs an instance of EkmServiceClient, 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
NameDescription
settingsEkmServiceSettings

EkmServiceClient(EkmServiceStub stub)

protected EkmServiceClient(EkmServiceStub stub)
Parameter
NameDescription
stubEkmServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createEkmConnection(CreateEkmConnectionRequest request)

public final EkmConnection createEkmConnection(CreateEkmConnectionRequest request)

Creates a new EkmConnection in a given Project and 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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   CreateEkmConnectionRequest request =
       CreateEkmConnectionRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setEkmConnectionId("ekmConnectionId-445017408")
           .setEkmConnection(EkmConnection.newBuilder().build())
           .build();
   EkmConnection response = ekmServiceClient.createEkmConnection(request);
 }
 
Parameter
NameDescription
requestCreateEkmConnectionRequest

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

Returns
TypeDescription
EkmConnection

createEkmConnection(LocationName parent, String ekmConnectionId, EkmConnection ekmConnection)

public final EkmConnection createEkmConnection(LocationName parent, String ekmConnectionId, EkmConnection ekmConnection)

Creates a new EkmConnection in a given Project and 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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   String ekmConnectionId = "ekmConnectionId-445017408";
   EkmConnection ekmConnection = EkmConnection.newBuilder().build();
   EkmConnection response =
       ekmServiceClient.createEkmConnection(parent, ekmConnectionId, ekmConnection);
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the location associated with the EkmConnection, in the format projects/*/locations/*.

ekmConnectionIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}.

ekmConnectionEkmConnection

Required. An EkmConnection with initial field values.

Returns
TypeDescription
EkmConnection

createEkmConnection(String parent, String ekmConnectionId, EkmConnection ekmConnection)

public final EkmConnection createEkmConnection(String parent, String ekmConnectionId, EkmConnection ekmConnection)

Creates a new EkmConnection in a given Project and 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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   String ekmConnectionId = "ekmConnectionId-445017408";
   EkmConnection ekmConnection = EkmConnection.newBuilder().build();
   EkmConnection response =
       ekmServiceClient.createEkmConnection(parent, ekmConnectionId, ekmConnection);
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the location associated with the EkmConnection, in the format projects/*/locations/*.

ekmConnectionIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}.

ekmConnectionEkmConnection

Required. An EkmConnection with initial field values.

Returns
TypeDescription
EkmConnection

createEkmConnectionCallable()

public final UnaryCallable<CreateEkmConnectionRequest,EkmConnection> createEkmConnectionCallable()

Creates a new EkmConnection in a given Project and 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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   CreateEkmConnectionRequest request =
       CreateEkmConnectionRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setEkmConnectionId("ekmConnectionId-445017408")
           .setEkmConnection(EkmConnection.newBuilder().build())
           .build();
   ApiFuture<EkmConnection> future =
       ekmServiceClient.createEkmConnectionCallable().futureCall(request);
   // Do something.
   EkmConnection response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateEkmConnectionRequest,EkmConnection>

getEkmConnection(EkmConnectionName name)

public final EkmConnection getEkmConnection(EkmConnectionName name)

Returns metadata for a given EkmConnection.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   EkmConnectionName name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]");
   EkmConnection response = ekmServiceClient.getEkmConnection(name);
 }
 
Parameter
NameDescription
nameEkmConnectionName

Required. The name of the EkmConnection to get.

Returns
TypeDescription
EkmConnection

getEkmConnection(GetEkmConnectionRequest request)

public final EkmConnection getEkmConnection(GetEkmConnectionRequest request)

Returns metadata for a given EkmConnection.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   GetEkmConnectionRequest request =
       GetEkmConnectionRequest.newBuilder()
           .setName(
               EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString())
           .build();
   EkmConnection response = ekmServiceClient.getEkmConnection(request);
 }
 
Parameter
NameDescription
requestGetEkmConnectionRequest

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

Returns
TypeDescription
EkmConnection

getEkmConnection(String name)

public final EkmConnection getEkmConnection(String name)

Returns metadata for a given EkmConnection.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   String name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString();
   EkmConnection response = ekmServiceClient.getEkmConnection(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the EkmConnection to get.

Returns
TypeDescription
EkmConnection

getEkmConnectionCallable()

public final UnaryCallable<GetEkmConnectionRequest,EkmConnection> getEkmConnectionCallable()

Returns metadata for a given EkmConnection.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   GetEkmConnectionRequest request =
       GetEkmConnectionRequest.newBuilder()
           .setName(
               EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString())
           .build();
   ApiFuture<EkmConnection> future =
       ekmServiceClient.getEkmConnectionCallable().futureCall(request);
   // Do something.
   EkmConnection response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetEkmConnectionRequest,EkmConnection>

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(
               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
                   .toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   Policy response = ekmServiceClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.GetIamPolicyRequest

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

Returns
TypeDescription
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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   GetIamPolicyRequest request =
       GetIamPolicyRequest.newBuilder()
           .setResource(
               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
                   .toString())
           .setOptions(GetPolicyOptions.newBuilder().build())
           .build();
   ApiFuture<Policy> future = ekmServiceClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>

getSettings()

public final EkmServiceSettings getSettings()
Returns
TypeDescription
EkmServiceSettings

getStub()

public EkmServiceStub getStub()
Returns
TypeDescription
EkmServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listEkmConnections(ListEkmConnectionsRequest request)

public final EkmServiceClient.ListEkmConnectionsPagedResponse listEkmConnections(ListEkmConnectionsRequest request)

Lists EkmConnections.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   ListEkmConnectionsRequest request =
       ListEkmConnectionsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   for (EkmConnection element : ekmServiceClient.listEkmConnections(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListEkmConnectionsRequest

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

Returns
TypeDescription
EkmServiceClient.ListEkmConnectionsPagedResponse

listEkmConnections(LocationName parent)

public final EkmServiceClient.ListEkmConnectionsPagedResponse listEkmConnections(LocationName parent)

Lists EkmConnections.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (EkmConnection element : ekmServiceClient.listEkmConnections(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The resource name of the location associated with the EkmConnections to list, in the format projects/*/locations/*.

Returns
TypeDescription
EkmServiceClient.ListEkmConnectionsPagedResponse

listEkmConnections(String parent)

public final EkmServiceClient.ListEkmConnectionsPagedResponse listEkmConnections(String parent)

Lists EkmConnections.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (EkmConnection element : ekmServiceClient.listEkmConnections(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the location associated with the EkmConnections to list, in the format projects/*/locations/*.

Returns
TypeDescription
EkmServiceClient.ListEkmConnectionsPagedResponse

listEkmConnectionsCallable()

public final UnaryCallable<ListEkmConnectionsRequest,ListEkmConnectionsResponse> listEkmConnectionsCallable()

Lists EkmConnections.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   ListEkmConnectionsRequest request =
       ListEkmConnectionsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListEkmConnectionsResponse response =
         ekmServiceClient.listEkmConnectionsCallable().call(request);
     for (EkmConnection element : response.getEkmConnectionsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEkmConnectionsRequest,ListEkmConnectionsResponse>

listEkmConnectionsPagedCallable()

public final UnaryCallable<ListEkmConnectionsRequest,EkmServiceClient.ListEkmConnectionsPagedResponse> listEkmConnectionsPagedCallable()

Lists EkmConnections.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   ListEkmConnectionsRequest request =
       ListEkmConnectionsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .build();
   ApiFuture<EkmConnection> future =
       ekmServiceClient.listEkmConnectionsPagedCallable().futureCall(request);
   // Do something.
   for (EkmConnection element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEkmConnectionsRequest,ListEkmConnectionsPagedResponse>

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.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 = ekmServiceClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.SetIamPolicyRequest

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

Returns
TypeDescription
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 (EkmServiceClient ekmServiceClient = EkmServiceClient.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 = ekmServiceClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(
               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
                   .toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   TestIamPermissionsResponse response = ekmServiceClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestcom.google.iam.v1.TestIamPermissionsRequest

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

Returns
TypeDescription
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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   TestIamPermissionsRequest request =
       TestIamPermissionsRequest.newBuilder()
           .setResource(
               CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
                   .toString())
           .addAllPermissions(new ArrayList<String>())
           .build();
   ApiFuture<TestIamPermissionsResponse> future =
       ekmServiceClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestIamPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>

updateEkmConnection(EkmConnection ekmConnection, FieldMask updateMask)

public final EkmConnection updateEkmConnection(EkmConnection ekmConnection, FieldMask updateMask)

Updates an EkmConnection's metadata.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   EkmConnection ekmConnection = EkmConnection.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   EkmConnection response = ekmServiceClient.updateEkmConnection(ekmConnection, updateMask);
 }
 
Parameters
NameDescription
ekmConnectionEkmConnection

Required. EkmConnection with updated values.

updateMaskFieldMask

Required. List of fields to be updated in this request.

Returns
TypeDescription
EkmConnection

updateEkmConnection(UpdateEkmConnectionRequest request)

public final EkmConnection updateEkmConnection(UpdateEkmConnectionRequest request)

Updates an EkmConnection's metadata.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   UpdateEkmConnectionRequest request =
       UpdateEkmConnectionRequest.newBuilder()
           .setEkmConnection(EkmConnection.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   EkmConnection response = ekmServiceClient.updateEkmConnection(request);
 }
 
Parameter
NameDescription
requestUpdateEkmConnectionRequest

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

Returns
TypeDescription
EkmConnection

updateEkmConnectionCallable()

public final UnaryCallable<UpdateEkmConnectionRequest,EkmConnection> updateEkmConnectionCallable()

Updates an EkmConnection's metadata.

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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
   UpdateEkmConnectionRequest request =
       UpdateEkmConnectionRequest.newBuilder()
           .setEkmConnection(EkmConnection.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<EkmConnection> future =
       ekmServiceClient.updateEkmConnectionCallable().futureCall(request);
   // Do something.
   EkmConnection response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateEkmConnectionRequest,EkmConnection>