Repository navigation
feat(storage): add enterprise storage classes to Bucket and Blob STORAGE_CLASSES tuples #18951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -650,9 +650,12 @@ class Bucket(_PropertyMixin): | |||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| STORAGE_CLASSES = ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| STANDARD_STORAGE_CLASS, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "STANDARD_ENTERPRISE", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "STANDARD_FLEXBACKUP_ENTERPRISE", | ||||||||||||||||||||||||||||||||||||||||||||||||
| NEARLINE_STORAGE_CLASS, | ||||||||||||||||||||||||||||||||||||||||||||||||
| COLDLINE_STORAGE_CLASS, | ||||||||||||||||||||||||||||||||||||||||||||||||
| ARCHIVE_STORAGE_CLASS, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "LR_STANDARD_ENTERPRISE", | ||||||||||||||||||||||||||||||||||||||||||||||||
| MULTI_REGIONAL_LEGACY_STORAGE_CLASS, # legacy | ||||||||||||||||||||||||||||||||||||||||||||||||
| REGIONAL_LEGACY_STORAGE_CLASS, # legacy | ||||||||||||||||||||||||||||||||||||||||||||||||
| DURABLE_REDUCED_AVAILABILITY_LEGACY_STORAGE_CLASS, # legacy | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
651
to
661
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To maintain consistency and avoid magic strings, the new enterprise storage classes should be defined as constants in
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6788,6 +6788,25 @@ def test_w_existing_qs(self): | |
| self.assertEqual(self._call_fut(BASE_URL, NV_LIST), f"{BASE_URL}&{expected}") | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "storage_class", | ||
| [ | ||
| "STANDARD_ENTERPRISE", | ||
| "STANDARD_FLEXBACKUP_ENTERPRISE", | ||
| "LR_STANDARD_ENTERPRISE", | ||
| ], | ||
| ) | ||
| def test_blob_storage_class_enterprise_tuples(storage_class): | ||
| from google.cloud.storage.blob import Blob | ||
|
|
||
| bucket = _Bucket() | ||
| blob = Blob("blob-name", bucket=bucket) | ||
| assert storage_class in blob.STORAGE_CLASSES | ||
| blob.storage_class = storage_class | ||
| assert blob.storage_class == storage_class | ||
| assert blob._properties == {"storageClass": storage_class} | ||
|
Comment on lines
+6791
to
+6807
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rest of |
||
|
|
||
|
|
||
| class _Connection(object): | ||
| API_BASE_URL = "http://example.com" | ||
| USER_AGENT = "testing 1.2.3" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To maintain consistency and avoid magic strings, the new enterprise storage classes should be defined as constants in
google/cloud/storage/constants.pyand imported, similar toSTANDARD_STORAGE_CLASSand other existing storage classes.