Skip to content

Commit

Permalink
Merge pull request #69 from rpmoore/master
Browse files Browse the repository at this point in the history
Delete Tape Drive and Partition Call Support
  • Loading branch information
hansdude committed Apr 16, 2015
2 parents 3d107da + e9170c6 commit 28c2403
Show file tree
Hide file tree
Showing 10 changed files with 245 additions and 59 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

allprojects {
group = 'com.spectralogic.ds3'
version = '1.1.0-RC1'
version = '1.1.0-RC2'
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ CancelJobResponse cancelJob(CancelJobRequest request)
ModifyJobResponse modifyJob(ModifyJobRequest request)
throws IOException, SignatureException;

DeleteTapeDriveResponse deleteTapeDrive(DeleteTapeDriveRequest request)
throws IOException, SignatureException;

DeleteTapePartitionResponse deleteTapePartition(DeleteTapePartitionRequest request)
throws IOException, SignatureException;

NotificationResponse createObjectCachedNotification(CreateObjectCachedNotificationRequest request)
throws IOException, SignatureException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ public ModifyJobResponse modifyJob(final ModifyJobRequest request) throws IOExce
return new ModifyJobResponse(this.netClient.getResponse(request));
}

@Override
public DeleteTapeDriveResponse deleteTapeDrive(final DeleteTapeDriveRequest request) throws IOException, SignatureException {
return new DeleteTapeDriveResponse(this.netClient.getResponse(request));
}

@Override
public DeleteTapePartitionResponse deleteTapePartition(final DeleteTapePartitionRequest request) throws IOException, SignatureException {
return new DeleteTapePartitionResponse(this.netClient.getResponse(request));
}

@Override
public NotificationResponse createObjectCachedNotification(final CreateObjectCachedNotificationRequest request) throws IOException, SignatureException {
return new NotificationResponse(this.netClient.getResponse(request));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* ******************************************************************************
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
package com.spectralogic.ds3client.commands;

import com.spectralogic.ds3client.HttpVerb;

public class DeleteTapeDriveRequest extends AbstractRequest {

private final String id;

public DeleteTapeDriveRequest(final String id) {
this.id = id;
}

@Override
public String getPath() {
return "/_rest_/tape_drive/" + id;
}

@Override
public HttpVerb getVerb() {
return HttpVerb.DELETE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* ******************************************************************************
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
package com.spectralogic.ds3client.commands;

import com.spectralogic.ds3client.networking.WebResponse;

import java.io.IOException;

public class DeleteTapeDriveResponse extends AbstractResponse{
public DeleteTapeDriveResponse(final WebResponse response) throws IOException {
super(response);
}

@Override
protected void processResponse() throws IOException {
try {
this.checkStatusCode(204);
} finally {
this.getResponse().close();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* ******************************************************************************
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
package com.spectralogic.ds3client.commands;

import com.spectralogic.ds3client.HttpVerb;

public class DeleteTapePartitionRequest extends AbstractRequest {

private final String id;

public DeleteTapePartitionRequest(final String id) {
this.id = id;
}

@Override
public String getPath() {
return "/_rest_/tape_partition/" + this.id;
}

@Override
public HttpVerb getVerb() {
return HttpVerb.DELETE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* ******************************************************************************
* Copyright 2014-2015 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* ****************************************************************************
*/
package com.spectralogic.ds3client.commands;

import com.spectralogic.ds3client.networking.WebResponse;

import java.io.IOException;

public class DeleteTapePartitionResponse extends AbstractResponse {
public DeleteTapePartitionResponse(final WebResponse response) throws IOException {
super(response);
}

@Override
protected void processResponse() throws IOException {
try {
this.checkStatusCode(204);
} finally {
this.getResponse().close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
public class GetAvailableJobChunksRequest extends AbstractRequest {
private final UUID jobId;

private int preferredNumberOfChunks = 3;

public UUID getJobId() {
return jobId;
}
Expand All @@ -30,6 +32,12 @@ public GetAvailableJobChunksRequest(final UUID jobId) {
getQueryParams().put("job", jobId.toString());
}

public GetAvailableJobChunksRequest withPreferredNumberOfChunks(final int numberOfChunks) {
this.preferredNumberOfChunks = numberOfChunks;
this.getQueryParams().put("preferred_number_of_chunks", Integer.toString(numberOfChunks));
return this;
}

@Override
public String getPath() {
return "/_rest_/job_chunk";
Expand All @@ -39,4 +47,8 @@ public String getPath() {
public HttpVerb getVerb() {
return HttpVerb.GET;
}

public int getPreferredNumberOfChunks() {
return preferredNumberOfChunks;
}
}
Loading

0 comments on commit 28c2403

Please sign in to comment.