Skip to content

feat(storage): add enterprise storage classes to Bucket and Blob STORAGE_CLASSES tuples - #18951

Open
chandra-siri wants to merge 2 commits into
googleapis:mainfrom
chandra-siri:feat/enterprise-storage-classes-tuples
Open

chandra-siri wants to merge 2 commits into
googleapis:mainfrom
chandra-siri:feat/enterprise-storage-classes-tuples

Conversation

@chandra-siri

Copy link
Copy Markdown
Contributor

Summary

Adds the Enterprise storage classes (STANDARD_ENTERPRISE, STANDARD_FLEXBACKUP_ENTERPRISE, and LR_STANDARD_ENTERPRISE) to the Bucket.STORAGE_CLASSES and Blob.STORAGE_CLASSES documentation tuples in google-cloud-storage:

  • google/cloud/storage/bucket.py: Includes "STANDARD_ENTERPRISE", "STANDARD_FLEXBACKUP_ENTERPRISE", and "LR_STANDARD_ENTERPRISE" in Bucket.STORAGE_CLASSES.
  • google/cloud/storage/blob.py: Includes "STANDARD_ENTERPRISE", "STANDARD_FLEXBACKUP_ENTERPRISE", and "LR_STANDARD_ENTERPRISE" in Blob.STORAGE_CLASSES.
  • Unit & System Tests: Adds unit tests (tests/unit/test_bucket.py, tests/unit/test_blob.py) and system tests (tests/system/test_bucket.py, tests/system/test_blob.py) using @pytest.mark.parametrize to verify bucket creation and blob storage class updates with the Enterprise storage classes.

Split from #18949 (Part 1 of 2: Bucket.STORAGE_CLASSES and Blob.STORAGE_CLASSES tuple entries).

@chandra-siri
chandra-siri requested review from a team as code owners November 2, 2026 14:28

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for new enterprise storage classes (STANDARD_ENTERPRISE, STANDARD_FLEXBACKUP_ENTERPRISE, and LR_STANDARD_ENTERPRISE) to the Blob and Bucket classes, along with corresponding unit and system tests. The review feedback recommends defining these new storage classes as constants in constants.py to avoid magic strings and maintain consistency. Additionally, it is suggested to refactor the new standalone unit test in test_blob.py into the existing unittest.TestCase structure to match the file's established testing pattern.

Comment on lines 192 to 202
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,
REGIONAL_LEGACY_STORAGE_CLASS,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To maintain consistency and avoid magic strings, the new enterprise storage classes should be defined as constants in google/cloud/storage/constants.py and imported, similar to STANDARD_STORAGE_CLASS and other existing storage classes.

Suggested change
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,
REGIONAL_LEGACY_STORAGE_CLASS,
)
STORAGE_CLASSES = (
STANDARD_STORAGE_CLASS,
STANDARD_ENTERPRISE_STORAGE_CLASS,
STANDARD_FLEXBACKUP_ENTERPRISE_STORAGE_CLASS,
NEARLINE_STORAGE_CLASS,
COLDLINE_STORAGE_CLASS,
ARCHIVE_STORAGE_CLASS,
LR_STANDARD_ENTERPRISE_STORAGE_CLASS,
MULTI_REGIONAL_LEGACY_STORAGE_CLASS,
REGIONAL_LEGACY_STORAGE_CLASS,
)

Comment on lines 651 to 661
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To maintain consistency and avoid magic strings, the new enterprise storage classes should be defined as constants in google/cloud/storage/constants.py and imported, similar to STANDARD_STORAGE_CLASS and other existing storage classes.

Suggested change
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
STORAGE_CLASSES = (
STANDARD_STORAGE_CLASS,
STANDARD_ENTERPRISE_STORAGE_CLASS,
STANDARD_FLEXBACKUP_ENTERPRISE_STORAGE_CLASS,
NEARLINE_STORAGE_CLASS,
COLDLINE_STORAGE_CLASS,
ARCHIVE_STORAGE_CLASS,
LR_STANDARD_ENTERPRISE_STORAGE_CLASS,
MULTI_REGIONAL_LEGACY_STORAGE_CLASS, # legacy
REGIONAL_LEGACY_STORAGE_CLASS, # legacy
DURABLE_REDUCED_AVAILABILITY_LEGACY_STORAGE_CLASS, # legacy
)

Comment on lines +6791 to +6807
@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}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The rest of test_blob.py uses unittest.TestCase classes for structuring unit tests. Defining test_blob_storage_class_enterprise_tuples as a standalone pytest function is inconsistent with the existing test structure. Consider refactoring this test as methods within the appropriate Test_Blob (or similar) test class to maintain consistency.

@chandra-siri chandra-siri added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 3, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants