@@ -31,11 +31,12 @@ use iceberg::{
31
31
Catalog , Error , ErrorKind , Namespace , NamespaceIdent , Result , TableCommit , TableCreation ,
32
32
TableIdent ,
33
33
} ;
34
+ use typed_builder:: TypedBuilder ;
34
35
35
36
use crate :: utils:: { create_metadata_location, create_sdk_config} ;
36
37
37
38
/// S3Tables catalog configuration.
38
- #[ derive( Debug ) ]
39
+ #[ derive( Debug , TypedBuilder ) ]
39
40
pub struct S3TablesCatalogConfig {
40
41
/// Unlike other buckets, S3Tables bucket is not a physical bucket, but a virtual bucket
41
42
/// that is managed by s3tables. We can't directly access the bucket with path like
@@ -48,8 +49,10 @@ pub struct S3TablesCatalogConfig {
48
49
/// - `aws_access_key_id`: The AWS access key ID to use.
49
50
/// - `aws_secret_access_key`: The AWS secret access key to use.
50
51
/// - `aws_session_token`: The AWS session token to use.
52
+ #[ builder( default ) ]
51
53
properties : HashMap < String , String > ,
52
54
/// Endpoint URL for the catalog.
55
+ #[ builder( default , setter( strip_option( fallback = endpoint_url_opt) ) ) ]
53
56
endpoint_url : Option < String > ,
54
57
}
55
58
@@ -515,12 +518,9 @@ mod tests {
515
518
None => return Ok ( None ) ,
516
519
} ;
517
520
518
- let properties = HashMap :: new ( ) ;
519
- let config = S3TablesCatalogConfig {
520
- table_bucket_arn,
521
- properties,
522
- endpoint_url : None ,
523
- } ;
521
+ let config = S3TablesCatalogConfig :: builder ( )
522
+ . table_bucket_arn ( table_bucket_arn)
523
+ . build ( ) ;
524
524
525
525
Ok ( Some ( S3TablesCatalog :: new ( config) . await ?) )
526
526
}
0 commit comments