Skip to content

Commit 8d10752

Browse files
committed
docs: configuration options
1 parent 2dfd972 commit 8d10752

File tree

5 files changed

+101
-45
lines changed

5 files changed

+101
-45
lines changed

Cargo.lock

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
[workspace]
22
members = ["object-store"]
3+
4+
[patch.crates-io]
5+
object_store = { git = "https://github.com/roeap/arrow-rs/", rev = "6b7b34e7953a8aabd4d1b7cb068e3d61e27aed4a", features = [
6+
"azure",
7+
"aws",
8+
"gcp",
9+
"aws_profile",
10+
] }

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ assert copied == data
6767
### Configuration
6868

6969
As much as possible we aim to make access to various storage backends dependent
70-
only on runtime configuration.
70+
only on runtime configuration. The kind of service is always derived from the
71+
url used to specifiy the storage location. Some basic configuration can also be
72+
derived from the url string, dependent on the chosen url format.
7173

7274
```py
7375
from object_store import ObjectStore
@@ -96,6 +98,57 @@ os.environ["AZURE_TENANT_ID"] = "<my-tenant-id>"
9698
store = ObjectStore("az://<container-name>")
9799
```
98100

101+
#### Azure
102+
103+
The recommended url format is `az://<container>/<path>` and Azure always requieres
104+
`azure_storage_account_name` to be configured.
105+
106+
- master key
107+
- `azure_storage_account_key`
108+
- service principal
109+
- `azure_client_id`
110+
- `azure_client_secret`
111+
- `azure_tenant_id`
112+
- shared access signature
113+
- `azure_storage_sas_key` (as provided by StorageExplorer)
114+
- bearer token
115+
- `azure_storage_token`
116+
- managed identity (with user assigned identity)
117+
- if using user assigned identity one of `azure_client_id`, `azure_object_id`, `azure_msi_resource_id`
118+
- `use_managed_identity`
119+
- workload identity
120+
- `azure_client_id`
121+
- `azure_tenant_id`
122+
- `azure_federated_token_file`
123+
124+
#### S3
125+
126+
The recommended url format is `s3://<bucket>/<path>` S3 storage always requires a
127+
region to be specified via one of `aws_region` or `aws_default_region`.
128+
129+
- access key
130+
- `aws_access_key_id`
131+
- `aws_secret_access_key`
132+
- session token
133+
- `aws_session_token`
134+
- imds instance metadata
135+
- `aws_metadata_endpoint`
136+
- profile
137+
- `aws_profile`
138+
139+
AWS supports [virtual hosting of buckets][aws-virtual], which can be configured by setting
140+
`aws_virtual_hosted_style_request` to "true".
141+
142+
When an alternative implementation or a mocked service like localstack is used, the service
143+
endpoint needs to be explicitly specified via `aws_endpoint`.
144+
145+
#### GCS
146+
147+
The recommended url format is `gs://<bucket>/<path>`.
148+
149+
- service account
150+
- `google_service_account`
151+
99152
### with `pyarrow`
100153

