diff --git a/pom.xml b/pom.xml index a6cbf0b..ba5a2b7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,142 +1,142 @@ - 4.0.0 + 4.0.0 - com.github.mohitsoni - marathon-client - jar - 0.4.3-SNAPSHOT - marathon-client - A Java API client for Mesosphere's Marathon. - https://github.com/mohitsoni/marathon-client + com.github.mohitsoni + marathon-client + jar + 0.4.3-SNAPSHOT + marathon-client + A Java API client for Mesosphere's Marathon. + https://github.com/mohitsoni/marathon-client - - org.sonatype.oss - oss-parent - 7 - + + org.sonatype.oss + oss-parent + 7 + - - - com.netflix.feign - feign-core - ${feign-version} - - - com.netflix.feign - feign-gson - ${feign-version} - - - com.google.code.gson - gson - 2.3 - - - - junit - junit - 4.11 + + + com.netflix.feign + feign-core + ${feign-version} + + + com.netflix.feign + feign-gson + ${feign-version} + + + com.google.code.gson + gson + 2.3 + + + + junit + junit + 4.11 test - - + + - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + - - master - git@github.com:mohitsoni/marathon-client.git - scm:git:git@github.com:mohitsoni/marathon-client.git - scm:git:git@github.com:mohitsoni/marathon-client.git - + + master + git@github.com:mohitsoni/marathon-client.git + scm:git:git@github.com:mohitsoni/marathon-client.git + scm:git:git@github.com:mohitsoni/marathon-client.git + - - Github issues - https://github.com/mohitsoni/marathon-client/issues - + + Github issues + https://github.com/mohitsoni/marathon-client/issues + - - - Mohit Soni - mohitsoni1989@gmail.com - - + + + Mohit Soni + mohitsoni1989@gmail.com + + - - 6.1.3 - UTF-8 - + + 6.1.3 + UTF-8 + - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - UTF-8 - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + 1.6 + 1.6 + UTF-8 + + + + - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - - - - - - - + + + release-sign-artifacts + + + performRelease + true + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/mesosphere/marathon/client/Marathon.java b/src/main/java/mesosphere/marathon/client/Marathon.java index 592018e..968ea6e 100644 --- a/src/main/java/mesosphere/marathon/client/Marathon.java +++ b/src/main/java/mesosphere/marathon/client/Marathon.java @@ -1,9 +1,8 @@ package mesosphere.marathon.client; +import feign.RequestLine; import java.util.List; - import javax.inject.Named; - import mesosphere.marathon.client.model.v2.App; import mesosphere.marathon.client.model.v2.DeleteAppTaskResponse; import mesosphere.marathon.client.model.v2.DeleteAppTasksResponse; @@ -13,71 +12,71 @@ import mesosphere.marathon.client.model.v2.GetAppsResponse; import mesosphere.marathon.client.model.v2.GetEventSubscriptionRegisterResponse; import mesosphere.marathon.client.model.v2.GetEventSubscriptionsResponse; +import mesosphere.marathon.client.model.v2.GetQueueResponse; import mesosphere.marathon.client.model.v2.GetServerInfoResponse; import mesosphere.marathon.client.model.v2.GetTasksResponse; import mesosphere.marathon.client.model.v2.Group; +import mesosphere.marathon.client.model.v2.PutAppsResponse; import mesosphere.marathon.client.model.v2.Result; import mesosphere.marathon.client.utils.MarathonException; -import feign.RequestLine; public interface Marathon { + // Apps - @RequestLine("GET /v2/apps") - GetAppsResponse getApps(); + @RequestLine("GET /v2/apps") + GetAppsResponse getApps(); - @RequestLine("GET /v2/apps/{id}") - GetAppResponse getApp(@Named("id") String id) throws MarathonException; + @RequestLine("GET /v2/apps/{id}") + GetAppResponse getApp(@Named("id") String id) throws MarathonException; - @RequestLine("GET /v2/apps/{id}/tasks") - GetAppTasksResponse getAppTasks(@Named("id") String id); + @RequestLine("GET /v2/apps/{id}/tasks") + GetAppTasksResponse getAppTasks(@Named("id") String id); - @RequestLine("GET /v2/tasks") - GetTasksResponse getTasks(); + @RequestLine("GET /v2/tasks") + GetTasksResponse getTasks(); - @RequestLine("POST /v2/apps") - App createApp(App app) throws MarathonException; + @RequestLine("POST /v2/apps") + App createApp(App app) throws MarathonException; - @RequestLine("PUT /v2/apps/{app_id}") - void updateApp(@Named("app_id") String appId, App app); + @RequestLine("PUT /v2/apps/{app_id}") + PutAppsResponse updateApp(@Named("app_id") String appId, App app); - @RequestLine("POST /v2/apps/{id}/restart?force={force}") - void restartApp(@Named("id") String id,@Named("force") boolean force); + @RequestLine("POST /v2/apps/{id}/restart?force={force}") + void restartApp(@Named("id") String id, @Named("force") boolean force); - @RequestLine("DELETE /v2/apps/{id}") - Result deleteApp(@Named("id") String id) throws MarathonException; + @RequestLine("DELETE /v2/apps/{id}") + Result deleteApp(@Named("id") String id) throws MarathonException; - @RequestLine("DELETE /v2/apps/{app_id}/tasks?host={host}&scale={scale}") - DeleteAppTasksResponse deleteAppTasks(@Named("app_id") String appId, - @Named("host") String host, @Named("scale") String scale); + @RequestLine("DELETE /v2/apps/{app_id}/tasks?host={host}&scale={scale}") + DeleteAppTasksResponse deleteAppTasks(@Named("app_id") String appId, + @Named("host") String host, @Named("scale") String scale); - @RequestLine("DELETE /v2/apps/{app_id}/tasks/{task_id}?scale={scale}") - DeleteAppTaskResponse deleteAppTask(@Named("app_id") String appId, - @Named("task_id") String taskId, @Named("scale") String scale); + @RequestLine("DELETE /v2/apps/{app_id}/tasks/{task_id}?scale={scale}") + DeleteAppTaskResponse deleteAppTask(@Named("app_id") String appId, + @Named("task_id") String taskId, @Named("scale") String scale); // Groups - @RequestLine("POST /v2/groups") - Result createGroup(Group group) throws MarathonException; - - @RequestLine("DELETE /v2/groups/{id}") - Result deleteGroup(@Named("id") String id) throws MarathonException; - - @RequestLine("GET /v2/groups/{id}") - Group getGroup(@Named("id") String id) throws MarathonException; + @RequestLine("POST /v2/groups") + Result createGroup(Group group) throws MarathonException; - // Tasks + @RequestLine("DELETE /v2/groups/{id}") + Result deleteGroup(@Named("id") String id) throws MarathonException; + + @RequestLine("GET /v2/groups/{id}") + Group getGroup(@Named("id") String id) throws MarathonException; + // Tasks // Deployments - @RequestLine("GET /v2/deployments") - List getDeployments(); - - @RequestLine("DELETE /v2/deployments/{deploymentId}") - void cancelDeploymentAndRollback(@Named("deploymentId") String id); - - @RequestLine("DELETE /v2/deployments/{deploymentId}?force=true") - void cancelDeployment(@Named("deploymentId") String id); + @RequestLine("GET /v2/deployments") + List getDeployments(); - // Event Subscriptions + @RequestLine("DELETE /v2/deployments/{deploymentId}") + void cancelDeploymentAndRollback(@Named("deploymentId") String id); + @RequestLine("DELETE /v2/deployments/{deploymentId}?force=true") + void cancelDeployment(@Named("deploymentId") String id); + + // Event Subscriptions @RequestLine("POST /v2/eventSubscriptions?callbackUrl={url}") public GetEventSubscriptionRegisterResponse register(@Named("url") String url); @@ -88,12 +87,15 @@ DeleteAppTaskResponse deleteAppTask(@Named("app_id") String appId, public GetEventSubscriptionsResponse subscriptions(); // Queue + @RequestLine("GET /v2/queue") // v0.7.0 onwards + public GetQueueResponse getQueue(); + + @RequestLine("DELETE /v2/queue/{id}/delay") // v0.10.0 onwards + Result resetDelay(@Named("id") String id) throws MarathonException; // Server Info @RequestLine("GET /v2/info") GetServerInfoResponse getServerInfo(); // Miscellaneous - - } diff --git a/src/main/java/mesosphere/marathon/client/model/v2/Delay.java b/src/main/java/mesosphere/marathon/client/model/v2/Delay.java new file mode 100644 index 0000000..bf317a2 --- /dev/null +++ b/src/main/java/mesosphere/marathon/client/model/v2/Delay.java @@ -0,0 +1,33 @@ +package mesosphere.marathon.client.model.v2; + +import mesosphere.marathon.client.utils.ModelUtils; + +public class Delay { + + private boolean overdue; + private int timeLeftSeconds; + + public Delay() { + } + + public boolean isOverdue() { + return overdue; + } + + public void setOverdue(boolean overdue) { + this.overdue = overdue; + } + + public int getTimeLeftSeconds() { + return timeLeftSeconds; + } + + public void setTimeLeftSeconds(int timeLeftSeconds) { + this.timeLeftSeconds = timeLeftSeconds; + } + + @Override + public String toString() { + return ModelUtils.toString(this); + } +} diff --git a/src/main/java/mesosphere/marathon/client/model/v2/GetQueueResponse.java b/src/main/java/mesosphere/marathon/client/model/v2/GetQueueResponse.java new file mode 100644 index 0000000..2d0f757 --- /dev/null +++ b/src/main/java/mesosphere/marathon/client/model/v2/GetQueueResponse.java @@ -0,0 +1,24 @@ +package mesosphere.marathon.client.model.v2; + +import java.util.Collection; + +/** + * + * @author Tom Ladyman + */ +public class GetQueueResponse { + + Collection queue; + + public GetQueueResponse() { + } + + public Collection getQueue() { + return queue; + } + + public void setQueue(Collection queue) { + this.queue = queue; + } + +} diff --git a/src/main/java/mesosphere/marathon/client/model/v2/PutAppsResponse.java b/src/main/java/mesosphere/marathon/client/model/v2/PutAppsResponse.java new file mode 100644 index 0000000..1600ae2 --- /dev/null +++ b/src/main/java/mesosphere/marathon/client/model/v2/PutAppsResponse.java @@ -0,0 +1,33 @@ +package mesosphere.marathon.client.model.v2; + +import mesosphere.marathon.client.utils.ModelUtils; + +public class PutAppsResponse { + + private String deploymentId; + private String version; + + public PutAppsResponse() { + } + + public String getDeploymentId() { + return deploymentId; + } + + public void setDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @Override + public String toString() { + return ModelUtils.toString(this); + } +} diff --git a/src/main/java/mesosphere/marathon/client/model/v2/Queue.java b/src/main/java/mesosphere/marathon/client/model/v2/Queue.java new file mode 100644 index 0000000..0b7dfdf --- /dev/null +++ b/src/main/java/mesosphere/marathon/client/model/v2/Queue.java @@ -0,0 +1,43 @@ +package mesosphere.marathon.client.model.v2; + +import mesosphere.marathon.client.utils.ModelUtils; + +public class Queue { + + private int count; + private Delay delay; + private App app; + + public Queue() { + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } + + public Delay getDelay() { + return delay; + } + + public void setDelay(Delay delay) { + this.delay = delay; + } + + public App getApp() { + return app; + } + + public void setApp(App app) { + this.app = app; + } + + @Override + public String toString() { + return ModelUtils.toString(this); + } + +}