GitHub user fstephany edited a comment on the discussion: REST catalog with S3T
It works with the following (beware, super naive code in here :grin: ):
```rust
struct NonRenewedCreds(AwsCredential);
#[async_trait]
impl iceberg_storage_opendal::AwsCredentialLoad for NonRenewedCreds {
async fn load_credential(
&self,
_: reqwest::Client,
) -> Result<Option<AwsCredential>, anyhow::Error> {
futures::future::ok(Some(self.0.clone())).await
}
}
let cfg = aws_config::from_env()
.profile_name("profile-name-to-use")
.load()
.await;
let credential_loader = cfg.credentials_provider().unwrap();
let creds = credential_loader.provide_credentials().await.unwrap();
let opendal_creds = AwsCredential {
access_key_id: creds.access_key_id().to_string(),
secret_access_key: creds.secret_access_key().to_string(),
session_token: creds.session_token().map(ToOwned::to_owned),
expires_in: None,
};
let naive_creds = NonRenewedCreds(opendal_creds);
let custom_loader = CustomAwsCredentialLoader::new(Arc::new(naive_creds));
// Regular AWS SDK Client
let s3_tables_client = aws_sdk_s3tables::Client::new(&cfg);
let catalog = S3TablesCatalogBuilder::default()
.with_client(s3_tables_client)
.with_storage_factory(Arc::new(OpenDalStorageFactory::S3 {
configured_scheme: "s3".to_string(), // Use s3:// instead of s3a://
customized_credential_load: Some(custom_loader),
}))
```
GitHub link:
https://github.com/apache/iceberg-rust/discussions/1239#discussioncomment-16477566
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]