Search in sources :

Example 6 with KeyManagementServiceClient

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

the class SyncUpdateCryptoKeyPrimaryVersion method syncUpdateCryptoKeyPrimaryVersion.

public static void syncUpdateCryptoKeyPrimaryVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        UpdateCryptoKeyPrimaryVersionRequest request = UpdateCryptoKeyPrimaryVersionRequest.newBuilder().setName(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCryptoKeyVersionId("cryptoKeyVersionId987674581").build();
        CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(request);
    }
}
Also used : CryptoKey(com.google.cloud.kms.v1.CryptoKey) UpdateCryptoKeyPrimaryVersionRequest(com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 7 with KeyManagementServiceClient

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

the class SyncUpdateCryptoKeyPrimaryVersionStringString method syncUpdateCryptoKeyPrimaryVersionStringString.

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

Example 8 with KeyManagementServiceClient

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

the class SyncUpdateCryptoKeyVersion method syncUpdateCryptoKeyVersion.

public static void syncUpdateCryptoKeyVersion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        UpdateCryptoKeyVersionRequest request = UpdateCryptoKeyVersionRequest.newBuilder().setCryptoKeyVersion(CryptoKeyVersion.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).build();
        CryptoKeyVersion response = keyManagementServiceClient.updateCryptoKeyVersion(request);
    }
}
Also used : UpdateCryptoKeyVersionRequest(com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 9 with KeyManagementServiceClient

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

the class AsyncCreateImportJob method asyncCreateImportJob.

public static void asyncCreateImportJob() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        CreateImportJobRequest request = CreateImportJobRequest.newBuilder().setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString()).setImportJobId("importJobId1449444627").setImportJob(ImportJob.newBuilder().build()).build();
        ApiFuture<ImportJob> future = keyManagementServiceClient.createImportJobCallable().futureCall(request);
        // Do something.
        ImportJob response = future.get();
    }
}
Also used : ImportJob(com.google.cloud.kms.v1.ImportJob) CreateImportJobRequest(com.google.cloud.kms.v1.CreateImportJobRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 10 with KeyManagementServiceClient

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

the class SyncCreateImportJob method syncCreateImportJob.

public static void syncCreateImportJob() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        CreateImportJobRequest request = CreateImportJobRequest.newBuilder().setParent(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString()).setImportJobId("importJobId1449444627").setImportJob(ImportJob.newBuilder().build()).build();
        ImportJob response = keyManagementServiceClient.createImportJob(request);
    }
}
Also used : ImportJob(com.google.cloud.kms.v1.ImportJob) CreateImportJobRequest(com.google.cloud.kms.v1.CreateImportJobRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)185 CryptoKey (com.google.cloud.kms.v1.CryptoKey)56 CryptoKeyVersion (com.google.cloud.kms.v1.CryptoKeyVersion)39 CryptoKeyVersionName (com.google.cloud.kms.v1.CryptoKeyVersionName)37 CryptoKeyName (com.google.cloud.kms.v1.CryptoKeyName)33 ByteString (com.google.protobuf.ByteString)20 KeyRingName (com.google.cloud.kms.v1.KeyRingName)17 KeyRing (com.google.cloud.kms.v1.KeyRing)16 FieldMask (com.google.protobuf.FieldMask)16 PublicKey (com.google.cloud.kms.v1.PublicKey)14 ImportJob (com.google.cloud.kms.v1.ImportJob)10 Test (org.junit.Test)10 Digest (com.google.cloud.kms.v1.Digest)8 EncryptResponse (com.google.cloud.kms.v1.EncryptResponse)8 Policy (com.google.iam.v1.Policy)8 X509EncodedKeySpec (java.security.spec.X509EncodedKeySpec)8 DecryptResponse (com.google.cloud.kms.v1.DecryptResponse)7 AsymmetricDecryptResponse (com.google.cloud.kms.v1.AsymmetricDecryptResponse)6 AsymmetricSignResponse (com.google.cloud.kms.v1.AsymmetricSignResponse)6 LocationName (com.google.cloud.kms.v1.LocationName)6