object-storage-client 0.4.1__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.github/workflows/tests.yaml +3 -2
  2. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/Cargo.lock +19 -1
  3. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/Cargo.toml +4 -3
  4. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/PKG-INFO +7 -7
  5. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/README.md +6 -6
  6. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/GUI.md +39 -10
  7. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/UPGRADING.md +15 -0
  8. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/aws_profile.rs +1 -1
  9. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/azure.rs +92 -1
  10. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/connector.rs +46 -1
  11. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/gcs.rs +113 -19
  12. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/mod.rs +216 -9
  13. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/s3.rs +113 -3
  14. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/stub.rs +11 -3
  15. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/bin/osc-gui.rs +1 -1
  16. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/client.rs +400 -18
  17. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/codec.rs +42 -11
  18. object_storage_client-0.4.2/src/connection/aws.rs +351 -0
  19. object_storage_client-0.4.2/src/connection/azure.rs +629 -0
  20. object_storage_client-0.4.2/src/connection/gcp.rs +290 -0
  21. object_storage_client-0.4.2/src/connection/mod.rs +452 -0
  22. object_storage_client-0.4.2/src/connection/sso.rs +552 -0
  23. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/envelope/tests.rs +5 -4
  24. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/envelope.rs +1 -1
  25. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action/close.rs +1 -0
  26. object_storage_client-0.4.2/src/gui/action/conn.rs +120 -0
  27. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action/job.rs +64 -22
  28. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action/nav.rs +18 -3
  29. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action/tests/close.rs +1 -1
  30. object_storage_client-0.4.2/src/gui/action/tests/conn.rs +504 -0
  31. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action/tests/jobs.rs +19 -2
  32. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action/tests.rs +53 -22
  33. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action.rs +94 -14
  34. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/app.rs +4 -3
  35. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/args.rs +8 -25
  36. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/keys.rs +5 -5
  37. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/location.rs +60 -15
  38. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/model.rs +26 -2
  39. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/ops/tests.rs +169 -18
  40. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/ops.rs +37 -24
  41. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/startup.rs +13 -23
  42. object_storage_client-0.4.2/src/gui/view/address_bar.rs +74 -0
  43. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/view/dialogs.rs +27 -0
  44. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/view/panel.rs +13 -1
  45. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/view/tests.rs +231 -1
  46. object_storage_client-0.4.2/src/gui/worker/tests.rs +555 -0
  47. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/worker.rs +201 -23
  48. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui.rs +22 -38
  49. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/lib.rs +2 -0
  50. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/registry.rs +94 -8
  51. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/azure_storage_ops.rs +14 -0
  52. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/common/mod.rs +31 -0
  53. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/gcs_storage_ops.rs +12 -0
  54. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/gui_ops.rs +2 -1
  55. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/s3_storage_ops.rs +14 -0
  56. object_storage_client-0.4.1/src/gui/view/address_bar.rs +0 -41
  57. object_storage_client-0.4.1/src/gui/worker/tests.rs +0 -275
  58. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.cargo/config.toml +0 -0
  59. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.docker/garage.toml +0 -0
  60. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.gitattributes +0 -0
  61. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.github/dependabot.yml +0 -0
  62. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.github/workflows/ci.yaml +0 -0
  63. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.github/workflows/perf.yaml +0 -0
  64. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.gitignore +0 -0
  65. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/.python-version +0 -0
  66. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/LICENSE +0 -0
  67. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/benches/alloc-counter/Cargo.toml +0 -0
  68. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/benches/alloc-counter/src/lib.rs +0 -0
  69. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/benches/common/mod.rs +0 -0
  70. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/benches/throughput.rs +0 -0
  71. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/compose.yml +0 -0
  72. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/deny.toml +0 -0
  73. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/BEHAVIOR.md +0 -0
  74. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/CONFIGURATION.md +0 -0
  75. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/DEVELOPMENT.md +0 -0
  76. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/ENCRYPTION.md +0 -0
  77. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/TESTING.md +0 -0
  78. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/docs/images/osc-gui.png +0 -0
  79. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/proptest-regressions/encryption/context.txt +0 -0
  80. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/pyproject.toml +0 -0
  81. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/python/object_storage_client/__init__.py +0 -0
  82. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/python/object_storage_client/__init__.pyi +0 -0
  83. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/python/object_storage_client/_stream.py +0 -0
  84. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/python/object_storage_client/_types.py +0 -0
  85. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/python/object_storage_client/py.typed +0 -0
  86. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/scripts/esdk_oracle.py +0 -0
  87. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/scripts/hostile-env.sh +0 -0
  88. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/scripts/perf_smoke.py +0 -0
  89. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/body.rs +0 -0
  90. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/http.rs +0 -0
  91. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/backend/local.rs +0 -0
  92. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/args.rs +0 -0
  93. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/enc/tests.rs +0 -0
  94. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/enc.rs +0 -0
  95. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/harden.rs +0 -0
  96. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/keyring.rs +0 -0
  97. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/output.rs +0 -0
  98. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/tests.rs +0 -0
  99. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/transfer/tests.rs +0 -0
  100. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/transfer.rs +0 -0
  101. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/tree/tests.rs +0 -0
  102. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli/tree.rs +0 -0
  103. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/cli.rs +0 -0
  104. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/client/local_delete.rs +0 -0
  105. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/context.rs +0 -0
  106. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/fixtures.rs +0 -0
  107. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/frame.rs +0 -0
  108. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/fuzzing.rs +0 -0
  109. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/header.rs +0 -0
  110. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/keys/keyring/tests.rs +0 -0
  111. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/keys/keyring.rs +0 -0
  112. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/keys/mod.rs +0 -0
  113. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/keys/raw_aes.rs +0 -0
  114. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/mod.rs +0 -0
  115. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/suite.rs +0 -0
  116. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/encryption/tamper_tests.rs +0 -0
  117. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/forward.rs +0 -0
  118. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/fsmode.rs +0 -0
  119. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/action/tests/nav.rs +0 -0
  120. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/display.rs +0 -0
  121. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/view/startup_error.rs +0 -0
  122. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/view/status.rs +0 -0
  123. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/view/toolbar.rs +0 -0
  124. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/gui/view.rs +0 -0
  125. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/hex.rs +0 -0
  126. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/main.rs +0 -0
  127. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/python/client.rs +0 -0
  128. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/python/encryption.rs +0 -0
  129. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/python/mod.rs +0 -0
  130. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/python/stream.rs +0 -0
  131. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/sign.rs +0 -0
  132. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/text.rs +0 -0
  133. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/src/upload.rs +0 -0
  134. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional/aws_profile.rs +0 -0
  135. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional/cli.rs +0 -0
  136. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional/client.rs +0 -0
  137. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional/encryption.rs +0 -0
  138. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional/golden.rs +0 -0
  139. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional/sign.rs +0 -0
  140. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional/suite.rs +0 -0
  141. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/functional.rs +0 -0
  142. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/common/azurite.rs +0 -0
  143. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/common/gcs.rs +0 -0
  144. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/common/provider.rs +0 -0
  145. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/encryption.rs +0 -0
  146. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/file_roundtrip.rs +0 -0
  147. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/reencrypt.rs +0 -0
  148. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration/storage_ops.rs +0 -0
  149. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/integration.rs +0 -0
  150. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/perf_guards.rs +0 -0
  151. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/conftest.py +0 -0
  152. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_abort_at_exit.py +0 -0
  153. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_encrypted_client.py +0 -0
  154. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_encryption_runtime.py +0 -0
  155. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_free_threading.py +0 -0
  156. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_gil_contention.py +0 -0
  157. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_list_stream.py +0 -0
  158. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_pipe_native.py +0 -0
  159. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_plain_client.py +0 -0
  160. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_profile.py +0 -0
  161. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_roundtrip.py +0 -0
  162. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_shared_client.py +0 -0
  163. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_stream_leak.py +0 -0
  164. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_stream_sticky.py +0 -0
  165. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_stub_conformance.py +0 -0
  166. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_subinterpreter.py +0 -0
  167. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/python/test_worker_threads.py +0 -0
  168. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/support/mini_http.rs +0 -0
  169. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/support/mock.rs +0 -0
  170. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/support/mod.rs +0 -0
  171. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/README.md +0 -0
  172. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/ctx_long.bin +0 -0
  173. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/ctx_min.bin +0 -0
  174. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/ctx_utf8.bin +0 -0
  175. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/manifest.json +0 -0
  176. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p0_f4096.bin +0 -0
  177. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p0_f65536.bin +0 -0
  178. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p1_f4096.bin +0 -0
  179. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p1_f65536.bin +0 -0
  180. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p200000_f4096.bin +0 -0
  181. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p200000_f65536.bin +0 -0
  182. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p4095_f4096.bin +0 -0
  183. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p4095_f65536.bin +0 -0
  184. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p4096_f4096.bin +0 -0
  185. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p4096_f65536.bin +0 -0
  186. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p4097_f4096.bin +0 -0
  187. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p4097_f65536.bin +0 -0
  188. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p65535_f4096.bin +0 -0
  189. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p65535_f65536.bin +0 -0
  190. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p65536_f4096.bin +0 -0
  191. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p65536_f65536.bin +0 -0
  192. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p65537_f4096.bin +0 -0
  193. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/esdk/p65537_f65536.bin +0 -0
  194. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/README.md +0 -0
  195. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/context.bin +0 -0
  196. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/keyring +0 -0
  197. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/manifest.json +0 -0
  198. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/old_key.bin +0 -0
  199. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/size_0.bin +0 -0
  200. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/size_1.bin +0 -0
  201. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/size_200000.bin +0 -0
  202. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/golden/v1/size_65536.bin +0 -0
  203. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/keyrings/README.md +0 -0
  204. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/keyrings/one.keyring +0 -0
  205. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/keyrings/other.keyring +0 -0
  206. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/tests/vectors/keyrings/two.keyring +0 -0
  207. {object_storage_client-0.4.1 → object_storage_client-0.4.2}/uv.lock +0 -0
