|
1 | 1 | #include "create_secret_functions.hpp"
|
2 | 2 | #include "s3fs.hpp"
|
3 |
| -#include "duckdb/main/extension_util.hpp" |
| 3 | +#include "duckdb/main/extension/extension_loader.hpp" |
4 | 4 | #include "duckdb/common/local_file_system.hpp"
|
5 | 5 |
|
6 | 6 | namespace duckdb {
|
7 | 7 |
|
8 |
| -void CreateS3SecretFunctions::Register(DatabaseInstance &instance) { |
9 |
| - RegisterCreateSecretFunction(instance, "s3"); |
10 |
| - RegisterCreateSecretFunction(instance, "aws"); |
11 |
| - RegisterCreateSecretFunction(instance, "r2"); |
12 |
| - RegisterCreateSecretFunction(instance, "gcs"); |
| 8 | +void CreateS3SecretFunctions::Register(ExtensionLoader &loader) { |
| 9 | + RegisterCreateSecretFunction(loader, "s3"); |
| 10 | + RegisterCreateSecretFunction(loader, "aws"); |
| 11 | + RegisterCreateSecretFunction(loader, "r2"); |
| 12 | + RegisterCreateSecretFunction(loader, "gcs"); |
13 | 13 | }
|
14 | 14 |
|
15 | 15 | static Value MapToStruct(const Value &map) {
|
@@ -220,39 +220,39 @@ void CreateS3SecretFunctions::SetBaseNamedParams(CreateSecretFunction &function,
|
220 | 220 | }
|
221 | 221 | }
|
222 | 222 |
|
223 |
| -void CreateS3SecretFunctions::RegisterCreateSecretFunction(DatabaseInstance &instance, string type) { |
| 223 | +void CreateS3SecretFunctions::RegisterCreateSecretFunction(ExtensionLoader &loader, string type) { |
224 | 224 | // Register the new type
|
225 | 225 | SecretType secret_type;
|
226 | 226 | secret_type.name = type;
|
227 | 227 | secret_type.deserializer = KeyValueSecret::Deserialize<KeyValueSecret>;
|
228 | 228 | secret_type.default_provider = "config";
|
229 | 229 | secret_type.extension = "httpfs";
|
230 | 230 |
|
231 |
| - ExtensionUtil::RegisterSecretType(instance, secret_type); |
| 231 | + loader.RegisterSecretType(secret_type); |
232 | 232 |
|
233 | 233 | CreateSecretFunction from_empty_config_fun2 = {type, "config", CreateS3SecretFromConfig};
|
234 | 234 | SetBaseNamedParams(from_empty_config_fun2, type);
|
235 |
| - ExtensionUtil::RegisterFunction(instance, from_empty_config_fun2); |
| 235 | + loader.RegisterFunction(from_empty_config_fun2); |
236 | 236 | }
|
237 | 237 |
|
238 |
| -void CreateBearerTokenFunctions::Register(DatabaseInstance &instance) { |
| 238 | +void CreateBearerTokenFunctions::Register(ExtensionLoader &loader) { |
239 | 239 | // HuggingFace secret
|
240 | 240 | SecretType secret_type_hf;
|
241 | 241 | secret_type_hf.name = HUGGINGFACE_TYPE;
|
242 | 242 | secret_type_hf.deserializer = KeyValueSecret::Deserialize<KeyValueSecret>;
|
243 | 243 | secret_type_hf.default_provider = "config";
|
244 | 244 | secret_type_hf.extension = "httpfs";
|
245 |
| - ExtensionUtil::RegisterSecretType(instance, secret_type_hf); |
| 245 | + loader.RegisterSecretType(secret_type_hf); |
246 | 246 |
|
247 | 247 | // Huggingface config provider
|
248 | 248 | CreateSecretFunction hf_config_fun = {HUGGINGFACE_TYPE, "config", CreateBearerSecretFromConfig};
|
249 | 249 | hf_config_fun.named_parameters["token"] = LogicalType::VARCHAR;
|
250 |
| - ExtensionUtil::RegisterFunction(instance, hf_config_fun); |
| 250 | + loader.RegisterFunction(hf_config_fun); |
251 | 251 |
|
252 | 252 | // Huggingface credential_chain provider
|
253 | 253 | CreateSecretFunction hf_cred_fun = {HUGGINGFACE_TYPE, "credential_chain",
|
254 | 254 | CreateHuggingFaceSecretFromCredentialChain};
|
255 |
| - ExtensionUtil::RegisterFunction(instance, hf_cred_fun); |
| 255 | + loader.RegisterFunction(hf_cred_fun); |
256 | 256 | }
|
257 | 257 |
|
258 | 258 | unique_ptr<BaseSecret> CreateBearerTokenFunctions::CreateSecretFunctionInternal(ClientContext &context,
|
|
0 commit comments