[[gcs::export]]
| 463 | |
| 464 | // [[gcs::export]] |
| 465 | cpp11::list fs___GcsFileSystem__options(const std::shared_ptr<fs::GcsFileSystem>& fs) { |
| 466 | using cpp11::literals::operator""_nm; |
| 467 | |
| 468 | cpp11::writable::list out; |
| 469 | |
| 470 | fs::GcsOptions opts = fs->options(); |
| 471 | |
| 472 | // GcsCredentials |
| 473 | out.push_back({"anonymous"_nm = opts.credentials.anonymous()}); |
| 474 | |
| 475 | if (opts.credentials.access_token() != "") { |
| 476 | out.push_back({"access_token"_nm = opts.credentials.access_token()}); |
| 477 | } |
| 478 | |
| 479 | if (opts.credentials.expiration().time_since_epoch().count() != 0) { |
| 480 | out.push_back({"expiration"_nm = cpp11::as_sexp<double>( |
| 481 | opts.credentials.expiration().time_since_epoch().count())}); |
| 482 | } |
| 483 | |
| 484 | if (opts.credentials.target_service_account() != "") { |
| 485 | out.push_back( |
| 486 | {"target_service_account"_nm = opts.credentials.target_service_account()}); |
| 487 | } |
| 488 | |
| 489 | if (opts.credentials.json_credentials() != "") { |
| 490 | out.push_back({"json_credentials"_nm = opts.credentials.json_credentials()}); |
| 491 | } |
| 492 | |
| 493 | // GcsOptions direct members |
| 494 | if (opts.endpoint_override != "") { |
| 495 | out.push_back({"endpoint_override"_nm = opts.endpoint_override}); |
| 496 | } |
| 497 | |
| 498 | if (opts.scheme != "") { |
| 499 | out.push_back({"scheme"_nm = opts.scheme}); |
| 500 | } |
| 501 | |
| 502 | if (opts.default_bucket_location != "") { |
| 503 | out.push_back({"default_bucket_location"_nm = opts.default_bucket_location}); |
| 504 | } |
| 505 | |
| 506 | out.push_back({"retry_limit_seconds"_nm = opts.retry_limit_seconds.value()}); |
| 507 | |
| 508 | // default_metadata |
| 509 | if (opts.default_metadata != nullptr && opts.default_metadata->size() > 0) { |
| 510 | cpp11::writable::strings metadata(opts.default_metadata->size()); |
| 511 | |
| 512 | metadata.names() = opts.default_metadata->keys(); |
| 513 | |
| 514 | for (int64_t i = 0; i < opts.default_metadata->size(); i++) { |
| 515 | metadata[static_cast<size_t>(i)] = opts.default_metadata->value(i); |
| 516 | } |
| 517 | |
| 518 | out.push_back({"default_metadata"_nm = metadata}); |
| 519 | } |
| 520 | |
| 521 | if (opts.project_id.has_value()) { |
| 522 | out.push_back({"project_id"_nm = opts.project_id.value()}); |