@@ -149,18 +149,31 @@ impl ObjectStoreBuilder {
149149 ObjectStoreBuilder :: Memory ( Arc :: new ( InMemory :: new ( ) ) )
150150 }
151151 /// Set config value for builder
152- pub fn with_config ( self , key : ConfigKey , value : impl Into < String > ) -> Self {
153- match ( self , key) {
154- ( ObjectStoreBuilder :: Azure ( azure) , ConfigKey :: Azure ( key) ) => {
155- ObjectStoreBuilder :: Azure ( Box :: new ( azure. with_config ( key, value) ) )
152+ pub fn with_config (
153+ self ,
154+ key : impl Into < String > ,
155+ value : impl Into < String > ,
156+ ) -> Result < Self , Error > {
157+ match self {
158+ ObjectStoreBuilder :: Azure ( azure) => {
159+ let key: AzureConfigKey = key. into ( ) . parse ( ) ?;
160+ Ok ( ObjectStoreBuilder :: Azure ( Box :: new (
161+ azure. with_config ( key, value) ,
162+ ) ) )
156163 }
157- ( ObjectStoreBuilder :: S3 ( aws) , ConfigKey :: AWS ( key) ) => {
158- ObjectStoreBuilder :: S3 ( Box :: new ( aws. with_config ( key, value) ) )
164+ ObjectStoreBuilder :: S3 ( aws) => {
165+ let key: AmazonS3ConfigKey = key. into ( ) . parse ( ) ?;
166+ Ok ( ObjectStoreBuilder :: S3 ( Box :: new (
167+ aws. with_config ( key, value) ,
168+ ) ) )
159169 }
160- ( ObjectStoreBuilder :: GCS ( gcs) , ConfigKey :: GCS ( key) ) => {
161- ObjectStoreBuilder :: GCS ( Box :: new ( gcs. with_config ( key, value) ) )
170+ ObjectStoreBuilder :: GCS ( gcs) => {
171+ let key: GoogleConfigKey = key. into ( ) . parse ( ) ?;
172+ Ok ( ObjectStoreBuilder :: GCS ( Box :: new (
173+ gcs. with_config ( key, value) ,
174+ ) ) )
162175 }
163- ( x , _ ) => x ,
176+ x => Ok ( x ) ,
164177 }
165178 }
166179 /// Create objectstore from template
0 commit comments