Skip to content

Commit b4e8d97

Browse files
authored
Fix azure storage config names (#340)
1 parent 04118ab commit b4e8d97

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

obstore/python/obstore/store/_azure.pyi

+12-12
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ class AzureConfig(TypedDict, total=False):
2020
```
2121
"""
2222

23-
storage_account_name: str
23+
account_name: str
2424
"""The name of the azure storage account. (Required.)
2525
2626
**Environment variable**: `AZURE_STORAGE_ACCOUNT_NAME`.
2727
"""
28-
storage_account_key: str
28+
account_key: str
2929
"""Master key for accessing storage account.
3030
3131
**Environment variables**:
@@ -34,23 +34,23 @@ class AzureConfig(TypedDict, total=False):
3434
- `AZURE_STORAGE_ACCESS_KEY`
3535
- `AZURE_STORAGE_MASTER_KEY`
3636
"""
37-
storage_client_id: str
37+
client_id: str
3838
"""The client id for use in client secret or k8s federated credential flow.
3939
4040
**Environment variables**:
4141
4242
- `AZURE_STORAGE_CLIENT_ID`
4343
- `AZURE_CLIENT_ID`
4444
"""
45-
storage_client_secret: str
45+
client_secret: str
4646
"""The client secret for use in client secret flow.
4747
4848
**Environment variables**:
4949
5050
- `AZURE_STORAGE_CLIENT_SECRET`
5151
- `AZURE_CLIENT_SECRET`
5252
"""
53-
storage_tenant_id: str
53+
tenant_id: str
5454
"""The tenant id for use in client secret or k8s federated credential flow.
5555
5656
**Environment variables**:
@@ -60,7 +60,7 @@ class AzureConfig(TypedDict, total=False):
6060
- `AZURE_TENANT_ID`
6161
- `AZURE_AUTHORITY_ID`
6262
"""
63-
storage_authority_host: str
63+
authority_host: str
6464
"""Sets an alternative authority host for OAuth based authorization.
6565
6666
Defaults to `https://login.microsoftonline.com`.
@@ -77,7 +77,7 @@ class AzureConfig(TypedDict, total=False):
7777
- `AZURE_STORAGE_AUTHORITY_HOST`
7878
- `AZURE_AUTHORITY_HOST`
7979
"""
80-
storage_sas_key: str
80+
sas_key: str
8181
"""
8282
Shared access signature.
8383
@@ -89,12 +89,12 @@ class AzureConfig(TypedDict, total=False):
8989
- `AZURE_STORAGE_SAS_KEY`
9090
- `AZURE_STORAGE_SAS_TOKEN`
9191
"""
92-
storage_token: str
92+
token: str
9393
"""A static bearer token to be used for authorizing requests.
9494
9595
**Environment variable**: `AZURE_STORAGE_TOKEN`.
9696
"""
97-
storage_use_emulator: bool
97+
use_emulator: bool
9898
"""Set if the Azure emulator should be used (defaults to `False`).
9999
100100
**Environment variable**: `AZURE_STORAGE_USE_EMULATOR`.
@@ -107,9 +107,9 @@ class AzureConfig(TypedDict, total=False):
107107
108108
!!! note
109109
110-
`storage_endpoint` will take precedence over this option.
110+
`endpoint` will take precedence over this option.
111111
"""
112-
storage_endpoint: str
112+
endpoint: str
113113
"""Override the endpoint used to communicate with blob storage.
114114
115115
Defaults to `https://{account}.blob.core.windows.net`.
@@ -143,7 +143,7 @@ class AzureConfig(TypedDict, total=False):
143143
federated_token_file: str
144144
"""Sets a file path for acquiring azure federated identity token in k8s.
145145
146-
Requires `storage_client_id` and `storage_tenant_id` to be set.
146+
Requires `client_id` and `tenant_id` to be set.
147147
148148
**Environment variable**: `AZURE_FEDERATED_TOKEN_FILE`.
149149
"""

pyo3-object_store/src/azure/store.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,16 @@ impl<'py> IntoPyObject<'py> for PyAzureConfigKey {
214214
type Error = PyErr;
215215

216216
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
217-
let s = self
218-
.0
219-
.as_ref()
220-
.strip_prefix("azure_")
221-
.expect("Expected config prefix to start with azure_");
222-
Ok(PyString::new(py, s))
217+
let s = self.0.as_ref();
218+
// Anything with an `azure_storage_` prefix we can fully strip
219+
if let Some(stripped) = s.strip_prefix("azure_storage_") {
220+
return Ok(PyString::new(py, stripped));
221+
}
222+
Ok(PyString::new(
223+
py,
224+
s.strip_prefix("azure_")
225+
.expect("Expected config prefix to start with azure_"),
226+
))
223227
}
224228
}
225229

0 commit comments

Comments
 (0)