Repository: googleapis/java-storage (java)

Issue:
Add support for Archive storage class
Mirrors googleapis/google-cloud-java#6578 ; there is already an open PR at googleapis/google-cloud-java#6685 which should be re-created in this repo.

Pull request description:
feat: add support for archive storage class
Fixes #4 

Patch:
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 65d6b38b..a345a31f 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 final class StorageClass extends StringEnumValue {
   private static final StringEnumType<StorageClass> 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/pom.xml b/pom.xml
index 01a8f87c..4b94efbf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
   <parent>
     <groupId>com.google.cloud</groupId>
     <artifactId>google-cloud-shared-config</artifactId>
-    <version>0.3.0</version>
+    <version>0.3.1</version>
   </parent>
 
   <developers>
@@ -65,7 +65,7 @@
     <site.installationModule>google-cloud-storage-parent</site.installationModule>
     <google.core.version>1.91.3</google.core.version>
     <google.api-common.version>1.8.1</google.api-common.version>
-    <junit.version>4.12</junit.version>
+    <junit.version>4.13</junit.version>
     <threeten.version>1.4.0</threeten.version>
     <javax.annotations.version>1.3.2</javax.annotations.version>
     <animal-sniffer.version>1.18</animal-sniffer.version>


Test patch:
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 4926e771..2516261a 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 class BucketInfoTest {
     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