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

Method ExtractFromUriQuery

cpp/src/arrow/filesystem/azurefs.cc:104–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104Status AzureOptions::ExtractFromUriQuery(const Uri& uri) {
105 std::optional<CredentialKind> credential_kind;
106 std::optional<std::string> credential_kind_value;
107 std::string tenant_id;
108 std::string client_id;
109 std::string client_secret;
110
111 // These query parameters are the union of the following docs:
112 // https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas#specify-the-account-sas-parameters
113 // https://learn.microsoft.com/en-us/rest/api/storageservices/create-service-sas#construct-a-service-sas
114 // (excluding parameters for table storage only)
115 // https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas#construct-a-user-delegation-sas
116 static const std::set<std::string> sas_token_query_parameters = {
117 "sv", "ss", "sr", "st", "se", "sp", "si", "sip", "spr",
118 "skoid", "sktid", "srt", "skt", "ske", "skv", "sks", "saoid", "suoid",
119 "scid", "sdd", "ses", "sig", "rscc", "rscd", "rsce", "rscl", "rsct",
120 };
121
122 ARROW_ASSIGN_OR_RAISE(const auto options_items, uri.query_items());
123 for (const auto& kv : options_items) {
124 if (kv.first == "blob_storage_authority") {
125 blob_storage_authority = kv.second;
126 } else if (kv.first == "dfs_storage_authority") {
127 dfs_storage_authority = kv.second;
128 } else if (kv.first == "credential_kind") {
129 if (kv.second == "default") {
130 credential_kind = CredentialKind::kDefault;
131 } else if (kv.second == "anonymous") {
132 credential_kind = CredentialKind::kAnonymous;
133 } else if (kv.second == "cli") {
134 credential_kind = CredentialKind::kCLI;
135 } else if (kv.second == "workload_identity") {
136 credential_kind = CredentialKind::kWorkloadIdentity;
137 } else if (kv.second == "environment") {
138 credential_kind = CredentialKind::kEnvironment;
139 } else {
140 // Other credential kinds should be inferred from the given
141 // parameters automatically.
142 return Status::Invalid("Unexpected credential_kind: '", kv.second, "'");
143 }
144 credential_kind_value = kv.second;
145 } else if (kv.first == "tenant_id") {
146 tenant_id = kv.second;
147 } else if (kv.first == "client_id") {
148 client_id = kv.second;
149 } else if (kv.first == "client_secret") {
150 client_secret = kv.second;
151 } else if (kv.first == "enable_tls") {
152 ARROW_ASSIGN_OR_RAISE(auto enable_tls, ::arrow::internal::ParseBoolean(kv.second));
153 if (enable_tls) {
154 blob_storage_scheme = "https";
155 dfs_storage_scheme = "https";
156 } else {
157 blob_storage_scheme = "http";
158 dfs_storage_scheme = "http";
159 }
160 } else if (kv.first == "background_writes") {
161 ARROW_ASSIGN_OR_RAISE(background_writes,

Callers 1

FromUriMethod · 0.80

Calls 8

ParseBooleanFunction · 0.85
query_stringMethod · 0.80
InvalidFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected