Skip to content

Commit ea81b02

Browse files
authored
Merge pull request #178 from Backblaze/mergePrivateChanges09152022
This PR merges recent private updates to the public repo. Testing: unit tests
2 parents e8d85c0 + 676d005 commit ea81b02

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [6.1.0] - 2022-09-19
4+
### Added
5+
* Added support for Java 8's `-parameters` option so constructor parameters do not need to be reiterated in `B2Json.constructor#params`
6+
* Added `fileLockEnabled` to `B2UpdateBucketRequest` to support enabling file lock on existing buckets
7+
38
## [6.0.0] - 2022-06-03
49
### Changed `[Incompatible]`
510
* Updated `includeExistingFiles` to be required on B2ReplicationRule
@@ -166,7 +171,9 @@
166171
* These changes were driven by switching our internal b2-sdk uses to use the http client from the sdk instead of a
167172
different, custom interface.
168173

169-
[Unreleased]: https://github.com/Backblaze/b2-sdk-java/compare/v5.0.0...HEAD
174+
[Unreleased]: https://github.com/Backblaze/b2-sdk-java/compare/v6.1.0...HEAD
175+
[6.1.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v6.1.0
176+
[6.0.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v6.0.0
170177
[5.0.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v5.0.0
171178
[4.0.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v4.0.0
172179
[3.1.0]: https://github.com/Backblaze/b2-sdk-java/releases/tag/v3.1.0

core/src/main/java/com/backblaze/b2/client/structures/B2UpdateBucketRequest.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021, Backblaze Inc. All Rights Reserved.
2+
* Copyright 2022, Backblaze Inc. All Rights Reserved.
33
* License https://www.backblaze.com/using_b2_code.html
44
*/
55
package com.backblaze.b2.client.structures;
@@ -38,11 +38,14 @@ public class B2UpdateBucketRequest {
3838
@B2Json.optional
3939
private final B2BucketReplicationConfiguration replicationConfiguration;
4040

41+
@B2Json.optional
42+
private final Boolean fileLockEnabled;
43+
4144
@B2Json.optional
4245
private final Integer ifRevisionIs;
4346

4447
@B2Json.constructor(params = "accountId,bucketId,bucketType,bucketInfo,corsRules,lifecycleRules," +
45-
"defaultRetention,defaultServerSideEncryption,replicationConfiguration,ifRevisionIs")
48+
"defaultRetention,defaultServerSideEncryption,replicationConfiguration,fileLockEnabled,ifRevisionIs")
4649
private B2UpdateBucketRequest(String accountId,
4750
String bucketId,
4851
String bucketType,
@@ -52,6 +55,7 @@ private B2UpdateBucketRequest(String accountId,
5255
B2BucketDefaultRetention defaultRetention,
5356
B2BucketServerSideEncryption defaultServerSideEncryption,
5457
B2BucketReplicationConfiguration replicationConfiguration,
58+
Boolean fileLockEnabled,
5559
Integer ifRevisionIs) {
5660
this.accountId = accountId;
5761
this.bucketId = bucketId;
@@ -62,6 +66,7 @@ private B2UpdateBucketRequest(String accountId,
6266
this.defaultRetention = defaultRetention;
6367
this.defaultServerSideEncryption = defaultServerSideEncryption;
6468
this.replicationConfiguration = replicationConfiguration;
69+
this.fileLockEnabled = fileLockEnabled;
6570
this.ifRevisionIs = ifRevisionIs;
6671
}
6772

@@ -100,6 +105,10 @@ public B2BucketReplicationConfiguration getReplicationConfiguration() {
100105
return replicationConfiguration;
101106
}
102107

108+
public Boolean getFileLockEnabled() {
109+
return fileLockEnabled;
110+
}
111+
103112
public Integer getIfRevisionIs() {
104113
return ifRevisionIs;
105114
}
@@ -118,6 +127,7 @@ public boolean equals(Object o) {
118127
Objects.equals(getDefaultRetention(), that.getDefaultRetention()) &&
119128
Objects.equals(getDefaultServerSideEncryption(), that.getDefaultServerSideEncryption()) &&
120129
Objects.equals(getReplicationConfiguration(), that.getReplicationConfiguration()) &&
130+
Objects.equals(getFileLockEnabled() , that.getFileLockEnabled()) &&
121131
Objects.equals(getIfRevisionIs(), that.getIfRevisionIs());
122132
}
123133

@@ -133,6 +143,7 @@ public int hashCode() {
133143
getDefaultRetention(),
134144
getDefaultServerSideEncryption(),
135145
getReplicationConfiguration(),
146+
getFileLockEnabled(),
136147
getIfRevisionIs()
137148
);
138149
}
@@ -156,6 +167,7 @@ public static class Builder {
156167
private B2BucketDefaultRetention defaultRetention;
157168
private B2BucketServerSideEncryption defaultServerSideEncryption;
158169
private B2BucketReplicationConfiguration replicationConfiguration;
170+
private Boolean fileLockEnabled;
159171

160172
private Builder(B2Bucket bucket) {
161173
this.accountId = bucket.getAccountId();
@@ -198,6 +210,11 @@ public Builder setReplicationConfiguration(B2BucketReplicationConfiguration repl
198210
return this;
199211
}
200212

213+
public Builder setFileLockEnabled(Boolean fileLockEnabled) {
214+
this.fileLockEnabled = fileLockEnabled;
215+
return this;
216+
}
217+
201218
public B2UpdateBucketRequest build() {
202219
return new B2UpdateBucketRequest(
203220
accountId,
@@ -209,6 +226,7 @@ public B2UpdateBucketRequest build() {
209226
defaultRetention,
210227
defaultServerSideEncryption,
211228
replicationConfiguration,
229+
fileLockEnabled,
212230
ifRevisionIs
213231
);
214232
}

core/src/test/java/com/backblaze/b2/client/B2StorageClientWebifierImplTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021, Backblaze Inc. All Rights Reserved.
2+
* Copyright 2022, Backblaze Inc. All Rights Reserved.
33
* License https://www.backblaze.com/using_b2_code.html
44
*/
55
package com.backblaze.b2.client;
@@ -136,18 +136,18 @@ public class B2StorageClientWebifierImplTest extends B2BaseTest {
136136

137137

138138

139-
private RecordingWebApiClient webApiClient = new RecordingWebApiClient();
139+
private final RecordingWebApiClient webApiClient = new RecordingWebApiClient();
140140

141141
// i'm doing most tests with the a test mode to ensure it's set on all request type.
142142
// there's a separate test it can be disabled; that test only checks one request type.
143-
private B2StorageClientWebifierImpl webifier = new B2StorageClientWebifierImpl(
143+
private final B2StorageClientWebifierImpl webifier = new B2StorageClientWebifierImpl(
144144
webApiClient,
145145
USER_AGENT,
146146
MASTER_URL,
147147
B2TestMode.FORCE_CAP_EXCEEDED
148148
);
149149

150-
private B2ContentSink noopContentHandler = (r, i) -> {};
150+
private final B2ContentSink noopContentHandler = (r, i) -> {};
151151

152152

153153
@Rule
@@ -1139,6 +1139,7 @@ public void testUpdateBucket() throws B2Exception {
11391139
" ],\n" +
11401140
" \"defaultRetention\": null,\n" +
11411141
" \"defaultServerSideEncryption\": null,\n" +
1142+
" \"fileLockEnabled\": null,\n" +
11421143
" \"ifRevisionIs\": 1,\n" +
11431144
" \"lifecycleRules\": null,\n" +
11441145
" \"replicationConfiguration\": null\n" +

core/src/test/java/com/backblaze/b2/client/structures/B2UpdateBucketRequestTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021, Backblaze Inc. All Rights Reserved.
2+
* Copyright 2022, Backblaze Inc. All Rights Reserved.
33
* License https://www.backblaze.com/using_b2_code.html
44
*/
55
package com.backblaze.b2.client.structures;
@@ -133,6 +133,7 @@ public void testFullUpdateBucketRequest() {
133133
.setDefaultRetention(defaultRetention)
134134
.setDefaultServerSideEncryption(defaultServerSideEncryption)
135135
.setReplicationConfiguration(replicationConfiguration)
136+
.setFileLockEnabled(Boolean.TRUE)
136137
.build();
137138

138139
// Convert from B2UpdateBucketRequest -> json
@@ -171,6 +172,7 @@ public void testFullUpdateBucketRequest() {
171172
" \"algorithm\": \"AES256\",\n" +
172173
" \"mode\": \"SSE-B2\"\n" +
173174
" },\n" +
175+
" \"fileLockEnabled\": true,\n" +
174176
" \"ifRevisionIs\": 1,\n" +
175177
" \"lifecycleRules\": [\n" +
176178
" {\n" +

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright 2022, Backblaze Inc. All Rights Reserved.
22
# License https://www.backblaze.com/using_b2_code.html
33

4-
version=6.0.0
4+
version=6.1.0
55
group=com.backblaze.b2

0 commit comments

Comments
 (0)