MCPcopy Create free account
hub / github.com/apache/arrow / fs___AzureFileSystem__Make

Function fs___AzureFileSystem__Make

r/src/filesystem.cpp:534–579  ·  view source on GitHub ↗

[[azure::export]]

Source from the content-addressed store, hash-verified

532
533// [[azure::export]]
534std::shared_ptr<fs::AzureFileSystem> fs___AzureFileSystem__Make(cpp11::list options) {
535 fs::AzureOptions azure_opts;
536
537 // Set account name
538 azure_opts.account_name = cpp11::as_cpp<std::string>(options["account_name"]);
539
540 if (!Rf_isNull(options["blob_storage_authority"])) {
541 azure_opts.blob_storage_authority =
542 cpp11::as_cpp<std::string>(options["blob_storage_authority"]);
543 }
544 if (!Rf_isNull(options["dfs_storage_authority"])) {
545 azure_opts.dfs_storage_authority =
546 cpp11::as_cpp<std::string>(options["dfs_storage_authority"]);
547 }
548 if (!Rf_isNull(options["blob_storage_scheme"])) {
549 azure_opts.blob_storage_scheme =
550 cpp11::as_cpp<std::string>(options["blob_storage_scheme"]);
551 }
552 if (!Rf_isNull(options["dfs_storage_scheme"])) {
553 azure_opts.dfs_storage_scheme =
554 cpp11::as_cpp<std::string>(options["dfs_storage_scheme"]);
555 }
556 // Validation of the different auth paths happens in the R code.
557 if (!Rf_isNull(options["client_id"])) {
558 if (Rf_isNull(options["tenant_id"]) && Rf_isNull(options["client_secret"])) {
559 StopIfNotOk(azure_opts.ConfigureManagedIdentityCredential(
560 cpp11::as_cpp<std::string>(options["client_id"])));
561 } else if (!Rf_isNull(options["tenant_id"]) && !Rf_isNull(options["client_secret"])) {
562 StopIfNotOk(azure_opts.ConfigureClientSecretCredential(
563 cpp11::as_cpp<std::string>(options["tenant_id"]),
564 cpp11::as_cpp<std::string>(options["client_id"]),
565 cpp11::as_cpp<std::string>(options["client_secret"])));
566 }
567 } else if (!Rf_isNull(options["account_key"])) {
568 StopIfNotOk(azure_opts.ConfigureAccountKeyCredential(
569 cpp11::as_cpp<std::string>(options["account_key"])));
570 } else if (!Rf_isNull(options["sas_token"])) {
571 StopIfNotOk(azure_opts.ConfigureSASCredential(
572 cpp11::as_cpp<std::string>(options["sas_token"])));
573 } else {
574 StopIfNotOk(azure_opts.ConfigureDefaultCredential());
575 }
576
577 auto io_context = MainRThread::GetInstance().CancellableIOContext();
578 return ValueOrStop(fs::AzureFileSystem::Make(azure_opts, io_context));
579}
580
581#endif

Callers 1

Calls 9

StopIfNotOkFunction · 0.85
ValueOrStopFunction · 0.85
CancellableIOContextMethod · 0.80
MakeFunction · 0.50

Tested by

no test coverage detected