Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikKapila committed Dec 9, 2024
1 parent 665a420 commit 415bf7a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

pub mod aws_kms_hierarchical_keyring_example;
pub mod create_branch_key_id;
pub mod version_branch_key_id;
pub mod version_branch_key_id_example;
pub mod example_branch_key_id_supplier;
pub mod shared_cache_across_hierarchical_keyrings_example;
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use aws_esdk::aws_cryptography_keyStore::types::KmsConfiguration;
/*
This example demonstrates configuring a KeyStore and then
uses a helper method to version a branch key.
This example is here for demonstration, but is not actively tested in CI.
*/
pub async fn version_branch_key_id(
key_store_table_name: &str,
Expand All @@ -35,5 +33,36 @@ pub async fn version_branch_key_id(
.branch_key_identifier(branch_key_id)
.send()
.await?;

println!("Version Branch Key Example Completed Successfully");

Ok(())
}

// Function to test version_branch_key_id in main.rs in examples directory
pub async fn create_and_version_branch_key_id() -> Result<(), crate::BoxError2> {
use crate::example_utils::utils;
use super::create_branch_key_id::create_branch_key_id;

let branch_key_id: String = create_branch_key_id(
utils::TEST_KEY_STORE_NAME,
utils::TEST_LOGICAL_KEY_STORE_NAME,
utils::TEST_KEY_STORE_KMS_KEY_ID
).await?;

version_branch_key_id(
utils::TEST_KEY_STORE_NAME,
utils::TEST_LOGICAL_KEY_STORE_NAME,
utils::TEST_KEY_STORE_KMS_KEY_ID,
&branch_key_id
).await?;

Ok(())
}

#[tokio::test(flavor = "multi_thread")]
pub async fn test_version_branch_key_id() -> Result<(), crate::BoxError2> {
// Test function for Version Branch Key example
create_and_version_branch_key_id().await?;
Ok(())
}
2 changes: 2 additions & 0 deletions AwsEncryptionSDK/runtimes/rust/examples/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ pub async fn main() -> Result<(), BoxError2> {
utils::TEST_KEY_STORE_KMS_KEY_ID
).await?;

keyring::aws_kms_hierarchical::version_branch_key_id_example::create_and_version_branch_key_id().await?;

keyring::aws_kms_hierarchical::shared_cache_across_hierarchical_keyrings_example::encrypt_and_decrypt_with_keyring(
utils::TEST_EXAMPLE_DATA,
utils::TEST_KEY_STORE_NAME,
Expand Down

0 comments on commit 415bf7a

Please sign in to comment.