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

Function fs___S3FileSystem__create

r/src/filesystem.cpp:312–368  ·  view source on GitHub ↗

[[s3::export]]

Source from the content-addressed store, hash-verified

310
311// [[s3::export]]
312std::shared_ptr<fs::S3FileSystem> fs___S3FileSystem__create(
313 bool anonymous = false, std::string access_key = "", std::string secret_key = "",
314 std::string session_token = "", std::string role_arn = "",
315 std::string session_name = "", std::string external_id = "", int load_frequency = 900,
316 std::string region = "", std::string endpoint_override = "", std::string scheme = "",
317 std::string proxy_options = "", bool background_writes = true,
318 bool allow_bucket_creation = false, bool allow_bucket_deletion = false,
319 bool check_directory_existence_before_creation = false, double connect_timeout = -1,
320 double request_timeout = -1) {
321 EnsureS3InitializedWithSigpipeHandler();
322 fs::S3Options s3_opts;
323 // Handle auth (anonymous, keys, default)
324 // (validation/internal coherence handled in R)
325 if (anonymous) {
326 s3_opts = fs::S3Options::Anonymous();
327 } else if (access_key != "" && secret_key != "") {
328 s3_opts = fs::S3Options::FromAccessKey(access_key, secret_key, session_token);
329 } else if (role_arn != "") {
330 s3_opts = fs::S3Options::FromAssumeRole(role_arn, session_name, external_id,
331 load_frequency);
332 } else {
333 s3_opts = fs::S3Options::Defaults();
334 }
335
336 // Now handle the rest of the options
337 /// AWS region to connect to (default determined by AWS SDK)
338 if (region != "") {
339 s3_opts.region = region;
340 }
341 /// If non-empty, override region with a connect string such as "localhost:9000"
342 s3_opts.endpoint_override = endpoint_override;
343 /// S3 connection transport, default "https"
344 if (scheme != "") {
345 s3_opts.scheme = scheme;
346 }
347
348 if (proxy_options != "") {
349 auto s3_proxy_opts = fs::S3ProxyOptions::FromUri(proxy_options);
350 s3_opts.proxy_options = ValueOrStop(s3_proxy_opts);
351 }
352
353 /// Whether OutputStream writes will be issued in the background, without blocking
354 /// default true
355 s3_opts.background_writes = background_writes;
356
357 s3_opts.allow_bucket_creation = allow_bucket_creation;
358 s3_opts.allow_bucket_deletion = allow_bucket_deletion;
359
360 s3_opts.check_directory_existence_before_creation =
361 check_directory_existence_before_creation;
362
363 s3_opts.request_timeout = request_timeout;
364 s3_opts.connect_timeout = connect_timeout;
365
366 auto io_context = MainRThread::GetInstance().CancellableIOContext();
367 return ValueOrStop(fs::S3FileSystem::Make(s3_opts, io_context));
368}
369

Callers 1

Calls 5

ValueOrStopFunction · 0.85
CancellableIOContextMethod · 0.80
DefaultsFunction · 0.50
MakeFunction · 0.50

Tested by

no test coverage detected