diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2018-07-18 08:47:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-18 08:47:48 +0200 |
commit | b7d32555d1569c72c7590e8e1be07aaef4ad67e9 (patch) | |
tree | 66bf31cf62a99831e9ec13f93d5fc03ef61fd4c0 | |
parent | 40562f24df753a8c85b31e33215b62d4a26980ce (diff) | |
parent | b98e081264c98f8d6df4a28bd17df4435dc28e4b (diff) |
Merge pull request #6408 from vespa-engine/freva/submit-options
Add SubmitOptions and SubmitResult
3 files changed, 94 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java index 812c4a60288..bea496c19d7 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java @@ -36,8 +36,10 @@ public interface EnvironmentResource { String API_PATH = "environment"; + String APPLICATION_TEST_ZIP = "applicationTestZip"; String APPLICATION_ZIP = "applicationZip"; String DEPLOY_OPTIONS = "deployOptions"; + String SUBMIT_OPTIONS = "submitOptions"; @POST @Path("{environmentId}/region/{regionId}/instance/{instanceId}/deploy") diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/SubmitOptions.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/SubmitOptions.java new file mode 100644 index 00000000000..c3ec39683be --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/SubmitOptions.java @@ -0,0 +1,55 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.application.v4.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.yahoo.vespa.hosted.controller.api.identifiers.GitBranch; +import com.yahoo.vespa.hosted.controller.api.identifiers.GitCommit; +import com.yahoo.vespa.hosted.controller.api.identifiers.GitRepository; + +import java.util.Objects; + +/** + * Additional options to be sent along the application package and the application test package + * when submitting an application to the controller + * + * @author freva + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class SubmitOptions { + + public GitRepository gitRepository; + public GitBranch gitBranch; + public GitCommit gitCommit; + + public static SubmitOptions from(String repository, String branch, String commit) { + SubmitOptions options = new SubmitOptions(); + options.gitRepository = new GitRepository(repository); + options.gitBranch = new GitBranch(branch); + options.gitCommit = new GitCommit(commit); + return options; + } + + @Override + public String toString() { + return "SubmitOptions{" + + "gitRepository=" + gitRepository + + ", gitBranch=" + gitBranch + + ", gitCommit=" + gitCommit + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SubmitOptions that = (SubmitOptions) o; + return Objects.equals(gitRepository, that.gitRepository) && + Objects.equals(gitBranch, that.gitBranch) && + Objects.equals(gitCommit, that.gitCommit); + } + + @Override + public int hashCode() { + return Objects.hash(gitRepository, gitBranch, gitCommit); + } +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/SubmitResult.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/SubmitResult.java new file mode 100644 index 00000000000..a7f136cf3ce --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/SubmitResult.java @@ -0,0 +1,37 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.application.v4.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import java.util.Objects; + +/** + * Represents the response from application submit request + * + * @author freva + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class SubmitResult { + + public String version; + + @Override + public String toString() { + return "SubmitResult{" + + "version='" + version + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SubmitResult that = (SubmitResult) o; + return Objects.equals(version, that.version); + } + + @Override + public int hashCode() { + return Objects.hash(version); + } +} |