Skip to content

Commit ef1e678

Browse files
committed
m
1 parent 81c0e6f commit ef1e678

File tree

6 files changed

+33
-19
lines changed

6 files changed

+33
-19
lines changed

DynamoDbEncryption/runtimes/rust/examples/clientsupplier/client_supplier_example.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::test_utils;
33
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_dynamoDb::types::DynamoDbTableEncryptionConfig;
44
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_structuredEncryption::types::CryptoAction;
55
use aws_db_esdk::aws_cryptography_materialProviders::client as mpl_client;
6-
use aws_db_esdk::aws_cryptography_materialProviders::types::client_supplier::ClientSupplierRef;
6+
//use aws_db_esdk::aws_cryptography_materialProviders::types::client_supplier::ClientSupplierRef;
77
use aws_db_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
88
use aws_db_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter;
99
use aws_db_esdk::intercept::DbEsdkInterceptor;
@@ -54,13 +54,13 @@ pub async fn put_item_get_item() -> Result<(), crate::BoxError> {
5454
// defined in the RegionalRoleClientSupplier class in this directory.
5555
// Note: RegionalRoleClientSupplier will internally use the key_arn's region
5656
// to retrieve the correct IAM role.
57-
let supplier_ref = ClientSupplierRef {
58-
inner: std::rc::Rc::new(std::cell::RefCell::new(RegionalRoleClientSupplier {})),
59-
};
57+
// let supplier_ref = ClientSupplierRef {
58+
// inner: std::rc::Rc::new(std::cell::RefCell::new(RegionalRoleClientSupplier {})),
59+
// };
6060

6161
let mrk_keyring_with_client_supplier = mpl
6262
.create_aws_kms_mrk_multi_keyring()
63-
.client_supplier(supplier_ref.clone())
63+
.client_supplier(RegionalRoleClientSupplier {})
6464
.generator(key_arn)
6565
.send()
6666
.await?;
@@ -191,7 +191,7 @@ pub async fn put_item_get_item() -> Result<(), crate::BoxError> {
191191

192192
let mrk_discovery_client_supplier_keyring = mpl
193193
.create_aws_kms_mrk_discovery_multi_keyring()
194-
.client_supplier(supplier_ref.clone())
194+
.client_supplier(RegionalRoleClientSupplier {})
195195
.discovery_filter(discovery_filter)
196196
.regions(regions)
197197
.send()

DynamoDbEncryption/runtimes/rust/examples/keyring/hierarchical_keyring.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use aws_db_esdk::aws_cryptography_keyStore::client as keystore_client;
1010
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_dynamoDb::types::dynamo_db_encryption_config::DynamoDbEncryptionConfig;
1111
use super::branch_key_id_supplier::ExampleBranchKeyIdSupplier;
1212
use aws_db_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
13-
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_dynamoDb::types::dynamo_db_key_branch_key_id_supplier::DynamoDbKeyBranchKeyIdSupplierRef;
13+
//use aws_db_esdk::aws_cryptography_dbEncryptionSdk_dynamoDb::types::dynamo_db_key_branch_key_id_supplier::DynamoDbKeyBranchKeyIdSupplierRef;
1414
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_structuredEncryption::types::CryptoAction;
1515
use std::collections::HashMap;
1616
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_dynamoDb::types::DynamoDbTableEncryptionConfig;
@@ -94,12 +94,12 @@ pub async fn put_item_get_item(
9494
let dbesdk_config = DynamoDbEncryptionConfig::builder().build()?;
9595
let dbesdk = dbesdk_client::Client::from_conf(dbesdk_config)?;
9696
let supplier = ExampleBranchKeyIdSupplier::new(tenant1_branch_key_id, tenant2_branch_key_id);
97-
let supplier_ref = DynamoDbKeyBranchKeyIdSupplierRef {
98-
inner: ::std::rc::Rc::new(std::cell::RefCell::new(supplier)),
99-
};
97+
// let supplier_ref = DynamoDbKeyBranchKeyIdSupplierRef {
98+
// inner: ::std::rc::Rc::new(std::cell::RefCell::new(supplier)),
99+
// };
100100
let branch_key_id_supplier = dbesdk
101101
.create_dynamo_db_encryption_branch_key_id_supplier()
102-
.ddb_key_branch_key_id_supplier(supplier_ref)
102+
.ddb_key_branch_key_id_supplier(supplier)
103103
.send()
104104
.await?
105105
.branch_key_id_supplier

DynamoDbEncryption/runtimes/rust/src/time.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ impl crate::Time::_default {
1717
}
1818
}
1919

20+
#[allow(non_snake_case)]
21+
pub fn CurrentRelativeTimeMilli() -> i64 {
22+
match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
23+
Ok(n) => n.as_millis() as i64,
24+
Err(_) => 0,
25+
}
26+
}
27+
2028
#[allow(non_snake_case)]
2129
pub fn GetCurrentTimeStamp() -> ::std::rc::Rc<
2230
_Wrappers_Compile::Result<

releases/rust/db_esdk/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ aws-lc-sys = "0.21.2"
2222
aws-sdk-dynamodb = "1.47.0"
2323
aws-sdk-kms = "1.44.0"
2424
aws-smithy-runtime-api = {version = "1.7.2", features = ["client"] }
25-
aws-smithy-types = "1.2.6"
25+
aws-smithy-types = "1.2.7"
2626
chrono = "0.4.38"
2727
dafny_runtime = { path = "dafny_runtime_rust"}
2828
dashmap = "6.1.0"
@@ -34,4 +34,4 @@ uuid = { version = "1.10.0", features = ["v4"] }
3434
path = "src/implementation_from_dafny.rs"
3535

3636
[[example]]
37-
name = "main"
37+
name = "main"

releases/rust/db_esdk/examples/clientsupplier/client_supplier_example.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::test_utils;
33
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_dynamoDb::types::DynamoDbTableEncryptionConfig;
44
use aws_db_esdk::aws_cryptography_dbEncryptionSdk_structuredEncryption::types::CryptoAction;
55
use aws_db_esdk::aws_cryptography_materialProviders::client as mpl_client;
6-
use aws_db_esdk::aws_cryptography_materialProviders::types::client_supplier::ClientSupplierRef;
6+
// use aws_db_esdk::aws_cryptography_materialProviders::types::client_supplier::ClientSupplierRef;
77
use aws_db_esdk::aws_cryptography_materialProviders::types::material_providers_config::MaterialProvidersConfig;
88
use aws_db_esdk::aws_cryptography_materialProviders::types::DiscoveryFilter;
99
use aws_db_esdk::intercept::DbEsdkInterceptor;
@@ -54,13 +54,13 @@ pub async fn put_item_get_item() -> Result<(), crate::BoxError> {
5454
// defined in the RegionalRoleClientSupplier class in this directory.
5555
// Note: RegionalRoleClientSupplier will internally use the key_arn's region
5656
// to retrieve the correct IAM role.
57-
let supplier_ref = ClientSupplierRef {
58-
inner: std::rc::Rc::new(std::cell::RefCell::new(RegionalRoleClientSupplier {})),
59-
};
57+
// let supplier_ref = ClientSupplierRef {
58+
// inner: std::rc::Rc::new(std::cell::RefCell::new(RegionalRoleClientSupplier {})),
59+
// };
6060

6161
let mrk_keyring_with_client_supplier = mpl
6262
.create_aws_kms_mrk_multi_keyring()
63-
.client_supplier(supplier_ref.clone())
63+
.client_supplier(RegionalRoleClientSupplier {})
6464
.generator(key_arn)
6565
.send()
6666
.await?;
@@ -191,7 +191,7 @@ pub async fn put_item_get_item() -> Result<(), crate::BoxError> {
191191

192192
let mrk_discovery_client_supplier_keyring = mpl
193193
.create_aws_kms_mrk_discovery_multi_keyring()
194-
.client_supplier(supplier_ref.clone())
194+
.client_supplier(RegionalRoleClientSupplier {})
195195
.discovery_filter(discovery_filter)
196196
.regions(regions)
197197
.send()

releases/rust/db_esdk/src/deps/aws_cryptography_materialProviders/types/client_supplier.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ pub struct ClientSupplierRef {
1717
pub inner: ::std::rc::Rc<std::cell::RefCell<dyn ClientSupplier>>,
1818
}
1919

20+
impl<T : ClientSupplier + 'static> From<T> for ClientSupplierRef {
21+
fn from(value: T) -> Self {
22+
Self { inner: std::rc::Rc::new(std::cell::RefCell::new(value)) }
23+
}
24+
}
25+
2026
impl ::std::cmp::PartialEq for ClientSupplierRef {
2127
fn eq(&self, other: &ClientSupplierRef) -> bool {
2228
::std::rc::Rc::ptr_eq(&self.inner, &other.inner)

0 commit comments

Comments
 (0)