diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b823b972..17f0db2c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [6.1.0] - 2022-09-19 +### Added +* Added support for Java 8's `-parameters` option so constructor parameters do not need to be reiterated in `B2Json.constructor#params` +* Added `fileLockEnabled` to `B2UpdateBucketRequest` to support enabling file lock on existing buckets + ## [6.0.0] - 2022-06-03 ### Changed `[Incompatible]` * Updated `includeExistingFiles` to be required on B2ReplicationRule @@ -166,7 +171,9 @@ * These changes were driven by switching our internal b2-sdk uses to use the http client from the sdk instead of a different, custom interface. -[Unreleased]: https://github.com/Backblaze/b2-sdk-java/compare/v5.0.0...HEAD +[Unreleased]: https://github.com/Backblaze/b2-sdk-java/compare/v6.1.0...HEAD +[6.1.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v6.1.0 +[6.0.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v6.0.0 [5.0.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v5.0.0 [4.0.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v4.0.0 [3.1.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v3.1.0 diff --git a/core/src/main/java/com/backblaze/b2/client/structures/B2UpdateBucketRequest.java b/core/src/main/java/com/backblaze/b2/client/structures/B2UpdateBucketRequest.java index fa34348db..3513eae5e 100644 --- a/core/src/main/java/com/backblaze/b2/client/structures/B2UpdateBucketRequest.java +++ b/core/src/main/java/com/backblaze/b2/client/structures/B2UpdateBucketRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021, Backblaze Inc. All Rights Reserved. + * Copyright 2022, Backblaze Inc. All Rights Reserved. * License https://www.backblaze.com/using_b2_code.html */ package com.backblaze.b2.client.structures; @@ -38,11 +38,14 @@ public class B2UpdateBucketRequest { @B2Json.optional private final B2BucketReplicationConfiguration replicationConfiguration; + @B2Json.optional + private final Boolean fileLockEnabled; + @B2Json.optional private final Integer ifRevisionIs; @B2Json.constructor(params = "accountId,bucketId,bucketType,bucketInfo,corsRules,lifecycleRules," + - "defaultRetention,defaultServerSideEncryption,replicationConfiguration,ifRevisionIs") + "defaultRetention,defaultServerSideEncryption,replicationConfiguration,fileLockEnabled,ifRevisionIs") private B2UpdateBucketRequest(String accountId, String bucketId, String bucketType, @@ -52,6 +55,7 @@ private B2UpdateBucketRequest(String accountId, B2BucketDefaultRetention defaultRetention, B2BucketServerSideEncryption defaultServerSideEncryption, B2BucketReplicationConfiguration replicationConfiguration, + Boolean fileLockEnabled, Integer ifRevisionIs) { this.accountId = accountId; this.bucketId = bucketId; @@ -62,6 +66,7 @@ private B2UpdateBucketRequest(String accountId, this.defaultRetention = defaultRetention; this.defaultServerSideEncryption = defaultServerSideEncryption; this.replicationConfiguration = replicationConfiguration; + this.fileLockEnabled = fileLockEnabled; this.ifRevisionIs = ifRevisionIs; } @@ -100,6 +105,10 @@ public B2BucketReplicationConfiguration getReplicationConfiguration() { return replicationConfiguration; } + public Boolean getFileLockEnabled() { + return fileLockEnabled; + } + public Integer getIfRevisionIs() { return ifRevisionIs; } @@ -118,6 +127,7 @@ public boolean equals(Object o) { Objects.equals(getDefaultRetention(), that.getDefaultRetention()) && Objects.equals(getDefaultServerSideEncryption(), that.getDefaultServerSideEncryption()) && Objects.equals(getReplicationConfiguration(), that.getReplicationConfiguration()) && + Objects.equals(getFileLockEnabled() , that.getFileLockEnabled()) && Objects.equals(getIfRevisionIs(), that.getIfRevisionIs()); } @@ -133,6 +143,7 @@ public int hashCode() { getDefaultRetention(), getDefaultServerSideEncryption(), getReplicationConfiguration(), + getFileLockEnabled(), getIfRevisionIs() ); } @@ -156,6 +167,7 @@ public static class Builder { private B2BucketDefaultRetention defaultRetention; private B2BucketServerSideEncryption defaultServerSideEncryption; private B2BucketReplicationConfiguration replicationConfiguration; + private Boolean fileLockEnabled; private Builder(B2Bucket bucket) { this.accountId = bucket.getAccountId(); @@ -198,6 +210,11 @@ public Builder setReplicationConfiguration(B2BucketReplicationConfiguration repl return this; } + public Builder setFileLockEnabled(Boolean fileLockEnabled) { + this.fileLockEnabled = fileLockEnabled; + return this; + } + public B2UpdateBucketRequest build() { return new B2UpdateBucketRequest( accountId, @@ -209,6 +226,7 @@ public B2UpdateBucketRequest build() { defaultRetention, defaultServerSideEncryption, replicationConfiguration, + fileLockEnabled, ifRevisionIs ); } diff --git a/core/src/test/java/com/backblaze/b2/client/B2StorageClientWebifierImplTest.java b/core/src/test/java/com/backblaze/b2/client/B2StorageClientWebifierImplTest.java index 88b08a7c1..7ac8da9eb 100644 --- a/core/src/test/java/com/backblaze/b2/client/B2StorageClientWebifierImplTest.java +++ b/core/src/test/java/com/backblaze/b2/client/B2StorageClientWebifierImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021, Backblaze Inc. All Rights Reserved. + * Copyright 2022, Backblaze Inc. All Rights Reserved. * License https://www.backblaze.com/using_b2_code.html */ package com.backblaze.b2.client; @@ -136,18 +136,18 @@ public class B2StorageClientWebifierImplTest extends B2BaseTest { - private RecordingWebApiClient webApiClient = new RecordingWebApiClient(); + private final RecordingWebApiClient webApiClient = new RecordingWebApiClient(); // i'm doing most tests with the a test mode to ensure it's set on all request type. // there's a separate test it can be disabled; that test only checks one request type. - private B2StorageClientWebifierImpl webifier = new B2StorageClientWebifierImpl( + private final B2StorageClientWebifierImpl webifier = new B2StorageClientWebifierImpl( webApiClient, USER_AGENT, MASTER_URL, B2TestMode.FORCE_CAP_EXCEEDED ); - private B2ContentSink noopContentHandler = (r, i) -> {}; + private final B2ContentSink noopContentHandler = (r, i) -> {}; @Rule @@ -1139,6 +1139,7 @@ public void testUpdateBucket() throws B2Exception { " ],\n" + " \"defaultRetention\": null,\n" + " \"defaultServerSideEncryption\": null,\n" + + " \"fileLockEnabled\": null,\n" + " \"ifRevisionIs\": 1,\n" + " \"lifecycleRules\": null,\n" + " \"replicationConfiguration\": null\n" + diff --git a/core/src/test/java/com/backblaze/b2/client/structures/B2UpdateBucketRequestTest.java b/core/src/test/java/com/backblaze/b2/client/structures/B2UpdateBucketRequestTest.java index f7d22a747..13dc1c12c 100644 --- a/core/src/test/java/com/backblaze/b2/client/structures/B2UpdateBucketRequestTest.java +++ b/core/src/test/java/com/backblaze/b2/client/structures/B2UpdateBucketRequestTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021, Backblaze Inc. All Rights Reserved. + * Copyright 2022, Backblaze Inc. All Rights Reserved. * License https://www.backblaze.com/using_b2_code.html */ package com.backblaze.b2.client.structures; @@ -133,6 +133,7 @@ public void testFullUpdateBucketRequest() { .setDefaultRetention(defaultRetention) .setDefaultServerSideEncryption(defaultServerSideEncryption) .setReplicationConfiguration(replicationConfiguration) + .setFileLockEnabled(Boolean.TRUE) .build(); // Convert from B2UpdateBucketRequest -> json @@ -171,6 +172,7 @@ public void testFullUpdateBucketRequest() { " \"algorithm\": \"AES256\",\n" + " \"mode\": \"SSE-B2\"\n" + " },\n" + + " \"fileLockEnabled\": true,\n" + " \"ifRevisionIs\": 1,\n" + " \"lifecycleRules\": [\n" + " {\n" + diff --git a/gradle.properties b/gradle.properties index dc7899c3a..951d87c5e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Copyright 2022, Backblaze Inc. All Rights Reserved. # License https://www.backblaze.com/using_b2_code.html -version=6.0.0 +version=6.1.0 group=com.backblaze.b2