diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClass.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClass.java index 65d6b38be..a345a31fc 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClass.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClass.java @@ -41,22 +41,44 @@ public StorageClass apply(String constant) { private static final StringEnumType type = new StringEnumType(StorageClass.class, CONSTRUCTOR); - /** Regional storage class. */ - public static final StorageClass REGIONAL = type.createAndRegister("REGIONAL"); - - /** Multi-regional storage class. */ - public static final StorageClass MULTI_REGIONAL = type.createAndRegister("MULTI_REGIONAL"); + /** + * Standard storage class. See: https://cloud.google.com/storage/docs/storage-classes for details + */ + public static final StorageClass STANDARD = type.createAndRegister("STANDARD"); - /** Nearline storage class. */ + /** + * Nearline storage class. See: https://cloud.google.com/storage/docs/storage-classes for details + */ public static final StorageClass NEARLINE = type.createAndRegister("NEARLINE"); - /** Coldline storage class. */ + /** + * Coldline storage class. See: https://cloud.google.com/storage/docs/storage-classes for details + */ public static final StorageClass COLDLINE = type.createAndRegister("COLDLINE"); - /** Standard storage class. */ - public static final StorageClass STANDARD = type.createAndRegister("STANDARD"); + /** + * Archive storage class. See: https://cloud.google.com/storage/docs/storage-classes for details + */ + public static final StorageClass ARCHIVE = type.createAndRegister("ARCHIVE"); + + /** + * Regional storage class. This is supported as a legacy storage class and will be deprecated in + * the future. See: https://cloud.google.com/storage/docs/storage-classes for details + */ + public static final StorageClass REGIONAL = type.createAndRegister("REGIONAL"); - /** Durable Reduced Availability (deprecated) */ + /** + * Multi-regional storage class. This is supported as a legacy storage class and will be + * deprecated in the future. See: https://cloud.google.com/storage/docs/storage-classes for + * details + */ + public static final StorageClass MULTI_REGIONAL = type.createAndRegister("MULTI_REGIONAL"); + + /** + * Durable Reduced Availability storage class. This is supported as a legacy storage class and + * will be deprecated in the future. See: https://cloud.google.com/storage/docs/storage-classes + * for details + */ public static final StorageClass DURABLE_REDUCED_AVAILABILITY = type.createAndRegister("DURABLE_REDUCED_AVAILABILITY"); diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/BucketInfoTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/BucketInfoTest.java index 4926e7716..2516261a3 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/BucketInfoTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/BucketInfoTest.java @@ -80,6 +80,7 @@ public class BucketInfoTest { private static final String NOT_FOUND_PAGE = "error.html"; private static final String LOCATION = "ASIA"; private static final StorageClass STORAGE_CLASS = StorageClass.STANDARD; + private static final StorageClass ARCHIVE_STORAGE_CLASS = StorageClass.ARCHIVE; private static final String DEFAULT_KMS_KEY_NAME = "projects/p/locations/kr-loc/keyRings/kr/cryptoKeys/key"; private static final Boolean VERSIONING_ENABLED = true; @@ -130,6 +131,35 @@ public class BucketInfoTest { .setRetentionPolicyIsLocked(RETENTION_POLICY_IS_LOCKED) .setLogging(LOGGING) .build(); + private static final BucketInfo BUCKET_INFO_ARCHIVE = + BucketInfo.newBuilder("b") + .setAcl(ACL) + .setEtag(ETAG) + .setGeneratedId(GENERATED_ID) + .setMetageneration(META_GENERATION) + .setOwner(OWNER) + .setSelfLink(SELF_LINK) + .setCors(CORS) + .setCreateTime(CREATE_TIME) + .setDefaultAcl(DEFAULT_ACL) + .setDeleteRules(DELETE_RULES) + .setLifecycleRules(LIFECYCLE_RULES) + .setIndexPage(INDEX_PAGE) + .setIamConfiguration(IAM_CONFIGURATION) + .setNotFoundPage(NOT_FOUND_PAGE) + .setLocation(LOCATION) + .setLocationType(LOCATION_TYPE) + .setStorageClass(ARCHIVE_STORAGE_CLASS) + .setVersioningEnabled(VERSIONING_ENABLED) + .setLabels(BUCKET_LABELS) + .setRequesterPays(REQUESTER_PAYS) + .setDefaultKmsKeyName(DEFAULT_KMS_KEY_NAME) + .setDefaultEventBasedHold(DEFAULT_EVENT_BASED_HOLD) + .setRetentionEffectiveTime(RETENTION_EFFECTIVE_TIME) + .setRetentionPeriod(RETENTION_PERIOD) + .setRetentionPolicyIsLocked(RETENTION_POLICY_IS_LOCKED) + .setLogging(LOGGING) + .build(); @Test public void testToBuilder() { @@ -139,6 +169,7 @@ public void testToBuilder() { assertEquals("id", bucketInfo.getGeneratedId()); bucketInfo = bucketInfo.toBuilder().setName("b").setGeneratedId(GENERATED_ID).build(); compareBuckets(BUCKET_INFO, bucketInfo); + assertEquals(ARCHIVE_STORAGE_CLASS, BUCKET_INFO_ARCHIVE.getStorageClass()); } @Test