pub struct KeyManagementService { /* private fields */ }Expand description
Implements a client for the Cloud Key Management Service (KMS) API.
§Example
let client = KeyManagementService::builder().build().await?;
// use `client` to make requests to the Cloud Key Management Service (KMS) API.§Service Description
Google Cloud Key Management Service
Manages cryptographic keys and operations using those keys. Implements a REST model with the following objects:
If you are using manual gRPC libraries, see Using gRPC with Cloud KMS.
§Configuration
To configure KeyManagementService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://cloudkms.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
KeyManagementService holds a connection pool internally, it is advised to
create one and the reuse it. You do not need to wrap KeyManagementService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl KeyManagementService
impl KeyManagementService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for KeyManagementService.
let client = KeyManagementService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: KeyManagementService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: KeyManagementService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn list_key_rings(&self) -> ListKeyRings
pub fn list_key_rings(&self) -> ListKeyRings
Lists KeyRings.
Sourcepub fn list_crypto_keys(&self) -> ListCryptoKeys
pub fn list_crypto_keys(&self) -> ListCryptoKeys
Lists CryptoKeys.
Sourcepub fn list_crypto_key_versions(&self) -> ListCryptoKeyVersions
pub fn list_crypto_key_versions(&self) -> ListCryptoKeyVersions
Lists CryptoKeyVersions.
Sourcepub fn list_import_jobs(&self) -> ListImportJobs
pub fn list_import_jobs(&self) -> ListImportJobs
Lists ImportJobs.
Sourcepub fn get_key_ring(&self) -> GetKeyRing
pub fn get_key_ring(&self) -> GetKeyRing
Returns metadata for a given KeyRing.
Sourcepub fn get_crypto_key(&self) -> GetCryptoKey
pub fn get_crypto_key(&self) -> GetCryptoKey
Returns metadata for a given CryptoKey, as well as its primary CryptoKeyVersion.
Sourcepub fn get_crypto_key_version(&self) -> GetCryptoKeyVersion
pub fn get_crypto_key_version(&self) -> GetCryptoKeyVersion
Returns metadata for a given CryptoKeyVersion.
Sourcepub fn get_public_key(&self) -> GetPublicKey
pub fn get_public_key(&self) -> GetPublicKey
Returns the public key for the given CryptoKeyVersion. The CryptoKey.purpose must be ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT.
Sourcepub fn get_import_job(&self) -> GetImportJob
pub fn get_import_job(&self) -> GetImportJob
Returns metadata for a given ImportJob.
Sourcepub fn create_key_ring(&self) -> CreateKeyRing
pub fn create_key_ring(&self) -> CreateKeyRing
Create a new KeyRing in a given Project and Location.
Sourcepub fn create_crypto_key(&self) -> CreateCryptoKey
pub fn create_crypto_key(&self) -> CreateCryptoKey
Create a new CryptoKey within a KeyRing.
CryptoKey.purpose and CryptoKey.version_template.algorithm are required.
Sourcepub fn create_crypto_key_version(&self) -> CreateCryptoKeyVersion
pub fn create_crypto_key_version(&self) -> CreateCryptoKeyVersion
Create a new CryptoKeyVersion in a CryptoKey.
The server will assign the next sequential id. If unset, state will be set to ENABLED.
Sourcepub fn import_crypto_key_version(&self) -> ImportCryptoKeyVersion
pub fn import_crypto_key_version(&self) -> ImportCryptoKeyVersion
Import wrapped key material into a CryptoKeyVersion.
All requests must specify a CryptoKey. If a CryptoKeyVersion is additionally specified in the request, key material will be reimported into that version. Otherwise, a new version will be created, and will be assigned the next sequential id within the CryptoKey.
Sourcepub fn create_import_job(&self) -> CreateImportJob
pub fn create_import_job(&self) -> CreateImportJob
Create a new ImportJob within a KeyRing.
ImportJob.import_method is required.
Sourcepub fn update_crypto_key(&self) -> UpdateCryptoKey
pub fn update_crypto_key(&self) -> UpdateCryptoKey
Update a CryptoKey.
Sourcepub fn update_crypto_key_version(&self) -> UpdateCryptoKeyVersion
pub fn update_crypto_key_version(&self) -> UpdateCryptoKeyVersion
Update a CryptoKeyVersion’s metadata.
state may be changed between ENABLED and DISABLED using this method. See DestroyCryptoKeyVersion and RestoreCryptoKeyVersion to move between other states.
Sourcepub fn update_crypto_key_primary_version(&self) -> UpdateCryptoKeyPrimaryVersion
pub fn update_crypto_key_primary_version(&self) -> UpdateCryptoKeyPrimaryVersion
Update the version of a CryptoKey that will be used in Encrypt.
Returns an error if called on a key whose purpose is not ENCRYPT_DECRYPT.
Sourcepub fn destroy_crypto_key_version(&self) -> DestroyCryptoKeyVersion
pub fn destroy_crypto_key_version(&self) -> DestroyCryptoKeyVersion
Schedule a CryptoKeyVersion for destruction.
Upon calling this method, CryptoKeyVersion.state will be set to DESTROY_SCHEDULED, and destroy_time will be set to the time destroy_scheduled_duration in the future. At that time, the state will automatically change to DESTROYED, and the key material will be irrevocably destroyed.
Before the destroy_time is reached, RestoreCryptoKeyVersion may be called to reverse the process.
Sourcepub fn restore_crypto_key_version(&self) -> RestoreCryptoKeyVersion
pub fn restore_crypto_key_version(&self) -> RestoreCryptoKeyVersion
Restore a CryptoKeyVersion in the DESTROY_SCHEDULED state.
Upon restoration of the CryptoKeyVersion, state will be set to DISABLED, and destroy_time will be cleared.
Sourcepub fn encrypt(&self) -> Encrypt
pub fn encrypt(&self) -> Encrypt
Encrypts data, so that it can only be recovered by a call to Decrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT.
Sourcepub fn decrypt(&self) -> Decrypt
pub fn decrypt(&self) -> Decrypt
Decrypts data that was protected by Encrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT.
Sourcepub fn raw_encrypt(&self) -> RawEncrypt
pub fn raw_encrypt(&self) -> RawEncrypt
Encrypts data using portable cryptographic primitives. Most users should choose Encrypt and Decrypt rather than their raw counterparts. The CryptoKey.purpose must be RAW_ENCRYPT_DECRYPT.
Sourcepub fn raw_decrypt(&self) -> RawDecrypt
pub fn raw_decrypt(&self) -> RawDecrypt
Decrypts data that was originally encrypted using a raw cryptographic mechanism. The CryptoKey.purpose must be RAW_ENCRYPT_DECRYPT.
Sourcepub fn asymmetric_sign(&self) -> AsymmetricSign
pub fn asymmetric_sign(&self) -> AsymmetricSign
Signs data using a CryptoKeyVersion with CryptoKey.purpose ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from GetPublicKey.
Sourcepub fn asymmetric_decrypt(&self) -> AsymmetricDecrypt
pub fn asymmetric_decrypt(&self) -> AsymmetricDecrypt
Decrypts data that was encrypted with a public key retrieved from GetPublicKey corresponding to a CryptoKeyVersion with CryptoKey.purpose ASYMMETRIC_DECRYPT.
Sourcepub fn mac_sign(&self) -> MacSign
pub fn mac_sign(&self) -> MacSign
Signs data using a CryptoKeyVersion with CryptoKey.purpose MAC, producing a tag that can be verified by another source with the same key.
Sourcepub fn mac_verify(&self) -> MacVerify
pub fn mac_verify(&self) -> MacVerify
Verifies MAC tag using a CryptoKeyVersion with CryptoKey.purpose MAC, and returns a response that indicates whether or not the verification was successful.
Sourcepub fn decapsulate(&self) -> Decapsulate
pub fn decapsulate(&self) -> Decapsulate
Decapsulates data that was encapsulated with a public key retrieved from GetPublicKey corresponding to a CryptoKeyVersion with CryptoKey.purpose KEY_ENCAPSULATION.
Sourcepub fn generate_random_bytes(&self) -> GenerateRandomBytes
pub fn generate_random_bytes(&self) -> GenerateRandomBytes
Generate random bytes using the Cloud KMS randomness source in the provided location.
Sourcepub fn list_locations(&self) -> ListLocations
pub fn list_locations(&self) -> ListLocations
Lists information about the supported locations for this service.
Sourcepub fn get_location(&self) -> GetLocation
pub fn get_location(&self) -> GetLocation
Gets information about a location.
Sourcepub fn set_iam_policy(&self) -> SetIamPolicy
pub fn set_iam_policy(&self) -> SetIamPolicy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED
errors.
Sourcepub fn get_iam_policy(&self) -> GetIamPolicy
pub fn get_iam_policy(&self) -> GetIamPolicy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Sourcepub fn test_iam_permissions(&self) -> TestIamPermissions
pub fn test_iam_permissions(&self) -> TestIamPermissions
Returns permissions that a caller has on the specified resource. If the
resource does not exist, this will return an empty set of
permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may “fail open” without warning.
Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
Trait Implementations§
Source§impl Clone for KeyManagementService
impl Clone for KeyManagementService
Source§fn clone(&self) -> KeyManagementService
fn clone(&self) -> KeyManagementService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more