Skip to content
Permalink
Browse files
JCLOUDS-1457 - Add Clean Server operation to ServerApi.
  • Loading branch information
trevorflanagan authored and nacx committed Oct 18, 2018
1 parent eb99002 commit 54249bd332265490dd8bf82927bd46e501116244
Showing 5 changed files with 32 additions and 1 deletion.
@@ -22,7 +22,7 @@

public enum State {

NORMAL, FAILED_ADD, FAILED_CHANGE, FAILED_DELETE, PENDING_DELETE, DELETED, UNRECOGNIZED, PENDING_CHANGE;
NORMAL, FAILED_ADD, FAILED_CHANGE, FAILED_DELETE, PENDING_DELETE, DELETED, UNRECOGNIZED, PENDING_CHANGE, PENDING_CLEAN, REQUIRES_SUPPORT;

@Override
public String toString() {
@@ -17,6 +17,7 @@
package org.jclouds.dimensiondata.cloudcontrol.domain;

import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;

import java.util.Date;
@@ -35,6 +36,7 @@ public static Builder builder() {

public abstract String name();

@Nullable
public abstract String description();

public abstract String datacenterId();
@@ -150,6 +150,18 @@ String cloneServer(@PayloadParam("id") String id, @PayloadParam("imageName") Str
@MapBinder(BindToJsonPayload.class)
void startServer(@PayloadParam("id") String id);

/**
* Operation for cleaning servers with FAILED_ADD state
*
* @see org.jclouds.dimensiondata.cloudcontrol.domain.State.FAILED_ADD
*/
@Named("server:cleanServer")
@POST
@Path("/cleanServer")
@Produces(MediaType.APPLICATION_JSON)
@MapBinder(BindToJsonPayload.class)
void cleanServer(@PayloadParam("id") String id);

@Named("server:shutdown")
@POST
@Path("/shutdownServer")
@@ -194,6 +194,14 @@ public void testStartServer() throws Exception {
assertBodyContains(recordedRequest, "{\"id\":\"12345\"}");
}

public void testCleanServer() throws Exception {
server.enqueue(jsonResponse("/cleanServer.json"));
serverApi().cleanServer("12345");
final RecordedRequest recordedRequest = assertSent(POST,
"/caas/2.4/6ac1e746-b1ea-4da5-a24e-caf1a978789d/server/cleanServer");
assertBodyContains(recordedRequest, "{\"id\":\"12345\"}");
}

private ServerApi serverApi() {
return api.getServerApi();
}
@@ -0,0 +1,9 @@
{
"operation": "CLEAN_SERVER",
"responseCode": "IN_PROGRESS",
"message": "Request to Clean Server has been accepted. Please use appropriate Get or List API for status.",
"info": [],
"warning": [],
"error": [],
"requestId": "na9_20160321T074626030-0400_7e9fffe7-190b-46f2-9107-9d52fe57d0ad"
}

0 comments on commit 54249bd

Please sign in to comment.