Backblaze / b2-sdk-python

Python library to access B2 cloud storage.
Other
181 stars 61 forks source link

Add models for corsRules and lifecycleRules instead of dicts #188

Open mlech-reef opened 3 years ago

mlech-reef commented 3 years ago

The models should have client-side data validation - https://github.com/samuelcolvin/pydantic can be simply used for that

mpnowacki-reef commented 3 years ago

After some discussion, this should be moved to https://github.com/Backblaze/b2-sdk-python/milestone/2

mjurbanski-reef commented 11 months ago

LifecycleRules are now annotated as typed dicts. Runtime validation of this is available in CLI when optional dependencies are installed, namely, pydantic v2.

We are open to PRs adding similar type annotation for corsRules.

colans commented 1 week ago

Will this in any way help with https://github.com/Backblaze/terraform-provider-b2/issues/85 as mentioned in https://github.com/Backblaze/terraform-provider-b2/issues/3 ?

mlech-reef commented 1 week ago

@colans this ticket is just about validating fileNamePrefix in the SDK (on the client side) without sending a request to the server if the payload is wrong. That parameter will be still explicitly required to contain an empty string as documented here - https://www.backblaze.com/docs/cloud-storage-lifecycle-rules - if you want to apply the rules to all the files in the bucket.