glesys: removing ArchiveDetails (duplicate of Archive)

This commit is contained in:
Adam Lowe 2012-06-24 11:13:08 +03:00
parent b1877bbee5
commit 9b4e68cc6b
3 changed files with 15 additions and 76 deletions

View File

@ -1,65 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License 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 org.jclouds.glesys.domain;
/**
* Detailed information about an archive volume.
*
* @author Adam Lowe
* @see <a href= "https://customer.glesys.com/api.php?a=doc#archive_details" />
*/
public class ArchiveDetails extends Archive {
public static Builder builder() {
return new Builder();
}
public static class Builder extends Archive.Builder {
public ArchiveDetails build() {
return new ArchiveDetails(username, totalSize, freeSize, locked);
}
public Builder fromArchiveDetails(ArchiveDetails in) {
return username(in.getUsername()).totalSize(in.getTotalSize()).freeSize(in.getFreeSize()).locked(in.isLocked());
}
@Override
public Builder username(String username) {
return Builder.class.cast(super.username(username));
}
@Override
public Builder totalSize(String size) {
return Builder.class.cast(super.totalSize(size));
}
@Override
public Builder freeSize(String size) {
return Builder.class.cast(super.freeSize(size));
}
@Override
public Builder locked(boolean locked) {
return Builder.class.cast(super.locked(locked));
}
}
public ArchiveDetails(String username, String totalSize, String freeSize, boolean locked) {
super(username, totalSize, freeSize, locked);
}
}

View File

@ -29,7 +29,6 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.glesys.domain.Archive;
import org.jclouds.glesys.domain.ArchiveAllowedArguments;
import org.jclouds.glesys.domain.ArchiveDetails;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.RequestFilters;
@ -61,21 +60,23 @@ public interface ArchiveAsyncClient {
ListenableFuture<Set<Archive>> listArchives();
/**
* @see ArchiveClient#getArchiveDetails
* @see ArchiveClient#getArchive
*/
@POST
@Path("/archive/details/format/json")
@SelectJson("details")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ArchiveDetails> getArchiveDetails(@FormParam("username") String username);
ListenableFuture<Archive> getArchive(@FormParam("username") String username);
/**
* @see ArchiveClient#createArchive
*/
@POST
@Path("/archive/create/format/json")
ListenableFuture<Void> createArchive(@FormParam("username") String username, @FormParam("password") String password,
@SelectJson("details")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Archive> createArchive(@FormParam("username") String username, @FormParam("password") String password,
@FormParam("size")int size);
/**
@ -90,13 +91,17 @@ public interface ArchiveAsyncClient {
*/
@POST
@Path("/archive/resize/format/json")
ListenableFuture<Void> resizeArchive(@FormParam("username") String username, @FormParam("size") int size);
@SelectJson("details")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Archive> resizeArchive(@FormParam("username") String username, @FormParam("size") int size);
/**
* @see ArchiveClient#changeArchivePassword
*/
@POST
@Path("/archive/changepassword/format/json")
ListenableFuture<Void> changeArchivePassword(@FormParam("username") String username, @FormParam("password") String password);
@SelectJson("details")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<Archive> changeArchivePassword(@FormParam("username") String username, @FormParam("password") String password);
/**
* @see org.jclouds.glesys.features.ArchiveClient#getArchiveAllowedArguments

View File

@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.glesys.domain.Archive;
import org.jclouds.glesys.domain.ArchiveAllowedArguments;
import org.jclouds.glesys.domain.ArchiveDetails;
/**
* Provides synchronous access to Archive requests.
@ -48,7 +47,7 @@ public interface ArchiveClient {
* @param username the username associated with the archive
* @return the archive information or null if not found
*/
ArchiveDetails getArchiveDetails(String username);
Archive getArchive(String username);
/**
* Create a new backup volume.
@ -58,7 +57,7 @@ public interface ArchiveClient {
* @param password the new password
* @param size the new size required in GB
*/
void createArchive(String username, String password, int size);
Archive createArchive(String username, String password, int size);
/**
* Delete an archive volume. All files on the volume
@ -75,7 +74,7 @@ public interface ArchiveClient {
* @param username the username associated with the archive
* @param size the new size required, see #getArchiveAllowedArguments for valid values
*/
void resizeArchive(String username, int size);
Archive resizeArchive(String username, int size);
/**
* Change the password for an archive user.
@ -83,7 +82,7 @@ public interface ArchiveClient {
* @param username the archive username
* @param password the new password
*/
void changeArchivePassword(String username, String password);
Archive changeArchivePassword(String username, String password);
/**
* Lists the allowed arguments for some of the functions in this module such as archive size.