Class EkmServiceClient
- java.lang.Object
-
- com.google.cloud.kms.v1.EkmServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class EkmServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Google Cloud Key Management EKM ServiceManages external cryptographic keys and operations using those keys. Implements a REST model with the following objects:
- [EkmConnection][google.cloud.kms.v1.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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.newHttpJsonBuilder().build(); EkmServiceClient ekmServiceClient = EkmServiceClient.create(ekmServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EkmServiceClient.ListEkmConnectionsFixedSizeCollection
static class
EkmServiceClient.ListEkmConnectionsPage
static class
EkmServiceClient.ListEkmConnectionsPagedResponse
static class
EkmServiceClient.ListLocationsFixedSizeCollection
static class
EkmServiceClient.ListLocationsPage
static class
EkmServiceClient.ListLocationsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
EkmServiceClient(EkmServiceSettings settings)
Constructs an instance of EkmServiceClient, using the given settings.protected
EkmServiceClient(EkmServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static EkmServiceClient
create()
Constructs an instance of EkmServiceClient with default settings.static EkmServiceClient
create(EkmServiceSettings settings)
Constructs an instance of EkmServiceClient, using the given settings.static EkmServiceClient
create(EkmServiceStub stub)
Constructs an instance of EkmServiceClient, using the given stub for making calls.EkmConnection
createEkmConnection(CreateEkmConnectionRequest request)
Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and Location.EkmConnection
createEkmConnection(LocationName parent, String ekmConnectionId, EkmConnection ekmConnection)
Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and Location.EkmConnection
createEkmConnection(String parent, String ekmConnectionId, EkmConnection ekmConnection)
Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and Location.com.google.api.gax.rpc.UnaryCallable<CreateEkmConnectionRequest,EkmConnection>
createEkmConnectionCallable()
Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and Location.EkmConfig
getEkmConfig(EkmConfigName name)
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.EkmConfig
getEkmConfig(GetEkmConfigRequest request)
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.EkmConfig
getEkmConfig(String name)
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.com.google.api.gax.rpc.UnaryCallable<GetEkmConfigRequest,EkmConfig>
getEkmConfigCallable()
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.EkmConnection
getEkmConnection(EkmConnectionName name)
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].EkmConnection
getEkmConnection(GetEkmConnectionRequest request)
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].EkmConnection
getEkmConnection(String name)
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].com.google.api.gax.rpc.UnaryCallable<GetEkmConnectionRequest,EkmConnection>
getEkmConnectionCallable()
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].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.EkmServiceSettings
getSettings()
EkmServiceStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
EkmServiceClient.ListEkmConnectionsPagedResponse
listEkmConnections(ListEkmConnectionsRequest request)
Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].EkmServiceClient.ListEkmConnectionsPagedResponse
listEkmConnections(LocationName parent)
Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].EkmServiceClient.ListEkmConnectionsPagedResponse
listEkmConnections(String parent)
Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].com.google.api.gax.rpc.UnaryCallable<ListEkmConnectionsRequest,ListEkmConnectionsResponse>
listEkmConnectionsCallable()
Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].com.google.api.gax.rpc.UnaryCallable<ListEkmConnectionsRequest,EkmServiceClient.ListEkmConnectionsPagedResponse>
listEkmConnectionsPagedCallable()
Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].EkmServiceClient.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,EkmServiceClient.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.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.EkmConfig
updateEkmConfig(EkmConfig ekmConfig, com.google.protobuf.FieldMask updateMask)
Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.EkmConfig
updateEkmConfig(UpdateEkmConfigRequest request)
Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.com.google.api.gax.rpc.UnaryCallable<UpdateEkmConfigRequest,EkmConfig>
updateEkmConfigCallable()
Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project and location.EkmConnection
updateEkmConnection(EkmConnection ekmConnection, com.google.protobuf.FieldMask updateMask)
Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.EkmConnection
updateEkmConnection(UpdateEkmConnectionRequest request)
Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.com.google.api.gax.rpc.UnaryCallable<UpdateEkmConnectionRequest,EkmConnection>
updateEkmConnectionCallable()
Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.VerifyConnectivityResponse
verifyConnectivity(EkmConnectionName name)
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection].VerifyConnectivityResponse
verifyConnectivity(VerifyConnectivityRequest request)
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection].VerifyConnectivityResponse
verifyConnectivity(String name)
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection].com.google.api.gax.rpc.UnaryCallable<VerifyConnectivityRequest,VerifyConnectivityResponse>
verifyConnectivityCallable()
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection].
-
-
-
Constructor Detail
-
EkmServiceClient
protected EkmServiceClient(EkmServiceSettings settings) throws IOException
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.- Throws:
IOException
-
EkmServiceClient
protected EkmServiceClient(EkmServiceStub stub)
-
-
Method Detail
-
create
public static final EkmServiceClient create() throws IOException
Constructs an instance of EkmServiceClient with default settings.- Throws:
IOException
-
create
public static final EkmServiceClient create(EkmServiceSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final EkmServiceSettings getSettings()
-
getStub
public EkmServiceStub getStub()
-
listEkmConnections
public final EkmServiceClient.ListEkmConnectionsPagedResponse listEkmConnections(LocationName parent)
Lists [EkmConnections][google.cloud.kms.v1.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()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (EkmConnection element : ekmServiceClient.listEkmConnections(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The resource name of the location associated with the [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format `projects/*/locations/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listEkmConnections
public final EkmServiceClient.ListEkmConnectionsPagedResponse listEkmConnections(String parent)
Lists [EkmConnections][google.cloud.kms.v1.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 parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (EkmConnection element : ekmServiceClient.listEkmConnections(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The resource name of the location associated with the [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format `projects/*/locations/*`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listEkmConnections
public final EkmServiceClient.ListEkmConnectionsPagedResponse listEkmConnections(ListEkmConnectionsRequest request)
Lists [EkmConnections][google.cloud.kms.v1.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()) { 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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listEkmConnectionsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListEkmConnectionsRequest,EkmServiceClient.ListEkmConnectionsPagedResponse> listEkmConnectionsPagedCallable()
Lists [EkmConnections][google.cloud.kms.v1.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()) { 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); } }
-
listEkmConnectionsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListEkmConnectionsRequest,ListEkmConnectionsResponse> listEkmConnectionsCallable()
Lists [EkmConnections][google.cloud.kms.v1.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()) { 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; } } }
-
getEkmConnection
public final EkmConnection getEkmConnection(EkmConnectionName name)
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.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); }
- Parameters:
name
- Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEkmConnection
public final EkmConnection getEkmConnection(String name)
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.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); }
- Parameters:
name
- Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEkmConnection
public final EkmConnection getEkmConnection(GetEkmConnectionRequest request)
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEkmConnectionCallable
public final com.google.api.gax.rpc.UnaryCallable<GetEkmConnectionRequest,EkmConnection> getEkmConnectionCallable()
Returns metadata for a given [EkmConnection][google.cloud.kms.v1.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(); }
-
createEkmConnection
public final EkmConnection createEkmConnection(LocationName parent, String ekmConnectionId, EkmConnection ekmConnection)
Creates a new [EkmConnection][google.cloud.kms.v1.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:
parent
- Required. The resource name of the location associated with the [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format `projects/*/locations/*`.ekmConnectionId
- Required. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}`.ekmConnection
- Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with initial field values.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createEkmConnection
public final EkmConnection createEkmConnection(String parent, String ekmConnectionId, EkmConnection ekmConnection)
Creates a new [EkmConnection][google.cloud.kms.v1.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:
parent
- Required. The resource name of the location associated with the [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format `projects/*/locations/*`.ekmConnectionId
- Required. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}`.ekmConnection
- Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with initial field values.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createEkmConnection
public final EkmConnection createEkmConnection(CreateEkmConnectionRequest request)
Creates a new [EkmConnection][google.cloud.kms.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createEkmConnectionCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateEkmConnectionRequest,EkmConnection> createEkmConnectionCallable()
Creates a new [EkmConnection][google.cloud.kms.v1.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(); }
-
updateEkmConnection
public final EkmConnection updateEkmConnection(EkmConnection ekmConnection, com.google.protobuf.FieldMask updateMask)
Updates an [EkmConnection][google.cloud.kms.v1.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:
ekmConnection
- Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated values.updateMask
- Required. List of fields to be updated in this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateEkmConnection
public final EkmConnection updateEkmConnection(UpdateEkmConnectionRequest request)
Updates an [EkmConnection][google.cloud.kms.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateEkmConnectionCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateEkmConnectionRequest,EkmConnection> updateEkmConnectionCallable()
Updates an [EkmConnection][google.cloud.kms.v1.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(); }
-
getEkmConfig
public final EkmConfig getEkmConfig(EkmConfigName name)
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for 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()) { EkmConfigName name = EkmConfigName.of("[PROJECT]", "[LOCATION]"); EkmConfig response = ekmServiceClient.getEkmConfig(name); }
- Parameters:
name
- Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEkmConfig
public final EkmConfig getEkmConfig(String name)
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for 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 name = EkmConfigName.of("[PROJECT]", "[LOCATION]").toString(); EkmConfig response = ekmServiceClient.getEkmConfig(name); }
- Parameters:
name
- Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEkmConfig
public final EkmConfig getEkmConfig(GetEkmConfigRequest request)
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for 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()) { GetEkmConfigRequest request = GetEkmConfigRequest.newBuilder() .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) .build(); EkmConfig response = ekmServiceClient.getEkmConfig(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getEkmConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<GetEkmConfigRequest,EkmConfig> getEkmConfigCallable()
Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for 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()) { GetEkmConfigRequest request = GetEkmConfigRequest.newBuilder() .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) .build(); ApiFuture<EkmConfig> future = ekmServiceClient.getEkmConfigCallable().futureCall(request); // Do something. EkmConfig response = future.get(); }
-
updateEkmConfig
public final EkmConfig updateEkmConfig(EkmConfig ekmConfig, com.google.protobuf.FieldMask updateMask)
Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for 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()) { EkmConfig ekmConfig = EkmConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); EkmConfig response = ekmServiceClient.updateEkmConfig(ekmConfig, updateMask); }
- Parameters:
ekmConfig
- Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.updateMask
- Required. List of fields to be updated in this request.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateEkmConfig
public final EkmConfig updateEkmConfig(UpdateEkmConfigRequest request)
Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for 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()) { UpdateEkmConfigRequest request = UpdateEkmConfigRequest.newBuilder() .setEkmConfig(EkmConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); EkmConfig response = ekmServiceClient.updateEkmConfig(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateEkmConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateEkmConfigRequest,EkmConfig> updateEkmConfigCallable()
Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for 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()) { UpdateEkmConfigRequest request = UpdateEkmConfigRequest.newBuilder() .setEkmConfig(EkmConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<EkmConfig> future = ekmServiceClient.updateEkmConfigCallable().futureCall(request); // Do something. EkmConfig response = future.get(); }
-
verifyConnectivity
public final VerifyConnectivityResponse verifyConnectivity(EkmConnectionName name)
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM, this method returns a FAILED_PRECONDITION status containing structured information as described at https://cloud.google.com/kms/docs/reference/ekm_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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { EkmConnectionName name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]"); VerifyConnectivityResponse response = ekmServiceClient.verifyConnectivity(name); }
- Parameters:
name
- Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
verifyConnectivity
public final VerifyConnectivityResponse verifyConnectivity(String name)
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM, this method returns a FAILED_PRECONDITION status containing structured information as described at https://cloud.google.com/kms/docs/reference/ekm_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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { String name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString(); VerifyConnectivityResponse response = ekmServiceClient.verifyConnectivity(name); }
- Parameters:
name
- Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
verifyConnectivity
public final VerifyConnectivityResponse verifyConnectivity(VerifyConnectivityRequest request)
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM, this method returns a FAILED_PRECONDITION status containing structured information as described at https://cloud.google.com/kms/docs/reference/ekm_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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { VerifyConnectivityRequest request = VerifyConnectivityRequest.newBuilder() .setName( EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) .build(); VerifyConnectivityResponse response = ekmServiceClient.verifyConnectivity(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
verifyConnectivityCallable
public final com.google.api.gax.rpc.UnaryCallable<VerifyConnectivityRequest,VerifyConnectivityResponse> verifyConnectivityCallable()
Verifies that Cloud KMS can successfully connect to the external key manager specified by an [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM, this method returns a FAILED_PRECONDITION status containing structured information as described at https://cloud.google.com/kms/docs/reference/ekm_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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { VerifyConnectivityRequest request = VerifyConnectivityRequest.newBuilder() .setName( EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) .build(); ApiFuture<VerifyConnectivityResponse> future = ekmServiceClient.verifyConnectivityCallable().futureCall(request); // Do something. VerifyConnectivityResponse response = future.get(); }
-
listLocations
public final EkmServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : ekmServiceClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listLocationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,EkmServiceClient.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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = ekmServiceClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listLocationsCallable
public final 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.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()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = ekmServiceClient.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; } } }
-
getLocation
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = ekmServiceClient.getLocation(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getLocationCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.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 (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = ekmServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); }
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource. Replacesany existing policy.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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicyCallable
public final 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. Replacesany existing policy.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 (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(); }
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicyCallable
public final 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. 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(); }
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissionsCallable
public final 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. 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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-