diff --git a/client2/pom.xml b/client2/pom.xml index 9c2fb6e6b0..0c7e5d16ba 100644 --- a/client2/pom.xml +++ b/client2/pom.xml @@ -124,6 +124,8 @@ java com.walmartlabs.concord.client2 com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 src/gen/java/main java8 diff --git a/client2/src/main/java/com/walmartlabs/concord/client2/ApiClientFactory.java b/client2/src/main/java/com/walmartlabs/concord/client2/ApiClientFactory.java index bcdea8e8be..f0670a40c4 100644 --- a/client2/src/main/java/com/walmartlabs/concord/client2/ApiClientFactory.java +++ b/client2/src/main/java/com/walmartlabs/concord/client2/ApiClientFactory.java @@ -20,8 +20,6 @@ * ===== */ -import com.walmartlabs.concord.ApiClient; - public interface ApiClientFactory { ApiClient create(ApiClientConfiguration cfg); diff --git a/client2/src/main/java/com/walmartlabs/concord/client2/ClientUtils.java b/client2/src/main/java/com/walmartlabs/concord/client2/ClientUtils.java index 7ffa7396b8..70f59f1575 100644 --- a/client2/src/main/java/com/walmartlabs/concord/client2/ClientUtils.java +++ b/client2/src/main/java/com/walmartlabs/concord/client2/ClientUtils.java @@ -20,8 +20,6 @@ * ===== */ -import com.walmartlabs.concord.ApiException; -import com.walmartlabs.concord.ApiResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/client2/src/main/java/com/walmartlabs/concord/client2/ConcordApiClient.java b/client2/src/main/java/com/walmartlabs/concord/client2/ConcordApiClient.java index d2e3b1aaad..5de11e5b15 100644 --- a/client2/src/main/java/com/walmartlabs/concord/client2/ConcordApiClient.java +++ b/client2/src/main/java/com/walmartlabs/concord/client2/ConcordApiClient.java @@ -20,13 +20,10 @@ * ===== */ -import com.walmartlabs.concord.ApiClient; - import javax.net.ssl.*; import java.net.http.HttpClient; import java.security.GeneralSecurityException; import java.security.SecureRandom; -import java.security.cert.CertificateException; import java.security.cert.X509Certificate; public class ConcordApiClient extends ApiClient { diff --git a/client2/src/main/java/com/walmartlabs/concord/client2/CreateSecretRequest.java b/client2/src/main/java/com/walmartlabs/concord/client2/CreateSecretRequest.java index 674b4c4caa..1953a00c50 100644 --- a/client2/src/main/java/com/walmartlabs/concord/client2/CreateSecretRequest.java +++ b/client2/src/main/java/com/walmartlabs/concord/client2/CreateSecretRequest.java @@ -21,6 +21,9 @@ */ +import com.walmartlabs.concord.client2.ImmutableCreateSecretRequest; +import com.walmartlabs.concord.client2.ImmutableKeyPair; +import com.walmartlabs.concord.client2.ImmutableUsernamePassword; import org.immutables.value.Value; import javax.annotation.Nullable; diff --git a/client2/src/main/java/com/walmartlabs/concord/client2/ProcessListFilter.java b/client2/src/main/java/com/walmartlabs/concord/client2/ProcessListFilter.java index 73385ddd9a..d3003e2cdb 100644 --- a/client2/src/main/java/com/walmartlabs/concord/client2/ProcessListFilter.java +++ b/client2/src/main/java/com/walmartlabs/concord/client2/ProcessListFilter.java @@ -20,6 +20,8 @@ * ===== */ +import com.walmartlabs.concord.client2.ImmutableProcessListFilter; +import com.walmartlabs.concord.client2.ProcessDataInclude; import org.immutables.value.Value; import javax.annotation.Nullable; diff --git a/client2/src/main/java/com/walmartlabs/concord/client2/SecretClient.java b/client2/src/main/java/com/walmartlabs/concord/client2/SecretClient.java index 1c987d29fd..e529d25c8b 100644 --- a/client2/src/main/java/com/walmartlabs/concord/client2/SecretClient.java +++ b/client2/src/main/java/com/walmartlabs/concord/client2/SecretClient.java @@ -20,9 +20,6 @@ * ===== */ -import com.walmartlabs.concord.ApiClient; -import com.walmartlabs.concord.ApiException; -import com.walmartlabs.concord.ApiResponse; import com.walmartlabs.concord.common.secret.BinaryDataSecret; import com.walmartlabs.concord.common.secret.KeyPair; import com.walmartlabs.concord.common.secret.UsernamePassword; diff --git a/client2/src/main/java/com/walmartlabs/concord/client2/impl/ResponseBodyHandler.java b/client2/src/main/java/com/walmartlabs/concord/client2/impl/ResponseBodyHandler.java index 4dcee6eae7..630c746c07 100644 --- a/client2/src/main/java/com/walmartlabs/concord/client2/impl/ResponseBodyHandler.java +++ b/client2/src/main/java/com/walmartlabs/concord/client2/impl/ResponseBodyHandler.java @@ -22,7 +22,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import com.walmartlabs.concord.ApiException; +import com.walmartlabs.concord.client2.ApiException; import java.io.IOException; import java.io.InputStream; diff --git a/client2/src/test/java/com/walmartlabs/concord/client2/ApiClientJsonTest.java b/client2/src/test/java/com/walmartlabs/concord/client2/ApiClientJsonTest.java index df866392a3..9ec64cebba 100644 --- a/client2/src/test/java/com/walmartlabs/concord/client2/ApiClientJsonTest.java +++ b/client2/src/test/java/com/walmartlabs/concord/client2/ApiClientJsonTest.java @@ -21,7 +21,6 @@ */ import com.fasterxml.jackson.databind.ObjectMapper; -import com.walmartlabs.concord.ApiClient; import org.junit.jupiter.api.Test; import java.text.SimpleDateFormat; diff --git a/client2/src/test/java/com/walmartlabs/concord/client2/ProcessApiTest.java b/client2/src/test/java/com/walmartlabs/concord/client2/ProcessApiTest.java index 95b39e0cba..6591f365ab 100644 --- a/client2/src/test/java/com/walmartlabs/concord/client2/ProcessApiTest.java +++ b/client2/src/test/java/com/walmartlabs/concord/client2/ProcessApiTest.java @@ -20,7 +20,6 @@ * ===== */ -import com.walmartlabs.concord.ApiClient; import com.walmartlabs.concord.client2.impl.auth.ApiKey; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/client2/src/test/java/com/walmartlabs/concord/client2/SecretClientTest.java b/client2/src/test/java/com/walmartlabs/concord/client2/SecretClientTest.java index 2001ba9af7..aa0f7da105 100644 --- a/client2/src/test/java/com/walmartlabs/concord/client2/SecretClientTest.java +++ b/client2/src/test/java/com/walmartlabs/concord/client2/SecretClientTest.java @@ -22,7 +22,6 @@ import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; -import com.walmartlabs.concord.ApiClient; import com.walmartlabs.concord.client2.impl.auth.ApiKey; import com.walmartlabs.concord.common.secret.BinaryDataSecret; import com.walmartlabs.concord.sdk.Constants; diff --git a/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTask.java b/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTask.java index 5b26f3b23c..cbd91d1fc0 100644 --- a/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTask.java +++ b/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTask.java @@ -21,7 +21,7 @@ */ import com.walmartlabs.concord.ApiClient; -import com.walmartlabs.concord.client2.*; +import com.walmartlabs.concord.client.*; import com.walmartlabs.concord.sdk.Context; import com.walmartlabs.concord.sdk.ContextUtils; import com.walmartlabs.concord.sdk.Task; diff --git a/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskUtils.java b/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskUtils.java index ebb0fa38d5..bc24e1ca4e 100644 --- a/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskUtils.java +++ b/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskUtils.java @@ -20,7 +20,7 @@ * ===== */ -import com.walmartlabs.concord.client2.*; +import com.walmartlabs.concord.client.*; import com.walmartlabs.concord.sdk.MapUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -102,7 +102,7 @@ public static List findHostsWithArtifacts(NodeRosterHostsApi api, "(limit: {}, offset: {})...", artifactPattern, limit, offset); return ClientUtils.withRetry(Constants.RETRY_COUNT, Constants.RETRY_INTERVAL, () -> - api.listKnownHosts(null, artifactPattern, null, null, limit, offset)); + api.list(null, artifactPattern, null, null, limit, offset)); } /** @@ -123,6 +123,6 @@ public static List findDeployedArtifacts(NodeRosterArtifactsApi a log.info("Finding artifacts deployed on a host (hostName: {}, hostId: {})...", hostName, hostId); return ClientUtils.withRetry(Constants.RETRY_COUNT, Constants.RETRY_INTERVAL, () -> - api.listHostArtifacts(hostId, hostName, null, limit, offset)); + api.list(hostId, hostName, null, limit, offset)); } } diff --git a/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskV2.java b/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskV2.java index 0aba8a85cc..3fa336e2ff 100644 --- a/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskV2.java +++ b/plugins/tasks/noderoster/src/main/java/com/walmartlabs/concord/plugins/noderoster/NodeRosterTaskV2.java @@ -21,7 +21,7 @@ */ import com.walmartlabs.concord.ApiClient; -import com.walmartlabs.concord.client2.*; +import com.walmartlabs.concord.client.*; import com.walmartlabs.concord.runtime.v2.sdk.Task; import com.walmartlabs.concord.runtime.v2.sdk.TaskResult; import com.walmartlabs.concord.runtime.v2.sdk.Variables; diff --git a/server/plugins/ansible/client/pom.xml b/server/plugins/ansible/client/pom.xml index d64187da31..91df5732b6 100644 --- a/server/plugins/ansible/client/pom.xml +++ b/server/plugins/ansible/client/pom.xml @@ -13,10 +13,40 @@ concord-ansible-plugin-client jar + + 1.5.20 + + com.walmartlabs.concord - concord-client2 + concord-client + + + + com.squareup.okhttp + okhttp + + + com.squareup.okhttp + logging-interceptor + + + com.squareup.okio + okio + + + com.google.code.gson + gson + + + io.swagger + swagger-annotations + ${swagger.version} + + + io.gsonfire + gson-fire @@ -29,38 +59,32 @@ - org.openapitools - openapi-generator-maven-plugin - 6.6.0 + io.swagger + swagger-codegen-maven-plugin generate - ${project.basedir}/../impl/target/classes/com/walmartlabs/concord/server/plugins/ansible/swagger/swagger.yaml - java - com.walmartlabs.concord.client2 - com.walmartlabs.concord.client2 + ${project.basedir}/swagger.json + java + + false + + ${project.basedir}/../../../../client/src/main/template + okhttp-gson + + com.walmartlabs.concord.client + com.walmartlabs.concord.client src/gen/java/main java8 true - false - false - false - native false false false - false - true - ApiClient.java,ApiResponse.java,ApiException.java,Pair.java - ../../../../client2/src/main/template - true - string+binary=InputStream - InputStream=java.io.InputStream diff --git a/server/plugins/ansible/client/swagger.json b/server/plugins/ansible/client/swagger.json new file mode 100644 index 0000000000..9fc868d231 --- /dev/null +++ b/server/plugins/ansible/client/swagger.json @@ -0,0 +1,498 @@ +{ + "swagger" : "2.0", + "info" : { + "version" : "v1", + "title" : "Concord Ansible API" + }, + "host" : "localhost:8001", + "basePath" : "/", + "tags" : [ { + "name" : "Ansible Process" + } ], + "schemes" : [ "http" ], + "paths" : { + "/api/v1/process/{processInstanceId}/ansible/events" : { + "get" : { + "tags" : [ "Ansible Process" ], + "summary" : "List Ansible events of a specific process", + "description" : "", + "operationId" : "listEvents", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "processInstanceId", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "host", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "hostGroup", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "status", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "playbookId", + "in" : "query", + "required" : false, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/AnsibleProcessEventEntry" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/process/{processInstanceId}/ansible/hosts" : { + "get" : { + "tags" : [ "Ansible Process" ], + "summary" : "List Ansible hosts of a specific process", + "description" : "", + "operationId" : "list", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "processInstanceId", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "host", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "hostGroup", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "status", + "in" : "query", + "required" : false, + "type" : "string", + "enum" : [ "RUNNING", "CHANGED", "FAILED", "OK", "SKIPPED", "UNREACHABLE" ] + }, { + "name" : "statuses", + "in" : "query", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "RUNNING", "CHANGED", "FAILED", "OK", "SKIPPED", "UNREACHABLE" ] + }, + "collectionFormat" : "multi" + }, { + "name" : "playbookId", + "in" : "query", + "required" : false, + "type" : "string", + "format" : "uuid" + }, { + "name" : "limit", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 30, + "format" : "int32" + }, { + "name" : "offset", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 0, + "format" : "int32" + }, { + "name" : "sortField", + "in" : "query", + "required" : false, + "type" : "string", + "enum" : [ "HOST", "DURATION", "STATUS", "HOST_GROUP" ] + }, { + "name" : "sortBy", + "in" : "query", + "required" : false, + "type" : "string", + "enum" : [ "ASC", "DESC" ] + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/AnsibleHostListResponse" + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/process/{processInstanceId}/ansible/playbooks" : { + "get" : { + "tags" : [ "Ansible Process" ], + "summary" : "List Ansible playbooks of a specific process", + "description" : "", + "operationId" : "listPlaybooks", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "processInstanceId", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/PlaybookEntry" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/process/{processInstanceId}/ansible/tasks" : { + "get" : { + "tags" : [ "Ansible Process" ], + "summary" : "List Ansible plays of a specific process", + "description" : "", + "operationId" : "listTasks", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "processInstanceId", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "playId", + "in" : "query", + "required" : false, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/TaskInfo" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/process/{processInstanceId}/ansible/{playbookId}/plays" : { + "get" : { + "tags" : [ "Ansible Process" ], + "summary" : "List Ansible plays of a specific process", + "description" : "", + "operationId" : "listPlays", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "processInstanceId", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "playbookId", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/PlayInfo" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + } + }, + "securityDefinitions" : { + "api_key" : { + "description" : "API key", + "type" : "apiKey", + "name" : "api_key", + "in" : "header" + }, + "ldap" : { + "description" : "AD/LDAP username/password", + "type" : "basic" + }, + "session_key" : { + "description" : "Process session key", + "type" : "apiKey", + "name" : "session_key", + "in" : "header" + } + }, + "definitions" : { + "AnsibleHostEntry" : { + "type" : "object", + "properties" : { + "host" : { + "type" : "string", + "readOnly" : true + }, + "hostGroup" : { + "type" : "string", + "readOnly" : true + }, + "status" : { + "type" : "string", + "readOnly" : true, + "enum" : [ "RUNNING", "CHANGED", "FAILED", "OK", "SKIPPED", "UNREACHABLE" ] + }, + "duration" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + } + } + }, + "AnsibleHostListResponse" : { + "type" : "object", + "properties" : { + "hostGroups" : { + "type" : "array", + "readOnly" : true, + "items" : { + "type" : "string" + } + }, + "items" : { + "type" : "array", + "readOnly" : true, + "items" : { + "$ref" : "#/definitions/AnsibleHostEntry" + } + } + } + }, + "AnsibleProcessEventEntry" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + }, + "eventType" : { + "type" : "string", + "readOnly" : true + }, + "data" : { + "type" : "object", + "readOnly" : true + }, + "eventDate" : { + "type" : "string", + "format" : "date-time", + "readOnly" : true + } + } + }, + "PlayInfo" : { + "type" : "object", + "properties" : { + "playId" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + }, + "playName" : { + "type" : "string", + "readOnly" : true + }, + "playOrder" : { + "type" : "integer", + "format" : "int32", + "readOnly" : true + }, + "hostCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "taskCount" : { + "type" : "integer", + "format" : "int32", + "readOnly" : true + }, + "taskStats" : { + "type" : "object", + "readOnly" : true, + "additionalProperties" : { + "type" : "integer", + "format" : "int64" + } + }, + "finishedTaskCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + } + } + }, + "PlaybookEntry" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + }, + "name" : { + "type" : "string", + "readOnly" : true + }, + "startedAt" : { + "type" : "string", + "format" : "date-time", + "readOnly" : true + }, + "hostsCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "failedHostsCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "playsCount" : { + "type" : "integer", + "format" : "int32", + "readOnly" : true + }, + "failedTasksCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "progress" : { + "type" : "integer", + "format" : "int32", + "readOnly" : true + }, + "status" : { + "type" : "string", + "readOnly" : true, + "enum" : [ "RUNNING", "OK", "FAILED" ] + }, + "retryNum" : { + "type" : "integer", + "format" : "int32", + "readOnly" : true + } + } + }, + "TaskInfo" : { + "type" : "object", + "properties" : { + "taskName" : { + "type" : "string", + "readOnly" : true + }, + "type" : { + "type" : "string", + "readOnly" : true, + "enum" : [ "TASK", "SETUP", "HANDLER" ] + }, + "taskOrder" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "okCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "failedCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "unreachableCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "skippedCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + }, + "runningCount" : { + "type" : "integer", + "format" : "int64", + "readOnly" : true + } + } + } + } +} \ No newline at end of file diff --git a/server/plugins/ansible/client2/pom.xml b/server/plugins/ansible/client2/pom.xml new file mode 100644 index 0000000000..b3d066f396 --- /dev/null +++ b/server/plugins/ansible/client2/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + + com.walmartlabs.concord.server.plugins.ansible + parent + 2.0.1-SNAPSHOT + ../pom.xml + + + concord-ansible-plugin-client2 + jar + + + + com.walmartlabs.concord + concord-client2 + + + + + javax.annotation + javax.annotation-api + + + + + + + org.openapitools + openapi-generator-maven-plugin + 6.6.0 + + + + generate + + + ${project.basedir}/../impl/target/classes/com/walmartlabs/concord/server/plugins/ansible/swagger/swagger.yaml + java + com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 + + src/gen/java/main + java8 + true + false + false + + false + native + false + false + false + false + true + ApiClient.java,ApiResponse.java,ApiException.java,Pair.java + ../../../../client2/src/main/template + true + string+binary=InputStream + InputStream=java.io.InputStream + + + + + + + diff --git a/server/plugins/ansible/impl/src/main/resources/openapi-ansible-config.yaml b/server/plugins/ansible/impl/src/main/resources/openapi-ansible-config.yaml index 11dbe37efc..23d457daf5 100644 --- a/server/plugins/ansible/impl/src/main/resources/openapi-ansible-config.yaml +++ b/server/plugins/ansible/impl/src/main/resources/openapi-ansible-config.yaml @@ -2,4 +2,4 @@ openAPI: info: version: '2.0' title: Concord Ansible API - description: Concord Server API + description: Concord Ansible API diff --git a/server/plugins/ansible/pom.xml b/server/plugins/ansible/pom.xml index f4d534f254..584e023259 100644 --- a/server/plugins/ansible/pom.xml +++ b/server/plugins/ansible/pom.xml @@ -19,6 +19,7 @@ db impl client + client2 diff --git a/server/plugins/noderoster/client/pom.xml b/server/plugins/noderoster/client/pom.xml index d4f862f1ca..28d0ae191f 100644 --- a/server/plugins/noderoster/client/pom.xml +++ b/server/plugins/noderoster/client/pom.xml @@ -13,15 +13,40 @@ concord-noderoster-plugin-client jar + + 1.5.20 + + com.walmartlabs.concord - concord-client2 + concord-client - com.fasterxml.jackson.core - jackson-annotations + com.squareup.okhttp + okhttp + + + com.squareup.okhttp + logging-interceptor + + + com.squareup.okio + okio + + + com.google.code.gson + gson + + + io.swagger + swagger-annotations + ${swagger.version} + + + io.gsonfire + gson-fire @@ -34,38 +59,32 @@ - org.openapitools - openapi-generator-maven-plugin - 6.6.0 + io.swagger + swagger-codegen-maven-plugin generate - ${project.basedir}/../impl/target/classes/com/walmartlabs/concord/server/plugins/noderoster/swagger/swagger.yaml - java - com.walmartlabs.concord.client2 - com.walmartlabs.concord.client2 + ${project.basedir}/swagger.json + java + + false + + ../../../../client/src/main/template + okhttp-gson + + com.walmartlabs.concord.client + com.walmartlabs.concord.client src/gen/java/main java8 true - false - false - false - native false false false - false - true - ApiClient.java,ApiResponse.java,ApiException.java,Pair.java - ../../../../client2/src/main/template - true - string+binary=InputStream - InputStream=java.io.InputStream diff --git a/server/plugins/noderoster/client/swagger.json b/server/plugins/noderoster/client/swagger.json new file mode 100644 index 0000000000..06209e832f --- /dev/null +++ b/server/plugins/noderoster/client/swagger.json @@ -0,0 +1,357 @@ +{ + "swagger" : "2.0", + "info" : { + "version" : "v1", + "title" : "Concord Node Roster API" + }, + "host" : "localhost:8002", + "basePath" : "/", + "tags" : [ { + "name" : "Node Roster Artifacts" + }, { + "name" : "Node Roster Facts" + }, { + "name" : "Node Roster Hosts" + }, { + "name" : "Node Roster Processes" + } ], + "schemes" : [ "http" ], + "paths" : { + "/api/v1/noderoster/artifacts" : { + "get" : { + "tags" : [ "Node Roster Artifacts" ], + "summary" : "List artifacts deployed on a host", + "description" : "", + "operationId" : "list", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "hostId", + "in" : "query", + "required" : false, + "type" : "string", + "format" : "uuid" + }, { + "name" : "hostName", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "filter", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "limit", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 30, + "format" : "int32" + }, { + "name" : "offset", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 0, + "format" : "int32" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/ArtifactEntry" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/noderoster/facts/last" : { + "get" : { + "tags" : [ "Node Roster Facts" ], + "summary" : "Get last known Ansible facts for a host", + "description" : "", + "operationId" : "getFacts", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "hostId", + "in" : "query", + "required" : false, + "type" : "string", + "format" : "uuid" + }, { + "name" : "hostName", + "in" : "query", + "required" : false, + "type" : "string" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object" + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/noderoster/hosts" : { + "get" : { + "tags" : [ "Node Roster Hosts" ], + "summary" : "List all known hosts", + "description" : "", + "operationId" : "list", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "host", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "artifact", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "processInstanceId", + "in" : "query", + "required" : false, + "type" : "string", + "format" : "uuid" + }, { + "name" : "include", + "in" : "query", + "required" : false, + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "ARTIFACTS" ] + }, + "collectionFormat" : "multi" + }, { + "name" : "limit", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 30, + "format" : "int32" + }, { + "name" : "offset", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 0, + "format" : "int32" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/HostEntry" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/noderoster/hosts/{hostId}" : { + "get" : { + "tags" : [ "Node Roster Hosts" ], + "summary" : "Get a host", + "description" : "", + "operationId" : "get", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "hostId", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/HostEntry" + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + }, + "/api/v1/noderoster/processes" : { + "get" : { + "tags" : [ "Node Roster Processes" ], + "summary" : "Get all known hosts", + "description" : "", + "operationId" : "list", + "produces" : [ "application/json" ], + "parameters" : [ { + "name" : "hostId", + "in" : "query", + "required" : false, + "type" : "string", + "format" : "uuid" + }, { + "name" : "hostName", + "in" : "query", + "required" : false, + "type" : "string" + }, { + "name" : "limit", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 30, + "format" : "int32" + }, { + "name" : "offset", + "in" : "query", + "required" : false, + "type" : "integer", + "default" : 0, + "format" : "int32" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/ProcessEntry" + } + } + } + }, + "security" : [ { + "api_key" : [ ] + }, { + "session_key" : [ ] + }, { + "ldap" : [ ] + } ] + } + } + }, + "securityDefinitions" : { + "api_key" : { + "description" : "API key", + "type" : "apiKey", + "name" : "api_key", + "in" : "header" + }, + "ldap" : { + "description" : "AD/LDAP username/password", + "type" : "basic" + }, + "session_key" : { + "description" : "Process session key", + "type" : "apiKey", + "name" : "session_key", + "in" : "header" + } + }, + "definitions" : { + "ArtifactEntry" : { + "type" : "object", + "properties" : { + "url" : { + "type" : "string", + "readOnly" : true + }, + "processInstanceId" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + } + } + }, + "HostEntry" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + }, + "name" : { + "type" : "string", + "readOnly" : true + }, + "createdAt" : { + "type" : "string", + "format" : "date-time", + "readOnly" : true + }, + "artifactUrl" : { + "type" : "string", + "readOnly" : true + } + } + }, + "ProcessEntry" : { + "type" : "object", + "properties" : { + "instanceId" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + }, + "createdAt" : { + "type" : "string", + "format" : "date-time", + "readOnly" : true + }, + "projectId" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + }, + "projectName" : { + "type" : "string", + "readOnly" : true + }, + "initiatorId" : { + "type" : "string", + "format" : "uuid", + "readOnly" : true + }, + "initiator" : { + "type" : "string", + "readOnly" : true + } + } + } + } +} \ No newline at end of file diff --git a/server/plugins/noderoster/client2/pom.xml b/server/plugins/noderoster/client2/pom.xml new file mode 100644 index 0000000000..e98325fb67 --- /dev/null +++ b/server/plugins/noderoster/client2/pom.xml @@ -0,0 +1,77 @@ + + + + 4.0.0 + + + com.walmartlabs.concord.server.plugins.noderoster + parent + 2.0.1-SNAPSHOT + ../pom.xml + + + concord-noderoster-plugin-client2 + jar + + + + com.walmartlabs.concord + concord-client2 + + + + com.fasterxml.jackson.core + jackson-annotations + + + + + javax.annotation + javax.annotation-api + + + + + + + org.openapitools + openapi-generator-maven-plugin + 6.6.0 + + + + generate + + + ${project.basedir}/../impl/target/classes/com/walmartlabs/concord/server/plugins/noderoster/swagger/swagger.yaml + java + com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 + com.walmartlabs.concord.client2 + + src/gen/java/main + java8 + true + false + false + + false + native + false + false + false + false + true + ApiClient.java,ApiResponse.java,ApiException.java,Pair.java + ../../../../client2/src/main/template + true + string+binary=InputStream + InputStream=java.io.InputStream + + + + + + + diff --git a/server/plugins/noderoster/impl/src/main/resources/openapi-noderoster-config.yaml b/server/plugins/noderoster/impl/src/main/resources/openapi-noderoster-config.yaml index eb3830e83c..9bd8cb4ff6 100644 --- a/server/plugins/noderoster/impl/src/main/resources/openapi-noderoster-config.yaml +++ b/server/plugins/noderoster/impl/src/main/resources/openapi-noderoster-config.yaml @@ -2,4 +2,4 @@ openAPI: info: version: '2.0' title: Concord Node Roster API - description: Concord Server API + description: Concord Node Roster API diff --git a/server/plugins/noderoster/pom.xml b/server/plugins/noderoster/pom.xml index 4faf9f9c0b..cd1b5f075b 100644 --- a/server/plugins/noderoster/pom.xml +++ b/server/plugins/noderoster/pom.xml @@ -18,5 +18,6 @@ db impl client + client2