@@ -139,8 +139,9 @@ jobs:
139
139
  - run: cargo check --locked --no-default-features --features encryption --lib
140
140
  - run: cargo check --locked --no-default-features --features gui --bins
141
141
  # Keeps `encryption::fuzzing` and the fuzz targets compiling, against the
142
- # committed fuzz/Cargo.lock.
143
- - run: cargo check --locked --manifest-path fuzz/Cargo.toml --target-dir target
142
+ # committed fuzz/Cargo.lock. Not --locked: CI's cargo fails on a lock
143
+ # update instead of applying it.
144
+ - run: cargo check --manifest-path fuzz/Cargo.toml --target-dir target
144
145
 
145
146
  python:
146
147
  name: python tests (${{ matrix.python }})
@@ -1556,6 +1556,7 @@ dependencies = [
1556
1556
  "raw-window-handle",
1557
1557
  "smithay-clipboard",
1558
1558
  "web-time",
1559
+ "webbrowser",
1559
1560
  "windows-sys 0.61.2",
1560
1561
  "winit",
1561
1562
  ]
@@ -3345,7 +3346,7 @@ dependencies = [
3345
3346
 
3346
3347
  [[package]]
3347
3348
  name = "object-storage-client"
3348
- version = "0.4.1"
3349
+ version = "0.4.2"
3349
3350
  dependencies = [
3350
3351
  "alloc-counter",
3351
3352
  "async-trait",
@@ -3353,6 +3354,7 @@ dependencies = [
3353
3354
  "aws-credential-types",
3354
3355
  "aws-lc-rs",
3355
3356
  "aws-runtime",
3357
+ "aws-sdk-ssooidc",
3356
3358
  "aws-sigv4",
3357
3359
  "aws-smithy-runtime-api",
3358
3360
  "aws-smithy-types",
@@ -5503,6 +5505,22 @@ dependencies = [
5503
5505
  "wasm-bindgen",
5504
5506
  ]
5505
5507
 
5508
+ [[package]]
5509
+ name = "webbrowser"
5510
+ version = "1.2.6"
5511
+ source = "registry+https://github.com/rust-lang/crates.io-index"
5512
+ checksum = "fe8d20d0214027baf11b8b0cc307c1da7657d8f4db9aa956f7de27a6fb1acbd5"
5513
+ dependencies = [
5514
+ "jni",
5515
+ "log",
5516
+ "ndk-context",
5517
+ "objc2 0.6.5",
5518
+ "objc2-app-kit 0.3.2",
5519
+ "objc2-foundation 0.3.2",
5520
+ "url",
5521
+ "web-sys",
5522
+ ]
5523
+
5506
5524
  [[package]]
5507
5525
  name = "webpki-root-certs"
5508
5526
  version = "1.0.11"
@@ -9,7 +9,7 @@ license = "GPL-3.0-only"
9
9
  name = "object-storage-client"
10
10
  readme = "README.md"
11
11
  repository = "https://github.com/bixority/object-storage-client"
12
- version = "0.4.1"
12
+ version = "0.4.2"
13
13
 
14
14
  [lib]
15
15
  # maturin adds the cdylib crate type itself; do not list it here.
@@ -22,12 +22,13 @@ aws-config = { version = "1.13", default-features = false, features = ["rt-tokio
22
22
  aws-credential-types = "1.3"
23
23
  aws-lc-rs = { version = "1.19", default-features = false, features = ["aws-lc-sys", "prebuilt-nasm"] }
24
24
  aws-runtime = "1.10"
25
+ aws-sdk-ssooidc = { version = "1.121", default-features = false, optional = true }
25
26
  aws-sigv4 = { version = "1.6", default-features = false, features = ["sign-http", "http1"] }
26
27
  aws-types = "1.7"
27
28
  bytes = "1.12"
28
29
  chrono = "0.4"
29
30
  clap = { version = "4.6", features = ["derive", "env"], optional = true }
30
- eframe = { version = "0.37.0", default-features = false, features = ["glow", "default_fonts", "wayland", "clipboard"], optional = true }
31
+ eframe = { version = "0.37.0", default-features = false, features = ["glow", "default_fonts", "wayland", "clipboard", "links"], optional = true }
31
32
  egui_extras = { version = "0.37.0", default-features = false, optional = true }
32
33
  # Only for its bundled icon and emoji fonts (folder/file/arrow glyphs); eframe
33
34
  # brings everything else.
@@ -59,7 +60,7 @@ default = ["encryption", "cli"]
59
60
  cli = ["dep:clap", "dep:tokio-util", "tokio/signal", "tokio/io-std", "tokio/macros", "tokio/process", "encryption"]
60
61
  encryption = ["dep:zeroize"]
61
62
  # The `osc-gui` binary and its `gui` module (a two-pane desktop browser).
62
- gui = ["cli", "dep:eframe", "dep:egui", "dep:egui_extras"]
63
+ gui = ["cli", "dep:aws-sdk-ssooidc", "dep:eframe", "dep:egui", "dep:egui_extras"]
63
64
  # Exposes `encryption::fuzzing` harness entry points for the `fuzz/` crate.
64
65
  fuzzing = ["encryption"]
65
66
  python = ["dep:pyo3", "dep:pyo3-async-runtimes", "encryption"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: object-storage-client
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: 3
@@ -365,14 +365,14 @@ On Linux, `osc-gui` needs a Wayland session; X11 is not supported.
365
365
  ### Run
366
366
 
367
367
  ```bash
368
- osc-gui # both panels on the current directory
369
- osc-gui s3://my-bucket/photos/ ~/Pictures # left and right panel
370
- osc-gui --profile dev s3://my-bucket/ # credentials from the AWS profile "dev"
371
- osc-gui --keyring keyring s3://my-bucket/ . # copies encrypt and decrypt
368
+ osc-gui # both panels on Local, the current directory
369
+ osc-gui --keyring keyring # copies encrypt and decrypt
372
370
  ```
373
371
 
374
- Type any URL or path into a panel's address bar and press Enter. Buckets are not
375
- listed, so type the bucket's URL. The keys and shortcuts are listed in
372
+ Each panel has a connection selector for Local and the AWS profiles, gcloud
373
+ configurations and Azure storage accounts found on the machine; a cloud connection
374
+ lists its buckets. Type any matching URL or path into a panel's address bar and
375
+ press Enter. The keys and shortcuts are listed in
376
376
  [Desktop browser](docs/GUI.md), which also covers limits and closing behaviour.
377
377
 
378
378
  ## Documentation
@@ -345,14 +345,14 @@ On Linux, `osc-gui` needs a Wayland session; X11 is not supported.
345
345
  ### Run
346
346
 
347
347
  ```bash
348
- osc-gui # both panels on the current directory
349
- osc-gui s3://my-bucket/photos/ ~/Pictures # left and right panel
350
- osc-gui --profile dev s3://my-bucket/ # credentials from the AWS profile "dev"
351
- osc-gui --keyring keyring s3://my-bucket/ . # copies encrypt and decrypt
348
+ osc-gui # both panels on Local, the current directory
349
+ osc-gui --keyring keyring # copies encrypt and decrypt
352
350
  ```
353
351
 
354
- Type any URL or path into a panel's address bar and press Enter. Buckets are not
355
- listed, so type the bucket's URL. The keys and shortcuts are listed in
352
+ Each panel has a connection selector for Local and the AWS profiles, gcloud
353
+ configurations and Azure storage accounts found on the machine; a cloud connection
354
+ lists its buckets. Type any matching URL or path into a panel's address bar and
355
+ press Enter. The keys and shortcuts are listed in
356
356
  [Desktop browser](docs/GUI.md), which also covers limits and closing behaviour.
357
357
 
358
358
  ## Documentation
@@ -23,17 +23,17 @@ remotely. No extra system packages are needed.
23
23
  ## Launch
24
24
 
25
25
  ```bash
26
- osc-gui # both panels on the current directory
27
- osc-gui s3://my-bucket/photos/ ~/Pictures # left and right panel
28
- osc-gui --profile dev s3://my-bucket/ # credentials from the AWS profile "dev"
29
- osc-gui --keyring keyring s3://my-bucket/ . # copies encrypt and decrypt
26
+ osc-gui # both panels on Local, the current directory
27
+ osc-gui --keyring keyring # copies encrypt and decrypt
30
28
  ```
31
29
 
30
+ Both panels start on Local. The panels' connections are chosen in the app, not
31
+ on the command line.
32
+
32
33
  The options are the ones `osc` takes:
33
34
 
34
35
  | Option | Environment | Meaning |
35
36
  |------------------------|--------------------------|-----------------------------------------------------------|
36
- | `--profile NAME` | | AWS profile for `s3://` ([details](CONFIGURATION.md#aws-profiles-and-sso)) |
37
37
  | `--keyring FILE` | `OSC_KEYRING_FILE` | Keyring file; enables encryption |
38
38
  | | `OSC_KEYRING_COMMAND` | A command that prints the keyring (instead of a file) |
39
39
  | `--require-encryption` | `OSC_REQUIRE_ENCRYPTION` | Refuse to start without a key source |
@@ -42,15 +42,43 @@ Keys are loaded once, at launch. The toolbar shows whether encryption is on and
42
42
  where the keys came from. With encryption on, every copy and move encrypts
43
43
  what it writes and decrypts what it reads, as `osc cp` and `osc mv` do.
44
44
 
45
- If the keys or the profile cannot be loaded, `osc-gui` prints the error and
45
+ If the keys cannot be loaded, `osc-gui` prints the error and
46
46
  shows it in a small window, then exits with status 1.
47
47
 
48
48
  ## Using it
49
49
 
50
+ The selector at the left of each panel's address bar picks the panel's
51
+ connection. It lists Local and what `osc-gui` finds on this machine. It reads
52
+ local files and variables and never asks you to log in; for Azure it also asks
53
+ `az` for a token and lists the storage accounts of each subscription:
54
+
55
+ - AWS profiles from `~/.aws/config` and `~/.aws/credentials`, and the
56
+ `AWS_*` variables;
57
+ - gcloud configurations and Google application default credentials;
58
+ - Azure CLI subscriptions (the storage accounts of each are looked up through
59
+ Azure while the selector shows "Searching…") and the `AZURE_STORAGE_*`
60
+ variables.
61
+
62
+ Anything it could not use is listed under the connections as a small grey
63
+ note. "Rescan" searches again. A connection uses only its
64
+ own settings, so one panel can use another account than the other, and copies
65
+ between panels stream through the app.
66
+
50
67
  Type an address into a panel's address bar and press Enter: any URL `osc`
51
- accepts (`s3://`, `gs://`, `az://`, `http(s)://`, `file://`) or a local path.
52
- The address is always opened as a folder. Buckets are not listed: type the
53
- bucket's URL. Going up stops at the bucket root (or the file-system root).
68
+ accepts, or a local path. The scheme must match the panel's connection: Local
69
+ takes `file://`, `http(s)://` and paths, S3 `s3://`, GCS `gs://`, Azure `az://`
70
+ and its aliases; otherwise pick a matching connection. The address is always
71
+ opened as a folder. Selecting a cloud connection opens its root, which lists
72
+ the buckets (or containers) as folders; open one to browse it. Going up from a
73
+ bucket returns to that list. Copy, move, rename and delete are refused at the
74
+ list itself.
75
+
76
+ If a connection cannot authenticate, the error banner says so. For an AWS SSO
77
+ profile it has a "Log in" button: it shows a code, "Open browser" opens the
78
+ approval page, and the token is written to `~/.aws/sso/cache` like the AWS CLI
79
+ does, so both share it. For gcloud and Azure the banner shows the command to run
80
+ in a terminal (`gcloud auth application-default login`, `az login`); run it, then press
81
+ "Rescan" in the selector.
54
82
 
55
83
  | Key | Action |
56
84
  |-----------------------------------|------------------------------------------------|
@@ -127,7 +155,8 @@ and Shift-click select entries; double-click opens a folder.
127
155
  starts again at the first page; the other keeps its loaded pages, selection
128
156
  and cursor.
129
157
  - Sizes of encrypted objects are their stored sizes, as in `osc ls`.
130
- - Nothing is saved between runs: no settings, history or credentials.
158
+ - Nothing is saved between runs: no settings or history. The only file written
159
+ is the SSO token cache of a login, in `~/.aws/sso/cache`.
131
160
 
132
161
  ## Closing
133
162
 
@@ -1,5 +1,20 @@
1
1
  # Upgrading
2
2
 
3
+ ## From 0.4.1 to 0.5.0
4
+
5
+ ### `osc-gui`
6
+
7
+ - The `--profile`, `left` and `right` arguments are removed. Both panels start
8
+ on Local, the current directory. Pick a connection (an AWS profile, gcloud
9
+ configuration or Azure storage account) in the selector at the left of each
10
+ panel's address bar, then type the address. Scripts that passed those
11
+ arguments must drop them.
12
+ - Buckets are now listed: a cloud connection opens at its root, which shows the
13
+ buckets as folders. Typing a bucket's URL still works.
14
+ - The scheme of a typed address must match the panel's connection.
15
+ - "Log in" on an AWS SSO error banner writes `~/.aws/sso/cache`, like the AWS
16
+ CLI, so osc-gui now writes that one file.
17
+
3
18
  ## From 0.3.0 to 0.4.0
4
19
 
5
20
  This release contains breaking changes; read every section below before
@@ -73,7 +73,7 @@ const FALLBACK_STS_REGION: &str = "us-east-1";
73
73
  /// reads. An injected map reads only `AWS_CONFIG_FILE` and
74
74
  /// `AWS_SHARED_CREDENTIALS_FILE` from itself, and never the real `~/.aws`.
75
75
  pub fn files(vars: &Vars) -> Option<EnvConfigFiles> {
76
- let Vars::Map(_) = vars else {
76
+ let Vars::Map { .. } = vars else {
77
77
  return None;
78
78
  };
79
79
  // `build` panics on an empty set, so an empty config file is always present.
@@ -4,6 +4,8 @@ use super::{
4
4
  Backend, BucketClient, Shared, Transport, Vars, bucket_exists_from_response, create_failed,
5
5
  default_timeouts, error_body, ms_error_code, send_signed, send_with_retry,
6
6
  };
7
+ #[cfg(feature = "gui")]
8
+ use super::{collect_pages, encode, xml_listing_page};
7
9
  use crate::client::{Error, Result};
8
10
  use http::Method;
9
11
  use object_store::ClientConfigKey;
@@ -214,6 +216,30 @@ impl AzureBackend {
214
216
  self.signed_request(method, &uri, &account, &[]).await
215
217
  }
216
218
 
219
+ /// `List Containers` (`GET /?comp=list` on the account endpoint): the names
220
+ /// of all containers of the account, sorted, following `NextMarker`.
221
+ #[cfg(feature = "gui")]
222
+ pub async fn list_buckets(&self) -> Result<Vec<String>> {
223
+ collect_pages(|marker| async move {
224
+ let (account, endpoint) = self.account_and_endpoint()?;
225
+ let mut uri = format!("{}/?comp=list", endpoint.trim_end_matches('/'));
226
+ if let Some(marker) = marker {
227
+ uri = format!("{uri}&marker={}", encode(&marker));
228
+ }
229
+ let request = self
230
+ .signed_request(Method::GET, &uri, &account, &[])
231
+ .await?;
232
+ xml_listing_page(
233
+ self.http.get()?,
234
+ request,
235
+ "Azure List Containers",
236
+ "NextMarker",
237
+ )
238
+ .await
239
+ })
240
+ .await
241
+ }
242
+
217
243
  /// A blob-level request for `path`, built and authorized like
218
244
  /// [`container_request`](Self::container_request). The path is encoded as
219
245
  /// `object_store` encodes it.
@@ -505,7 +531,7 @@ impl Backend for AzureBackend {
505
531
  fn configured(container: &str, vars: &Vars) -> MicrosoftAzureBuilder {
506
532
  let mut builder = match vars {
507
533
  Vars::Env => MicrosoftAzureBuilder::from_env(),
508
- Vars::Map(_) => vars
534
+ Vars::Map { .. } => vars
509
535
  .config_entries::<AzureConfigKey>("AZURE_")
510
536
  .into_iter()
511
537
  .fold(MicrosoftAzureBuilder::new(), |b, (k, v)| {
@@ -770,6 +796,7 @@ mod tests {
770
796
  let path = ObjectPath::from_url_path(url.path()).expect("path");
771
797
  Resolved {
772
798
  backend: Arc::clone(&backend),
799
+ registry: 0,
773
800
  loc: Location { url, path },
774
801
  }
775
802
  };
@@ -1137,6 +1164,7 @@ mod tests {
1137
1164
  let path = ObjectPath::from_url_path(url.path()).expect("path");
1138
1165
  Resolved {
1139
1166
  backend: Arc::new(backend),
1167
+ registry: 0,
1140
1168
  loc: Location { url, path },
1141
1169
  }
1142
1170
  };
@@ -1247,4 +1275,67 @@ mod tests {
1247
1275
  assert!(!done.expect("refused"));
1248
1276
  assert!(stub.requests().is_empty());
1249
1277
  }
1278
+
1279
+ #[cfg(feature = "gui")]
1280
+ mod list_buckets {
1281
+ use super::*;
1282
+ use crate::backend::stub::Request;
1283
+
1284
+ fn page(names: &[&str], marker: &str) -> Reply {
1285
+ let containers = names
1286
+ .iter()
1287
+ .map(|n| format!("<Container><Name>{n}</Name><Properties /></Container>"))
1288
+ .collect::<Vec<_>>()
1289
+ .concat();
1290
+ let marker = if marker.is_empty() {
1291
+ "<NextMarker />".to_owned()
1292
+ } else {
1293
+ format!("<NextMarker>{marker}</NextMarker>")
1294
+ };
1295
+ Reply::new(
1296
+ 200,
1297
+ format!(
1298
+ "\u{feff}<?xml version=\"1.0\"?><EnumerationResults ServiceEndpoint=\"e\">\
1299
+ <Prefix /><Containers>{containers}</Containers>{marker}</EnumerationResults>"
1300
+ ),
1301
+ )
1302
+ }
1303
+
1304
+ async fn list(replies: Vec<Reply>) -> (Result<Vec<String>>, Vec<Request>) {
1305
+ let stub = serve(replies).await;
1306
+ let endpoint = format!("{}/acct", stub.base);
1307
+ let result = backend(&[
1308
+ ("AZURE_STORAGE_ACCOUNT_NAME", "acct"),
1309
+ ("AZURE_STORAGE_ACCOUNT_KEY", "a2V5"),
1310
+ ("AZURE_STORAGE_ENDPOINT", &endpoint),
1311
+ ("AZURE_ALLOW_HTTP", "true"),
1312
+ ])
1313
+ .list_buckets()
1314
+ .await;
1315
+ (result, stub.requests())
1316
+ }
1317
+
1318
+ #[tokio::test]
1319
+ async fn pages_are_followed_and_the_names_sorted() {
1320
+ let (names, requests) = list(vec![
1321
+ page(&["zeta", "alpha"], "1!8!Zm9v/+=="),
1322
+ page(&["mid"], ""),
1323
+ ])
1324
+ .await;
1325
+ assert_eq!(names.expect("list"), ["alpha", "mid", "zeta"]);
1326
+ assert_eq!(requests[0].line, "GET /acct/?comp=list HTTP/1.1");
1327
+ assert_eq!(
1328
+ requests[1].line,
1329
+ "GET /acct/?comp=list&marker=1%218%21Zm9v%2F%2B%3D%3D HTTP/1.1"
1330
+ );
1331
+ assert!(
1332
+ requests[0]
1333
+ .headers
1334
+ .to_ascii_lowercase()
1335
+ .contains("authorization: sharedkey acct:"),
1336
+ "{}",
1337
+ requests[0].headers
1338
+ );
1339
+ }
1340
+ }
1250
1341
  }
@@ -183,7 +183,13 @@ impl Transport {
183
183
  proxy_ca_certificate: get(ClientConfigKey::ProxyCaCertificate),
184
184
  proxy_excludes: get(ClientConfigKey::ProxyExcludes),
185
185
  user_agent: get(ClientConfigKey::UserAgent),
186
- no_system_proxy: matches!(vars, Vars::Map(_)),
186
+ no_system_proxy: matches!(
187
+ vars,
188
+ Vars::Map {
189
+ system_proxy: false,
190
+ ..
191
+ }
192
+ ),
187
193
  }
188
194
  }
189
195
 
@@ -236,6 +242,23 @@ impl Transport {
236
242
  }
237
243
  }
238
244
 
245
+ /// A client for the crate's own HTTP calls outside a store (the GUI's Azure
246
+ /// account lookup), with the bucket-call settings: the system proxy and
247
+ /// certificates apply, timeouts are bounded and redirects are not followed.
248
+ /// Plain `http` is refused unless `allow_http` (a test seam).
249
+ ///
250
+ /// # Errors
251
+ ///
252
+ /// Returns [`Error::Generic`] if the client cannot be built.
253
+ #[cfg(feature = "gui")]
254
+ pub fn http_client(allow_http: bool) -> crate::client::Result<reqwest::Client> {
255
+ Transport {
256
+ allow_http,
257
+ ..Transport::default()
258
+ }
259
+ .client()
260
+ }
261
+
239
262
  /// A store's own client for its bucket calls (`create_bucket`,
240
263
  /// `bucket_exists`), built from the store's [`Transport`] on first use.
241
264
  pub struct BucketClient {
@@ -648,6 +671,16 @@ mod tests {
648
671
  assert!(!Transport::read(|_| None, &Vars::Env).no_system_proxy);
649
672
  }
650
673
 
674
+ #[test]
675
+ fn an_isolated_map_honours_the_system_proxy() {
676
+ let vars = Vars::Map {
677
+ vars: Arc::default(),
678
+ system_proxy: true,
679
+ };
680
+ assert!(!Transport::read(|_| None, &vars).no_system_proxy);
681
+ assert!(Transport::read(|_| None, &Vars::map(HashMap::new())).no_system_proxy);
682
+ }
683
+
651
684
  #[tokio::test]
652
685
  async fn the_proxy_setting_reaches_the_bucket_client() {
653
686
  use crate::backend::stub::{Reply, serve};
@@ -704,6 +737,18 @@ mod tests {
704
737
  assert!(err.is_builder(), "{err}");
705
738
  }
706
739
 
740
+ #[cfg(feature = "gui")]
741
+ #[tokio::test]
742
+ async fn the_http_client_refuses_plain_http_unless_allowed() {
743
+ let err = http_client(false)
744
+ .expect("client")
745
+ .get("http://127.0.0.1:9/")
746
+ .send()
747
+ .await
748
+ .expect_err("https only");
749
+ assert!(err.is_builder(), "{err}");
750
+ }
751
+
707
752
  #[tokio::test]
708
753
  async fn the_bucket_client_does_not_follow_redirects() {
709
754
  use crate::backend::stub::{Reply, serve};
@@ -2,8 +2,10 @@
2
2
 
3
3
  use super::{
4
4
  Backend, BucketClient, Shared, Transport, Vars, bucket_exists_from_response, create_failed,
5
- default_timeouts, error_body, request_failed, send_with_retry,
5
+ default_timeouts, encode, error_body, request_failed, send_with_retry,
6
6
  };
7
+ #[cfg(feature = "gui")]
8
+ use super::{collect_pages, read_listing};
7
9
  use crate::client::{Error, Result};
8
10
  use crate::sign::{SignMethod, SignOptions};
9
11
  use bytes::Bytes;
@@ -117,16 +119,60 @@ impl GcsBackend {
117
119
 
118
120
  /// `buckets.get` (`GET /storage/v1/b/<bucket>`) with the bearer token.
119
121
  async fn get_bucket(&self, bearer: &str) -> Result<reqwest::Response> {
120
- let encoded_bucket: String =
121
- percent_encoding::utf8_percent_encode(&self.bucket, percent_encoding::NON_ALPHANUMERIC)
122
- .collect();
123
- let uri = format!("{}/storage/v1/b/{encoded_bucket}", self.base_url);
122
+ let uri = format!("{}/storage/v1/b/{}", self.base_url, encode(&self.bucket));
124
123
  with_bearer(self.http.get()?.get(uri), &self.base_url, bearer)
125
124
  .send()
126
125
  .await
127
126
  .map_err(|e| request_failed("GCS buckets.get request", e))
128
127
  }
129
128
 
129
+ /// `buckets.list` for the project: the names of all its buckets, sorted,
130
+ /// following `nextPageToken`.
131
+ #[cfg(feature = "gui")]
132
+ pub async fn list_buckets(&self) -> Result<Vec<String>> {
133
+ let project = self.project.as_deref().ok_or_else(|| {
134
+ Error::Generic(
135
+ "listing GCS buckets requires GOOGLE_CLOUD_PROJECT (or GCS_PROJECT_ID); \
136
+ a bucket can still be opened by its URL, gs://bucket"
137
+ .into(),
138
+ )
139
+ })?;
140
+ let bearer = self.bearer().await?;
141
+ collect_pages(|token| {
142
+ let (bearer, project) = (&bearer, project);
143
+ async move {
144
+ let mut uri = format!(
145
+ "{}/storage/v1/b?project={}&fields=items/name,nextPageToken",
146
+ self.base_url,
147
+ encode(project)
148
+ );
149
+ if let Some(token) = token {
150
+ uri = format!("{uri}&pageToken={}", encode(&token));
151
+ }
152
+ let response = with_bearer(self.http.get()?.get(uri), &self.base_url, bearer)
153
+ .send()
154
+ .await
155
+ .map_err(|e| request_failed("GCS buckets.list request", e))?;
156
+ let body = read_listing(response, "GCS buckets.list").await?;
157
+ let page: serde_json::Value = serde_json::from_slice(&body).map_err(|_| {
158
+ Error::Generic("GCS buckets.list answered a document that is not JSON".into())
159
+ })?;
160
+ let names = page["items"]
161
+ .as_array()
162
+ .into_iter()
163
+ .flatten()
164
+ .filter_map(|item| item["name"].as_str().map(str::to_owned))
165
+ .collect();
166
+ let next = page["nextPageToken"]
167
+ .as_str()
168
+ .filter(|t| !t.is_empty())
169
+ .map(str::to_owned);
170
+ Ok((names, next))
171
+ }
172
+ })
173
+ .await
174
+ }
175
+
130
176
  /// `source` as the backend an `objects.rewrite` into this bucket may read
131
177
  /// from, or `None` when it must stream. Both sides must sign, with the very
132
178
  /// same credential providers, against the same JSON API origin.
@@ -146,9 +192,6 @@ impl GcsBackend {
146
192
  /// is the first item when it is in the project. Anything else, a failed
147
193
  /// answer included, is an error.
148
194
  async fn check_owned(&self, bearer: &str, project: &str) -> Result<()> {
149
- let encode = |s: &str| -> String {
150
- percent_encoding::utf8_percent_encode(s, percent_encoding::NON_ALPHANUMERIC).collect()
151
- };
152
195
  let uri = format!(
153
196
  "{}/storage/v1/b?project={}&prefix={}&maxResults=1&fields=items/name",
154
197
  self.base_url,
@@ -185,12 +228,6 @@ impl GcsBackend {
185
228
  /// destination object, because GCS creates it only when the rewrite is done.
186
229
  const REWRITE_CALLS_MAX: usize = 1000;
187
230
 
188
- /// `text` as one path segment or query value: everything but unreserved
189
- /// characters is percent-encoded.
190
- fn encode(text: &str) -> String {
191
- percent_encoding::utf8_percent_encode(text, percent_encoding::NON_ALPHANUMERIC).to_string()
192
- }
193
-
194
231
  /// The most of a `buckets.list` answer that is read. A longer one is cut and
195
232
  /// then fails to parse. The request asks for one item, so a real answer is
196
233
  /// small; an emulator that ignores `maxResults` may send more.
@@ -215,7 +252,7 @@ const DEFAULT_BASE_URL: &str = "https://storage.googleapis.com";
215
252
  fn configured(bucket: &str, vars: &Vars) -> GoogleCloudStorageBuilder {
216
253
  let mut builder = match vars {
217
254
  Vars::Env => GoogleCloudStorageBuilder::from_env(),
218
- Vars::Map(_) => vars
255
+ Vars::Map { .. } => vars
219
256
  .config_entries::<GoogleConfigKey>("GOOGLE_")
220
257
  .into_iter()
221
258
  .fold(GoogleCloudStorageBuilder::new(), |b, (k, v)| {
@@ -292,10 +329,7 @@ impl Backend for GcsBackend {
292
329
 
293
330
  let bearer = self.bearer().await?;
294
331
  let body = Bytes::from(format!("{{\"name\":\"{}\"}}", self.bucket));
295
- let encoded_project: String =
296
- percent_encoding::utf8_percent_encode(project, percent_encoding::NON_ALPHANUMERIC)
297
- .collect();
298
- let uri = format!("{}/storage/v1/b?project={encoded_project}", self.base_url);
332
+ let uri = format!("{}/storage/v1/b?project={}", self.base_url, encode(project));
299
333
 
300
334
  let request = self
301
335
  .http
@@ -951,4 +985,64 @@ mod tests {
951
985
  assert!(result.is_err());
952
986
  assert_eq!(requests.len(), 3);
953
987
  }
988
+
989
+ #[cfg(feature = "gui")]
990
+ mod list_buckets {
991
+ use super::*;
992
+
993
+ fn backend(base: &str, extra: &[(&str, &str)]) -> GcsBackend {
994
+ let mut pairs = vec![("GCS_BASE_URL", base), ("GOOGLE_BEARER_TOKEN", "tok")];
995
+ pairs.extend_from_slice(extra);
996
+ GcsBackend::new("gs", Some("bkt"), &Vars::from_pairs(&pairs)).expect("build")
997
+ }
998
+
999
+ async fn list(replies: Vec<Reply>) -> (Result<Vec<String>>, Vec<Request>) {
1000
+ let stub = serve(replies).await;
1001
+ let result = backend(&stub.base, &[("GOOGLE_CLOUD_PROJECT", "my proj")])
1002
+ .list_buckets()
1003
+ .await;
1004
+ (result, stub.requests())
1005
+ }
1006
+
1007
+ #[tokio::test]
1008
+ async fn pages_are_followed_and_the_names_sorted() {
1009
+ let (names, requests) = list(vec![
1010
+ Reply::new(
1011
+ 200,
1012
+ r#"{"items":[{"name":"zeta"},{"name":"al\u0026pha"}],"nextPageToken":"p/1"}"#,
1013
+ ),
1014
+ Reply::new(200, "{\"items\":[{\"name\":\"mid\"}]}\n"),
1015
+ ])
1016
+ .await;
1017
+ assert_eq!(names.expect("list"), ["al&pha", "mid", "zeta"]);
1018
+ let query = "fields=items/name,nextPageToken";
1019
+ assert_eq!(
1020
+ requests[0].line,
1021
+ format!("GET /storage/v1/b?project=my%20proj&{query} HTTP/1.1")
1022
+ );
1023
+ assert_eq!(
1024
+ requests[1].line,
1025
+ format!("GET /storage/v1/b?project=my%20proj&{query}&pageToken=p%2F1 HTTP/1.1")
1026
+ );
1027
+ }
1028
+
1029
+ #[tokio::test]
1030
+ async fn no_buckets_is_an_empty_list() {
1031
+ for body in ["{}", r#"{"items":[]}"#] {
1032
+ let (names, _) = list(vec![Reply::new(200, body)]).await;
1033
+ assert!(names.expect("list").is_empty(), "{body}");
1034
+ }
1035
+ }
1036
+
1037
+ #[tokio::test]
1038
+ async fn without_a_project_no_request_is_sent() {
1039
+ let stub = serve(vec![]).await;
1040
+ let err = backend(&stub.base, &[])
1041
+ .list_buckets()
1042
+ .await
1043
+ .expect_err("no project");
1044
+ assert!(err.to_string().contains("GOOGLE_CLOUD_PROJECT"), "{err}");
1045
+ assert!(stub.requests().is_empty());
1046
+ }
1047
+ }
954
1048
  }