Search in sources :

Example 31 with CryptoKeyVersion

use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.

the class SyncDestroyCryptoKeyVersion method syncDestroyCryptoKeyVersion.

public static void syncDestroyCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        DestroyCryptoKeyVersionRequest request = DestroyCryptoKeyVersionRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
        CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(request);
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) DestroyCryptoKeyVersionRequest(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 32 with CryptoKeyVersion

use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.

the class SyncDestroyCryptoKeyVersionCryptokeyversionname method syncDestroyCryptoKeyVersionCryptokeyversionname.

public static void syncDestroyCryptoKeyVersionCryptokeyversionname() 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]");
        CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name);
    }
}
Also used : CryptoKeyVersionName(com.google.cloud.kms.v1.CryptoKeyVersionName) CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 33 with CryptoKeyVersion

use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.

the class SyncDestroyCryptoKeyVersionString method syncDestroyCryptoKeyVersionString.

public static void syncDestroyCryptoKeyVersionString() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        String name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString();
        CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name);
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 34 with CryptoKeyVersion

use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.

the class AsyncImportCryptoKeyVersion method asyncImportCryptoKeyVersion.

public static void asyncImportCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        ImportCryptoKeyVersionRequest request = ImportCryptoKeyVersionRequest.newBuilder().setParent(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setImportJob("importJob-208547368").build();
        ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.importCryptoKeyVersionCallable().futureCall(request);
        // Do something.
        CryptoKeyVersion response = future.get();
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) ImportCryptoKeyVersionRequest(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 35 with CryptoKeyVersion

use of com.google.cloud.kms.v1.CryptoKeyVersion in project gapic-generator-java by googleapis.

the class SyncImportCryptoKeyVersion method syncImportCryptoKeyVersion.

public static void syncImportCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        ImportCryptoKeyVersionRequest request = ImportCryptoKeyVersionRequest.newBuilder().setParent(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setImportJob("importJob-208547368").build();
        CryptoKeyVersion response = keyManagementServiceClient.importCryptoKeyVersion(request);
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) ImportCryptoKeyVersionRequest(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

CryptoKeyVersion (com.google.cloud.kms.v1.CryptoKeyVersion)43 KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)39 CryptoKeyVersionName (com.google.cloud.kms.v1.CryptoKeyVersionName)13 Test (org.junit.Test)8 FieldMask (com.google.protobuf.FieldMask)7 ByteString (com.google.protobuf.ByteString)6 CryptoKeyName (com.google.cloud.kms.v1.CryptoKeyName)5 ListCryptoKeyVersionsPagedResponse (com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse)4 ListCryptoKeyVersionsRequest (com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest)4 AbstractMessage (com.google.protobuf.AbstractMessage)4 CreateCryptoKeyVersionRequest (com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest)2 CryptoKey (com.google.cloud.kms.v1.CryptoKey)2 DestroyCryptoKeyVersionRequest (com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest)2 GetCryptoKeyVersionRequest (com.google.cloud.kms.v1.GetCryptoKeyVersionRequest)2 ImportCryptoKeyVersionRequest (com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest)2 KeyOperationAttestation (com.google.cloud.kms.v1.KeyOperationAttestation)2 RestoreCryptoKeyVersionRequest (com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest)2 UpdateCryptoKeyVersionRequest (com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest)2 TimeoutException (java.util.concurrent.TimeoutException)2 AfterClass (org.junit.AfterClass)2