Repository navigation
v2.1.0 adds time-limited, resource-scoped storage capability tokens to the FLAME Hub Python Client. These notes cover the changes since v2.0.0.
👀 Highlights
🔑 Request storage tokens with explicit permissions
You can now call CoreClient.mint_storage_cap_token() to request storage access for an analysis, choosing the resources, permitted actions and token lifetime. This lets you request a token scoped to specific storage operations, such as writing to an analysis result bucket.
The new public models in flame_hub.models describe the request and response:
StorageCapability: abucketorbucket_fileresource, its ID, and a list ofread,writeordeleteactions.StorageCapabilityTokenRequest: the capabilities and requested lifetime.StorageCapabilityToken: the returnedtokenandexpires_attimestamp.
For example, adapted from the release's integration test, request write access to an existing analysis result bucket:
from flame_hub.models import StorageCapability, StorageCapabilityTokenRequest
# Use your configured CoreClient, existing analysis and result bucket,
# and ClientAuth for a node associated with that analysis.
token = core_client.mint_storage_cap_token(
analysis_id=analysis.id,
capability_request=StorageCapabilityTokenRequest(
capabilities=[
StorageCapability(
resource_type="bucket",
resource_id=analysis_result_bucket.bucket_id,
actions=["write"],
),
],
lifetime=60,
),
auth=node_client_auth,
)
print(token.expires_at)Note
Token issuance uses the Hub core API's analysis storage-token endpoint. The integration test authenticates as a node associated with the analysis; the client does not grant permissions independently of the Hub.
⬆️ Upgrading
python -m pip install --upgrade flame-hub-client==2.1.0Python support remains >=3.10,<4.