use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncGetPublicKey method syncGetPublicKey.
public static void syncGetPublicKey() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetPublicKeyRequest request = GetPublicKeyRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
PublicKey response = keyManagementServiceClient.getPublicKey(request);
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncGetPublicKeyCryptokeyversionname method syncGetPublicKeyCryptokeyversionname.
public static void syncGetPublicKeyCryptokeyversionname() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
PublicKey response = keyManagementServiceClient.getPublicKey(name);
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class AsyncListCryptoKeys method asyncListCryptoKeys.
public static void asyncListCryptoKeys() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
ListCryptoKeysRequest request = ListCryptoKeysRequest.newBuilder().setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setFilter("filter-1274492040").setOrderBy("orderBy-1207110587").build();
ApiFuture<CryptoKey> future = keyManagementServiceClient.listCryptoKeysPagedCallable().futureCall(request);
// Do something.
for (CryptoKey element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class AsyncListKeyRingsPaged method asyncListKeyRingsPaged.
public static void asyncListKeyRingsPaged() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
ListKeyRingsRequest request = ListKeyRingsRequest.newBuilder().setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setFilter("filter-1274492040").setOrderBy("orderBy-1207110587").build();
while (true) {
ListKeyRingsResponse response = keyManagementServiceClient.listKeyRingsCallable().call(request);
for (KeyRing element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class AsyncListLocations method asyncListLocations.
public static void asyncListLocations() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
ListLocationsRequest request = ListLocationsRequest.newBuilder().setName("name3373707").setFilter("filter-1274492040").setPageSize(883849137).setPageToken("pageToken873572522").build();
ApiFuture<Location> future = keyManagementServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
Aggregations