Skip to content

Commit 28c2403

Browse files
author
hansdude
committed
Merge pull request #69 from rpmoore/master
Delete Tape Drive and Partition Call Support
2 parents 3d107da + e9170c6 commit 28c2403

File tree

10 files changed

+245
-59
lines changed

10 files changed

+245
-59
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
allprojects {
1717
group = 'com.spectralogic.ds3'
18-
version = '1.1.0-RC1'
18+
version = '1.1.0-RC2'
1919
}
2020

2121
subprojects {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ CancelJobResponse cancelJob(CancelJobRequest request)
228228
ModifyJobResponse modifyJob(ModifyJobRequest request)
229229
throws IOException, SignatureException;
230230

231+
DeleteTapeDriveResponse deleteTapeDrive(DeleteTapeDriveRequest request)
232+
throws IOException, SignatureException;
233+
234+
DeleteTapePartitionResponse deleteTapePartition(DeleteTapePartitionRequest request)
235+
throws IOException, SignatureException;
236+
231237
NotificationResponse createObjectCachedNotification(CreateObjectCachedNotificationRequest request)
232238
throws IOException, SignatureException;
233239

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ public ModifyJobResponse modifyJob(final ModifyJobRequest request) throws IOExce
130130
return new ModifyJobResponse(this.netClient.getResponse(request));
131131
}
132132

133+
@Override
134+
public DeleteTapeDriveResponse deleteTapeDrive(final DeleteTapeDriveRequest request) throws IOException, SignatureException {
135+
return new DeleteTapeDriveResponse(this.netClient.getResponse(request));
136+
}
137+
138+
@Override
139+
public DeleteTapePartitionResponse deleteTapePartition(final DeleteTapePartitionRequest request) throws IOException, SignatureException {
140+
return new DeleteTapePartitionResponse(this.netClient.getResponse(request));
141+
}
142+
133143
@Override
134144
public NotificationResponse createObjectCachedNotification(final CreateObjectCachedNotificationRequest request) throws IOException, SignatureException {
135145
return new NotificationResponse(this.netClient.getResponse(request));
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 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+
package com.spectralogic.ds3client.commands;
16+
17+
import com.spectralogic.ds3client.HttpVerb;
18+
19+
public class DeleteTapeDriveRequest extends AbstractRequest {
20+
21+
private final String id;
22+
23+
public DeleteTapeDriveRequest(final String id) {
24+
this.id = id;
25+
}
26+
27+
@Override
28+
public String getPath() {
29+
return "/_rest_/tape_drive/" + id;
30+
}
31+
32+
@Override
33+
public HttpVerb getVerb() {
34+
return HttpVerb.DELETE;
35+
}
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 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+
package com.spectralogic.ds3client.commands;
16+
17+
import com.spectralogic.ds3client.networking.WebResponse;
18+
19+
import java.io.IOException;
20+
21+
public class DeleteTapeDriveResponse extends AbstractResponse{
22+
public DeleteTapeDriveResponse(final WebResponse response) throws IOException {
23+
super(response);
24+
}
25+
26+
@Override
27+
protected void processResponse() throws IOException {
28+
try {
29+
this.checkStatusCode(204);
30+
} finally {
31+
this.getResponse().close();
32+
}
33+
}
34+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 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+
package com.spectralogic.ds3client.commands;
16+
17+
import com.spectralogic.ds3client.HttpVerb;
18+
19+
public class DeleteTapePartitionRequest extends AbstractRequest {
20+
21+
private final String id;
22+
23+
public DeleteTapePartitionRequest(final String id) {
24+
this.id = id;
25+
}
26+
27+
@Override
28+
public String getPath() {
29+
return "/_rest_/tape_partition/" + this.id;
30+
}
31+
32+
@Override
33+
public HttpVerb getVerb() {
34+
return HttpVerb.DELETE;
35+
}
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* ******************************************************************************
3+
* Copyright 2014-2015 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+
package com.spectralogic.ds3client.commands;
16+
17+
import com.spectralogic.ds3client.networking.WebResponse;
18+
19+
import java.io.IOException;
20+
21+
public class DeleteTapePartitionResponse extends AbstractResponse {
22+
public DeleteTapePartitionResponse(final WebResponse response) throws IOException {
23+
super(response);
24+
}
25+
26+
@Override
27+
protected void processResponse() throws IOException {
28+
try {
29+
this.checkStatusCode(204);
30+
} finally {
31+
this.getResponse().close();
32+
}
33+
}
34+
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
public class GetAvailableJobChunksRequest extends AbstractRequest {
2222
private final UUID jobId;
2323

24+
private int preferredNumberOfChunks = 3;
25+
2426
public UUID getJobId() {
2527
return jobId;
2628
}
@@ -30,6 +32,12 @@ public GetAvailableJobChunksRequest(final UUID jobId) {
3032
getQueryParams().put("job", jobId.toString());
3133
}
3234

35+
public GetAvailableJobChunksRequest withPreferredNumberOfChunks(final int numberOfChunks) {
36+
this.preferredNumberOfChunks = numberOfChunks;
37+
this.getQueryParams().put("preferred_number_of_chunks", Integer.toString(numberOfChunks));
38+
return this;
39+
}
40+
3341
@Override
3442
public String getPath() {
3543
return "/_rest_/job_chunk";
@@ -39,4 +47,8 @@ public String getPath() {
3947
public HttpVerb getVerb() {
4048
return HttpVerb.GET;
4149
}
50+
51+
public int getPreferredNumberOfChunks() {
52+
return preferredNumberOfChunks;
53+
}
4254
}

0 commit comments

Comments
 (0)