Skip to content

Commit a55172e

Browse files
authored
Updating to BP API 5.2 commit 1755379 (#581)
1 parent 27e6006 commit a55172e

File tree

35 files changed

+1531
-3
lines changed

35 files changed

+1531
-3
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ plugins {
3636

3737
allprojects {
3838
group = 'com.spectralogic.ds3'
39-
version = '5.1.3'
39+
version = '5.2.0'
4040
}
4141

4242
subprojects {

ds3-sdk/src/main/java/com/spectralogic/ds3client/Ds3Client.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,13 @@ ModifyNodeSpectraS3Response modifyNodeSpectraS3(final ModifyNodeSpectraS3Request
965965
PutAzureTargetFailureNotificationRegistrationSpectraS3Response putAzureTargetFailureNotificationRegistrationSpectraS3(final PutAzureTargetFailureNotificationRegistrationSpectraS3Request request)
966966
throws IOException;
967967

968+
@ResponsePayloadModel("BucketChangesNotificationRegistration")
969+
@Action("CREATE")
970+
@Resource("BUCKET_CHANGES_NOTIFICATION_REGISTRATION")
971+
972+
PutBucketChangesNotificationRegistrationSpectraS3Response putBucketChangesNotificationRegistrationSpectraS3(final PutBucketChangesNotificationRegistrationSpectraS3Request request)
973+
throws IOException;
974+
968975
@ResponsePayloadModel("Ds3TargetFailureNotificationRegistration")
969976
@Action("CREATE")
970977
@Resource("DS3_TARGET_FAILURE_NOTIFICATION_REGISTRATION")
@@ -1062,6 +1069,12 @@ PutTapePartitionFailureNotificationRegistrationSpectraS3Response putTapePartitio
10621069
DeleteAzureTargetFailureNotificationRegistrationSpectraS3Response deleteAzureTargetFailureNotificationRegistrationSpectraS3(final DeleteAzureTargetFailureNotificationRegistrationSpectraS3Request request)
10631070
throws IOException;
10641071

1072+
@Action("DELETE")
1073+
@Resource("BUCKET_CHANGES_NOTIFICATION_REGISTRATION")
1074+
1075+
DeleteBucketChangesNotificationRegistrationSpectraS3Response deleteBucketChangesNotificationRegistrationSpectraS3(final DeleteBucketChangesNotificationRegistrationSpectraS3Request request)
1076+
throws IOException;
1077+
10651078
@Action("DELETE")
10661079
@Resource("DS3_TARGET_FAILURE_NOTIFICATION_REGISTRATION")
10671080

@@ -1154,6 +1167,27 @@ GetAzureTargetFailureNotificationRegistrationSpectraS3Response getAzureTargetFai
11541167
GetAzureTargetFailureNotificationRegistrationsSpectraS3Response getAzureTargetFailureNotificationRegistrationsSpectraS3(final GetAzureTargetFailureNotificationRegistrationsSpectraS3Request request)
11551168
throws IOException;
11561169

1170+
@ResponsePayloadModel("BucketChangesNotificationRegistration")
1171+
@Action("SHOW")
1172+
@Resource("BUCKET_CHANGES_NOTIFICATION_REGISTRATION")
1173+
1174+
GetBucketChangesNotificationRegistrationSpectraS3Response getBucketChangesNotificationRegistrationSpectraS3(final GetBucketChangesNotificationRegistrationSpectraS3Request request)
1175+
throws IOException;
1176+
1177+
@ResponsePayloadModel("BucketChangesNotificationRegistrationList")
1178+
@Action("LIST")
1179+
@Resource("BUCKET_CHANGES_NOTIFICATION_REGISTRATION")
1180+
1181+
GetBucketChangesNotificationRegistrationsSpectraS3Response getBucketChangesNotificationRegistrationsSpectraS3(final GetBucketChangesNotificationRegistrationsSpectraS3Request request)
1182+
throws IOException;
1183+
1184+
@ResponsePayloadModel("BucketHistoryEventList")
1185+
@Action("LIST")
1186+
@Resource("BUCKET_HISTORY")
1187+
1188+
GetBucketHistorySpectraS3Response getBucketHistorySpectraS3(final GetBucketHistorySpectraS3Request request)
1189+
throws IOException;
1190+
11571191
@ResponsePayloadModel("Ds3TargetFailureNotificationRegistration")
11581192
@Action("SHOW")
11591193
@Resource("DS3_TARGET_FAILURE_NOTIFICATION_REGISTRATION")

ds3-sdk/src/main/java/com/spectralogic/ds3client/Ds3ClientImpl.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,10 @@ public PutAzureTargetFailureNotificationRegistrationSpectraS3Response putAzureTa
614614
return new PutAzureTargetFailureNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
615615
}
616616
@Override
617+
public PutBucketChangesNotificationRegistrationSpectraS3Response putBucketChangesNotificationRegistrationSpectraS3(final PutBucketChangesNotificationRegistrationSpectraS3Request request) throws IOException {
618+
return new PutBucketChangesNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
619+
}
620+
@Override
617621
public PutDs3TargetFailureNotificationRegistrationSpectraS3Response putDs3TargetFailureNotificationRegistrationSpectraS3(final PutDs3TargetFailureNotificationRegistrationSpectraS3Request request) throws IOException {
618622
return new PutDs3TargetFailureNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
619623
}
@@ -670,6 +674,10 @@ public DeleteAzureTargetFailureNotificationRegistrationSpectraS3Response deleteA
670674
return new DeleteAzureTargetFailureNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
671675
}
672676
@Override
677+
public DeleteBucketChangesNotificationRegistrationSpectraS3Response deleteBucketChangesNotificationRegistrationSpectraS3(final DeleteBucketChangesNotificationRegistrationSpectraS3Request request) throws IOException {
678+
return new DeleteBucketChangesNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
679+
}
680+
@Override
673681
public DeleteDs3TargetFailureNotificationRegistrationSpectraS3Response deleteDs3TargetFailureNotificationRegistrationSpectraS3(final DeleteDs3TargetFailureNotificationRegistrationSpectraS3Request request) throws IOException {
674682
return new DeleteDs3TargetFailureNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
675683
}
@@ -730,6 +738,18 @@ public GetAzureTargetFailureNotificationRegistrationsSpectraS3Response getAzureT
730738
return new GetAzureTargetFailureNotificationRegistrationsSpectraS3ResponseParser().response(this.netClient.getResponse(request));
731739
}
732740
@Override
741+
public GetBucketChangesNotificationRegistrationSpectraS3Response getBucketChangesNotificationRegistrationSpectraS3(final GetBucketChangesNotificationRegistrationSpectraS3Request request) throws IOException {
742+
return new GetBucketChangesNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
743+
}
744+
@Override
745+
public GetBucketChangesNotificationRegistrationsSpectraS3Response getBucketChangesNotificationRegistrationsSpectraS3(final GetBucketChangesNotificationRegistrationsSpectraS3Request request) throws IOException {
746+
return new GetBucketChangesNotificationRegistrationsSpectraS3ResponseParser().response(this.netClient.getResponse(request));
747+
}
748+
@Override
749+
public GetBucketHistorySpectraS3Response getBucketHistorySpectraS3(final GetBucketHistorySpectraS3Request request) throws IOException {
750+
return new GetBucketHistorySpectraS3ResponseParser().response(this.netClient.getResponse(request));
751+
}
752+
@Override
733753
public GetDs3TargetFailureNotificationRegistrationSpectraS3Response getDs3TargetFailureNotificationRegistrationSpectraS3(final GetDs3TargetFailureNotificationRegistrationSpectraS3Request request) throws IOException {
734754
return new GetDs3TargetFailureNotificationRegistrationSpectraS3ResponseParser().response(this.netClient.getResponse(request));
735755
}

ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/CompleteBlobRequest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public class CompleteBlobRequest extends AbstractRequest {
3333

3434
private final String job;
3535

36+
private long size;
37+
3638
// Constructor
3739

3840

@@ -61,6 +63,13 @@ public CompleteBlobRequest(final String bucketName, final String objectName, fin
6163

6264
}
6365

66+
public CompleteBlobRequest withSize(final long size) {
67+
this.size = size;
68+
this.updateQueryParam("size", size);
69+
return this;
70+
}
71+
72+
6473

6574
@Override
6675
public HttpVerb getVerb() {
@@ -91,4 +100,9 @@ public String getJob() {
91100
return this.job;
92101
}
93102

103+
104+
public long getSize() {
105+
return this.size;
106+
}
107+
94108
}

ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/GetObjectRequest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public class GetObjectRequest extends AbstractRequest {
4343

4444
private final String objectName;
4545

46+
private boolean cachedOnly;
47+
4648
private String job;
4749

4850
private long offset;
@@ -130,6 +132,17 @@ public GetObjectRequest(final String bucketName, final String objectName, final
130132
}
131133

132134

135+
public GetObjectRequest withCachedOnly(final boolean cachedOnly) {
136+
this.cachedOnly = cachedOnly;
137+
if (this.cachedOnly) {
138+
this.getQueryParams().put("cached_only", null);
139+
} else {
140+
this.getQueryParams().remove("cached_only");
141+
}
142+
return this;
143+
}
144+
145+
133146
public GetObjectRequest withJob(final UUID job) {
134147
this.job = job.toString();
135148
this.updateQueryParam("job", job);
@@ -256,6 +269,11 @@ public String getObjectName() {
256269
}
257270

258271

272+
public boolean getCachedOnly() {
273+
return this.cachedOnly;
274+
}
275+
276+
259277
public String getJob() {
260278
return this.job;
261279
}

ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/HeadObjectRequest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import com.spectralogic.ds3client.networking.HttpVerb;
2020
import com.spectralogic.ds3client.commands.interfaces.AbstractRequest;
21+
import java.util.UUID;
22+
import com.google.common.net.UrlEscapers;
2123

2224
public class HeadObjectRequest extends AbstractRequest {
2325

@@ -27,6 +29,8 @@ public class HeadObjectRequest extends AbstractRequest {
2729

2830
private final String objectName;
2931

32+
private String versionId;
33+
3034
// Constructor
3135

3236

@@ -36,6 +40,20 @@ public HeadObjectRequest(final String bucketName, final String objectName) {
3640

3741
}
3842

43+
public HeadObjectRequest withVersionId(final UUID versionId) {
44+
this.versionId = versionId.toString();
45+
this.updateQueryParam("version_id", versionId);
46+
return this;
47+
}
48+
49+
50+
public HeadObjectRequest withVersionId(final String versionId) {
51+
this.versionId = versionId;
52+
this.updateQueryParam("version_id", versionId);
53+
return this;
54+
}
55+
56+
3957

4058
@Override
4159
public HttpVerb getVerb() {
@@ -56,4 +74,9 @@ public String getObjectName() {
5674
return this.objectName;
5775
}
5876

77+
78+
public String getVersionId() {
79+
return this.versionId;
80+
}
81+
5982
}

ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/PutMultiPartUploadPartRequest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.spectralogic.ds3client.networking.HttpVerb;
2020
import com.spectralogic.ds3client.commands.interfaces.AbstractRequest;
2121
import java.util.UUID;
22+
import com.google.common.net.UrlEscapers;
2223
import javax.annotation.Nonnull;
2324
import com.google.common.base.Preconditions;
2425
import com.spectralogic.ds3client.utils.SeekableByteChannelInputStream;
@@ -62,7 +63,7 @@ public PutMultiPartUploadPartRequest(final String bucketName, final String objec
6263
this.stream = new SeekableByteChannelInputStream(channel);
6364
}
6465

65-
66+
6667
public PutMultiPartUploadPartRequest(final String bucketName, final String objectName, @Nonnull final SeekableByteChannel channel, final int partNumber, final long size, final String uploadId) {
6768
Preconditions.checkNotNull(channel, "Channel may not be null.");
6869
this.bucketName = bucketName;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2019 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
// This code is auto-generated, do not modify
17+
package com.spectralogic.ds3client.commands.parsers;
18+
19+
import com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser;
20+
import com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils;
21+
import com.spectralogic.ds3client.commands.spectrads3.DeleteBucketChangesNotificationRegistrationSpectraS3Response;
22+
import com.spectralogic.ds3client.networking.WebResponse;
23+
import java.io.IOException;
24+
25+
public class DeleteBucketChangesNotificationRegistrationSpectraS3ResponseParser extends AbstractResponseParser<DeleteBucketChangesNotificationRegistrationSpectraS3Response> {
26+
private final int[] expectedStatusCodes = new int[]{204};
27+
28+
@Override
29+
public DeleteBucketChangesNotificationRegistrationSpectraS3Response parseXmlResponse(final WebResponse response) throws IOException {
30+
final int statusCode = response.getStatusCode();
31+
if (ResponseParserUtils.validateStatusCode(statusCode, expectedStatusCodes)) {
32+
switch (statusCode) {
33+
case 204:
34+
//There is no payload, return an empty response handler
35+
return new DeleteBucketChangesNotificationRegistrationSpectraS3Response(this.getChecksum(), this.getChecksumType());
36+
37+
default:
38+
assert false: "validateStatusCode should have made it impossible to reach this line";
39+
}
40+
}
41+
42+
throw ResponseParserUtils.createFailedRequest(response, expectedStatusCodes);
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2019 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
// This code is auto-generated, do not modify
17+
package com.spectralogic.ds3client.commands.parsers;
18+
19+
import com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser;
20+
import com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils;
21+
import com.spectralogic.ds3client.commands.spectrads3.GetBucketChangesNotificationRegistrationSpectraS3Response;
22+
import com.spectralogic.ds3client.models.BucketChangesNotificationRegistration;
23+
import com.spectralogic.ds3client.networking.WebResponse;
24+
import com.spectralogic.ds3client.serializer.XmlOutput;
25+
import java.io.IOException;
26+
import java.io.InputStream;
27+
28+
public class GetBucketChangesNotificationRegistrationSpectraS3ResponseParser extends AbstractResponseParser<GetBucketChangesNotificationRegistrationSpectraS3Response> {
29+
private final int[] expectedStatusCodes = new int[]{200};
30+
31+
@Override
32+
public GetBucketChangesNotificationRegistrationSpectraS3Response parseXmlResponse(final WebResponse response) throws IOException {
33+
final int statusCode = response.getStatusCode();
34+
if (ResponseParserUtils.validateStatusCode(statusCode, expectedStatusCodes)) {
35+
switch (statusCode) {
36+
case 200:
37+
try (final InputStream inputStream = response.getResponseStream()) {
38+
final BucketChangesNotificationRegistration result = XmlOutput.fromXml(inputStream, BucketChangesNotificationRegistration.class);
39+
return new GetBucketChangesNotificationRegistrationSpectraS3Response(result, this.getChecksum(), this.getChecksumType());
40+
}
41+
42+
default:
43+
assert false: "validateStatusCode should have made it impossible to reach this line";
44+
}
45+
}
46+
47+
throw ResponseParserUtils.createFailedRequest(response, expectedStatusCodes);
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2019 Spectra Logic Corporation. All Rights Reserved.
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is located at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* or in the "license" file accompanying this file.
10+
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
11+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
* ****************************************************************************
14+
*/
15+
16+
// This code is auto-generated, do not modify
17+
package com.spectralogic.ds3client.commands.parsers;
18+
19+
import com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser;
20+
import com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils;
21+
import com.spectralogic.ds3client.commands.spectrads3.GetBucketChangesNotificationRegistrationsSpectraS3Response;
22+
import com.spectralogic.ds3client.models.BucketChangesNotificationRegistrationList;
23+
import com.spectralogic.ds3client.networking.WebResponse;
24+
import com.spectralogic.ds3client.serializer.XmlOutput;
25+
import java.io.IOException;
26+
import java.io.InputStream;
27+
28+
public class GetBucketChangesNotificationRegistrationsSpectraS3ResponseParser extends AbstractResponseParser<GetBucketChangesNotificationRegistrationsSpectraS3Response> {
29+
private final int[] expectedStatusCodes = new int[]{200};
30+
31+
@Override
32+
public GetBucketChangesNotificationRegistrationsSpectraS3Response parseXmlResponse(final WebResponse response) throws IOException {
33+
final int statusCode = response.getStatusCode();
34+
final Integer pagingTruncated = parseIntHeader("page-truncated");
35+
final Integer pagingTotalResultCount = parseIntHeader("total-result-count");
36+
if (ResponseParserUtils.validateStatusCode(statusCode, expectedStatusCodes)) {
37+
switch (statusCode) {
38+
case 200:
39+
try (final InputStream inputStream = response.getResponseStream()) {
40+
final BucketChangesNotificationRegistrationList result = XmlOutput.fromXml(inputStream, BucketChangesNotificationRegistrationList.class);
41+
return new GetBucketChangesNotificationRegistrationsSpectraS3Response(result, pagingTotalResultCount, pagingTruncated, this.getChecksum(), this.getChecksumType());
42+
}
43+
44+
default:
45+
assert false: "validateStatusCode should have made it impossible to reach this line";
46+
}
47+
}
48+
49+
throw ResponseParserUtils.createFailedRequest(response, expectedStatusCodes);
50+
}
51+
}

0 commit comments

Comments
 (0)