101154
```py
@@ -154,3 +207,4 @@ just test
154207
[ci-link]: https://github.com/roeap/object-store-python/actions/workflows/ci.yaml
155208
[black-img]: https://img.shields.io/badge/code%20style-black-000000.svg
156209
[black-link]: https://github.com/psf/black
210+
[aws-virtual]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html

object-store/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ classifiers = [
1717
"Programming Language :: Python :: 3.9",
1818
"Programming Language :: Python :: 3.10",
1919
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Rust",
2021
"Intended Audience :: Developers",
2122
"License :: OSI Approved :: Apache Software License",
2223
]

object-store/src/builder.rs

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -160,61 +160,55 @@ impl ObjectStoreBuilder {
160160
ObjectStoreKind::Local => ObjectStoreImpl::Local(LocalFileSystem::new()),
161161
ObjectStoreKind::InMemory => ObjectStoreImpl::InMemory(InMemory::new()),
162162
ObjectStoreKind::Azure => {
163-
let maybe_store = MicrosoftAzureBuilder::new()
163+
let store = MicrosoftAzureBuilder::new()
164164
.with_url(url.clone())
165165
.try_with_options(&self.options)?
166166
.with_client_options(self.client_options.clone().unwrap_or_default())
167167
.with_retry(self.retry_config.clone().unwrap_or_default())
168-
.build();
169-
if let Ok(store) = maybe_store {
170-
ObjectStoreImpl::Azrue(store)
171-
} else {
172-
let store = MicrosoftAzureBuilder::from_env()
173-
.with_url(url.clone())
174-
.try_with_options(&self.options)?
175-
.with_client_options(self.client_options.unwrap_or_default())
176-
.with_retry(self.retry_config.unwrap_or_default())
177-
.build()?;
178-
ObjectStoreImpl::Azrue(store)
179-
}
168+
.build()
169+
.or_else(|_| {
170+
MicrosoftAzureBuilder::from_env()
171+
.with_url(url.clone())
172+
.try_with_options(&self.options)?
173+
.with_client_options(self.client_options.clone().unwrap_or_default())
174+
.with_retry(self.retry_config.clone().unwrap_or_default())
175+
.build()
176+
})?;
177+
ObjectStoreImpl::Azrue(store)
180178
}
181179
ObjectStoreKind::S3 => {
182-
let maybe_store = AmazonS3Builder::new()
180+
let store = AmazonS3Builder::new()
183181
.with_url(url.clone())
184182
.try_with_options(&self.options)?
185183
.with_client_options(self.client_options.clone().unwrap_or_default())
186184
.with_retry(self.retry_config.clone().unwrap_or_default())
187-
.build();
188-
if let Ok(store) = maybe_store {
189-
ObjectStoreImpl::S3(store)
190-
} else {
191-
let store = AmazonS3Builder::from_env()
192-
.with_url(url.clone())
193-
.try_with_options(&self.options)?
194-
.with_client_options(self.client_options.unwrap_or_default())
195-
.with_retry(self.retry_config.unwrap_or_default())
196-
.build()?;
197-
ObjectStoreImpl::S3(store)
198-
}
185+
.build()
186+
.or_else(|_| {
187+
AmazonS3Builder::from_env()
188+
.with_url(url.clone())
189+
.try_with_options(&self.options)?
190+
.with_client_options(self.client_options.unwrap_or_default())
191+
.with_retry(self.retry_config.unwrap_or_default())
192+
.build()
193+
})?;
194+
ObjectStoreImpl::S3(store)
199195
}
200196
ObjectStoreKind::Google => {
201-
let maybe_store = GoogleCloudStorageBuilder::new()
197+
let store = GoogleCloudStorageBuilder::new()
202198
.with_url(url.clone())
203199
.try_with_options(&self.options)?
204200
.with_client_options(self.client_options.clone().unwrap_or_default())
205201
.with_retry(self.retry_config.clone().unwrap_or_default())
206-
.build();
207-
if let Ok(store) = maybe_store {
208-
ObjectStoreImpl::Gcp(store)
209-
} else {
210-
let store = GoogleCloudStorageBuilder::from_env()
211-
.with_url(url.clone())
212-
.try_with_options(&self.options)?
213-
.with_client_options(self.client_options.unwrap_or_default())
214-
.with_retry(self.retry_config.unwrap_or_default())
215-
.build()?;
216-
ObjectStoreImpl::Gcp(store)
217-
}
202+
.build()
203+
.or_else(|_| {
204+
GoogleCloudStorageBuilder::from_env()
205+
.with_url(url.clone())
206+
.try_with_options(&self.options)?
207+
.with_client_options(self.client_options.unwrap_or_default())
208+
.with_retry(self.retry_config.unwrap_or_default())
209+
.build()
210+
})?;
211+
ObjectStoreImpl::Gcp(store)
218212
}
219213
};
220214

0 commit comments

Comments
 (0)