Add global quotas and quota usage support for OBJ services#661
Add global quotas and quota usage support for OBJ services#661zliang-akamai wants to merge 6 commits intolinode:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds client-side support for Object Storage global (account-level) quotas and enriches existing Object Storage quota models with quota type and usage support metadata, along with corresponding unit/integration tests and fixtures.
Changes:
- Add
ObjectStorageGlobalQuotamodel with ausage()helper for global quota usage retrieval. - Expose
quota_typeandhas_usageproperties onObjectStorageQuota, and addObjectStorageGroup.global_quotas()for listing global quotas. - Extend unit/integration tests and fixtures to cover global quotas and the new quota fields.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
linode_api4/objects/object_storage.py |
Adds quota_type/has_usage to ObjectStorageQuota and introduces ObjectStorageGlobalQuota model + usage call. |
linode_api4/groups/object_storage.py |
Adds ObjectStorageGroup.global_quotas() collection method. |
test/unit/objects/object_storage_test.py |
Adds unit coverage for new quota fields and global quota get/list/usage flows. |
test/integration/models/object_storage/test_obj_quotas.py |
Extends integration coverage for quota_type/has_usage and adds global quota tests and 404 handling cases. |
test/fixtures/object-storage_quotas_obj-objects-us-ord-1.json |
Updates quota fixture to include quota_type and has_usage. |
test/fixtures/object-storage_quotas.json |
Updates quotas list fixture to include quota_type and has_usage. |
test/fixtures/object-storage_global-quotas.json |
Adds fixture for global quotas list endpoint. |
test/fixtures/object-storage_global-quotas_obj-access-keys-per-account.json |
Adds fixture for a single global quota GET endpoint. |
test/fixtures/object-storage_global-quotas_obj-access-keys-per-account_usage.json |
Adds fixture for global quota usage endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
09101ee to
daab10f
Compare
| quotas = test_linode_client.object_storage.quotas() | ||
|
|
||
| if len(quotas) < 1: | ||
| pytest.skip("No available quota for testing. Skipping now...") |
There was a problem hiding this comment.
Maybe keep it verbose, so we would know when it's skipped. I think most account will be with a quota, so this branch is very unlikely to be triggered.
There was a problem hiding this comment.
@zliang-akamai this test (and the others too) will fail when Object Storage is disabled in the account settings, i.e. test_linode_client.object_storage.quotas() will return error 404 Not found and pytest.skip will never be reached. I agree that this kind of cases will be rare but should we handle them anyway somehow?
📝 Description
Add support for OBJ quota and global quota udpates.
✔️ How to Test