From 715913f3b4dfba90c07f319f6d52137df764a439 Mon Sep 17 00:00:00 2001 From: Ivan Porto Carrero Date: Fri, 30 May 2014 15:17:53 -0700 Subject: [PATCH] Update slightly add some test files --- bin/scala-async.sh | 4 +- build.sbt | 19 +- specs/admin.json | 100 +++++++++++ specs/discovery.json | 337 +++++++++++++++++++++++++++++++++++ specs/discovery2.json | 403 ++++++++++++++++++++++++++++++++++++++++++ specs/discovery3.json | 403 ++++++++++++++++++++++++++++++++++++++++++ specs/resources.json | 15 ++ 7 files changed, 1270 insertions(+), 11 deletions(-) create mode 100755 specs/admin.json create mode 100755 specs/discovery.json create mode 100644 specs/discovery2.json create mode 100644 specs/discovery3.json create mode 100755 specs/resources.json diff --git a/bin/scala-async.sh b/bin/scala-async.sh index 289e0e43a60..c45d35c0f38 100755 --- a/bin/scala-async.sh +++ b/bin/scala-async.sh @@ -1,7 +1,7 @@ #!/bin/sh SCRIPT="$0" -SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala) +SCALA_RUNNER_VERSION=2.10 #$(scala ./bin/Version.scala) while [ -h "$SCRIPT" ] ; do ls=`ls -ld "$SCRIPT"` @@ -25,7 +25,7 @@ cd $APP_DIR ags="com.wordnik.swagger.codegen.ScalaAsyncClientGenerator $@" if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then - scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags + java -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags else echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly" fi diff --git a/build.sbt b/build.sbt index 585f7321878..2316a68ec55 100644 --- a/build.sbt +++ b/build.sbt @@ -7,7 +7,7 @@ name := "swagger-codegen" version := "2.0.16" -scalaVersion := "2.10.0" +scalaVersion := "2.10.1" crossVersion := CrossVersion.full @@ -15,29 +15,30 @@ javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:unchecked", "-X scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8") -crossScalaVersions := Seq("2.9.0", "2.9.0-1", "2.9.1", "2.9.1-1", "2.9.2", "2.9.3", "2.10.0", "2.10.1", "2.10.2") +crossScalaVersions := Seq("2.9.0", "2.9.0-1", "2.9.1", "2.9.1-1", "2.9.2", "2.9.3", "2.10.0", "2.10.1", "2.10.2", "2.10.3", "2.10.4", "2.11.0", "2.11.1") libraryDependencies ++= Seq( - "org.json4s" %% "json4s-jackson" % "3.2.5", + "org.json4s" %% "json4s-jackson" % "3.2.10", "io.backchat.inflector" %% "scala-inflector" % "1.3.5", "commons-io" % "commons-io" % "2.3", "ch.qos.logback" % "logback-classic" % "1.0.13" % "provided", - "org.rogach" %% "scallop" % "0.8.1", + "org.rogach" %% "scallop" % "0.9.5", "junit" % "junit" % "4.11" % "test", - "org.scalatest" %% "scalatest" % "1.9.1" % "test" + "org.scalatest" %% "scalatest" % "2.1.7" % "test" ) libraryDependencies <+= scalaVersion { case v if v.startsWith("2.9") => "org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1" - case v if v.startsWith("2.10") => { - "org.fusesource.scalate" %% "scalate-core" % "1.6.1" - } + case v if v.startsWith("2.10") => + "org.scalatra.scalate" %% "scalate-core" % "1.7.0" + case v if v.startsWith("2.11") => + "org.scalatra.scalate" %% "scalate-core" % "1.7.0" } libraryDependencies ++= { scalaVersion.toString match { - case v if v.startsWith("2.10") => Seq("org.scala-lang" % "scala-reflect" % v) + case v if v.startsWith("2.10") || v.startsWith("2.11") => Seq("org.scala-lang" % "scala-reflect" % v) case _ => Seq() } } diff --git a/specs/admin.json b/specs/admin.json new file mode 100755 index 00000000000..b094a63b67b --- /dev/null +++ b/specs/admin.json @@ -0,0 +1,100 @@ +{ + "apiVersion": "0.5", + "swaggerVersion": "1.1", + "basePath": "http://localhost:8000", + "resourcePath": "/admin", + "apis": [ + { + "path": "/admin.{format}/health", + "description": "Administrative operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Returns health report on this JVM", + "responseClass": "Health", + "nickname": "getHealth" + } + ] + }, + { + "path": "/admin.{format}/ping", + "description": "Administrative operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Pings service", + "responseClass": "string", + "nickname": "ping" + } + ] + } + ], + "models": { + "Memory": { + "required": false, + "id": "Memory", + "properties": { + "free": { + "required": true, + "uniqueItems": false, + "type": "long" + }, + "max": { + "required": true, + "uniqueItems": false, + "type": "long" + }, + "allocated": { + "required": true, + "uniqueItems": false, + "type": "long" + }, + "used": { + "required": true, + "uniqueItems": false, + "type": "long" + }, + "percentUsed": { + "required": true, + "uniqueItems": false, + "type": "double" + } + }, + "uniqueItems": false, + "type": "any" + }, + "Health": { + "required": false, + "id": "Health", + "properties": { + "peakThreadCount": { + "required": true, + "uniqueItems": false, + "type": "int" + }, + "memory": { + "required": true, + "uniqueItems": false, + "type": "Memory" + }, + "startedThreadCount": { + "required": true, + "uniqueItems": false, + "type": "long" + }, + "liveThreadCount": { + "required": true, + "uniqueItems": false, + "type": "int" + }, + "daemonThreadCount": { + "required": true, + "uniqueItems": false, + "type": "int" + } + }, + "uniqueItems": false, + "type": "any" + } + } +} \ No newline at end of file diff --git a/specs/discovery.json b/specs/discovery.json new file mode 100755 index 00000000000..3ce60eabc04 --- /dev/null +++ b/specs/discovery.json @@ -0,0 +1,337 @@ +{ + "apiVersion": "0.5", + "swaggerVersion": "1.1", + "basePath": "http://localhost:8000", + "resourcePath": "/discovery", + "apis": [ + { + "path": "/discovery.{format}/commission", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Perpare for a service to boot up and make contact", + "responseClass": "string", + "nickname": "commissionInstance", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service from which to anticipate contact", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "serviceName", + "description": "Name of service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "buildNumber", + "description": "Build Number of service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "cluster", + "description": "Name of cluster to launch this into", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/de-commission", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Decomission an instance and remove it", + "responseClass": "string", + "nickname": "decommissionInstance", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service to be decommissioned", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/register", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Register an instance and return its configuration", + "responseClass": "RegistrationResponse", + "nickname": "registerInstance", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service to be registered", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/config", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Returns configuration of an instance", + "responseClass": "ConfigurationResponse", + "nickname": "getInstanceConfiguration", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service for which configuration is required", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/status", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Marks an instance's status", + "responseClass": "string", + "nickname": "updateInstanceStatus", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service which is to be marked as available", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "status", + "description": "The new status", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/{targetServiceName}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return base urls for a given service", + "responseClass": "List[string]", + "nickname": "getServiceInstances", + "parameters": [ + { + "name": "sourceInstanceId", + "description": "InstanceId of the service which wants to call the target service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetServiceName", + "description": "Name of service whose instances are needed", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Source Instance not found" + }, + { + "code": 400, + "reason": "Unknown service name specified" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/services/{status}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return instances running in the zone managed by this Discovery Service", + "responseClass": "List[Instance]", + "nickname": "getServiceInstancesByStatus", + "parameters": [ + { + "name": "status", + "description": "The status for which services need to be returned", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instances not found" + }, + { + "code": 400, + "reason": "Unknown status specified" + } + ] + } + ] + } + ], + "models": { + "Instance": { + "required": false, + "id": "Instance", + "properties": { + "baseUrl": { + "required": true, + "uniqueItems": false, + "type": "string" + }, + "id": { + "required": true, + "uniqueItems": false, + "type": "long" + }, + "privateIp": { + "required": true, + "uniqueItems": false, + "type": "string" + }, + "buildNumber": { + "required": true, + "uniqueItems": false, + "type": "string" + }, + "lastPingedOn": { + "required": true, + "uniqueItems": false, + "type": "Date" + }, + "status": { + "required": true, + "uniqueItems": false, + "type": "string" + }, + "createdAt": { + "required": true, + "uniqueItems": false, + "type": "Date" + }, + "awsInstanceId": { + "required": true, + "uniqueItems": false, + "type": "string" + }, + "cluster": { + "required": true, + "uniqueItems": false, + "type": "string" + }, + "zone": { + "required": true, + "uniqueItems": false, + "type": "string" + }, + "serviceName": { + "required": true, + "uniqueItems": false, + "type": "string" + } + }, + "uniqueItems": false, + "type": "any" + }, + "ConfigurationResponse": { + "required": false, + "id": "ConfigurationResponse", + "properties": { + "config": { + "required": true, + "uniqueItems": false, + "type": "string" + } + }, + "uniqueItems": false, + "type": "any" + }, + "RegistrationResponse": { + "required": false, + "id": "RegistrationResponse", + "properties": { + "config": { + "required": true, + "uniqueItems": false, + "type": "string" + } + }, + "uniqueItems": false, + "type": "any" + } + } +} \ No newline at end of file diff --git a/specs/discovery2.json b/specs/discovery2.json new file mode 100644 index 00000000000..3f0f62f8302 --- /dev/null +++ b/specs/discovery2.json @@ -0,0 +1,403 @@ +{ + "apiVersion": "0.5", + "swaggerVersion": "1.1", + "basePath": "http://localhost:9000/", + "resourcePath": "/discovery.{format}", + "models": { + "Instance": { + "id": "Instance", + "properties": { + "baseUrl": { + "type": "string" + }, + "id": { + "type": "long" + }, + "privateIp": { + "type": "string" + }, + "buildNumber": { + "type": "string" + }, + "lastPingedOn": { + "type": "Date" + }, + "status": { + "type": "string" + }, + "createdAt": { + "type": "Date" + }, + "awsInstanceId": { + "type": "string" + }, + "cluster": { + "type": "string" + }, + "publicIp": { + "type": "string" + }, + "zone": { + "type": "string" + }, + "serviceName": { + "type": "string" + } + } + }, + "ConfigurationResponse": { + "id": "ConfigurationResponse", + "properties": { + "config": { + "type": "string" + } + } + }, + "RegistrationResponse": { + "id": "RegistrationResponse", + "properties": { + "config": { + "type": "string" + } + } + } + }, + "apis": [ + { + "path": "/discovery.{format}/commission", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Perpare for a service to boot up and make contact", + "responseClass": "string", + "nickname": "commissionInstance", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service from which to anticipate contact", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "serviceName", + "description": "Name of service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "buildNumber", + "description": "Build Number of service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "cluster", + "description": "Name of cluster to launch this into", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/de-commission", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Decomission an instance and remove it", + "responseClass": "string", + "nickname": "decommissionInstance", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service to be decommissioned", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/register", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Register an instance and return its configuration", + "responseClass": "RegistrationResponse", + "nickname": "registerInstance", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service to be registered", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/instances/{targetServiceName}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return instances accessible to a target service", + "responseClass": "List[Instance]", + "nickname": "getServiceInstances", + "parameters": [ + { + "name": "sourceInstanceId", + "description": "InstanceId of the service which wants to call the target service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetZone", + "description": "The zone in which the target service instances should be located. Valid values are all - (all zones in the same region), same - (same zone a the source service), [zone-name] - (the name of zone for example us-west-1a, us-west-1b, us-west-1c)", + "paramType": "query", + "defaultValue": "all", + "required": false, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetServiceName", + "description": "Name of service whose instances are needed", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Source Instance not found" + }, + { + "code": 400, + "reason": "Unknown service name specified" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/services/{status}/{targetServiceName}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return instances in the zone managed by this Discovery Service for a given status and and service", + "responseClass": "List[Instance]", + "nickname": "getServiceInstancesByStatusAndName", + "parameters": [ + { + "name": "status", + "description": "The status for which services need to be returned", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetServiceName", + "description": "Name of service whose instances are needed", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instances not found" + }, + { + "code": 400, + "reason": "Unknown status specified" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/config", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Returns configuration of an instance", + "responseClass": "ConfigurationResponse", + "nickname": "getInstanceConfiguration", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service for which configuration is required", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/status", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Marks an instance's status", + "responseClass": "string", + "nickname": "updateInstanceStatus", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service which is to be marked as available", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "status", + "description": "The new status", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/{targetServiceName}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return base urls accessible to a target service", + "responseClass": "List[String]", + "nickname": "getServiceInstancesUrls", + "parameters": [ + { + "name": "sourceInstanceId", + "description": "InstanceId of the service which wants to call the target service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetZone", + "description": "The zone in which the target service instances should be located. Valid values are all - (all zones in the same region), same - (same zone a the source service), [zone-name] - (the name of zone for example us-west-1a, us-west-1b, us-west-1c)", + "paramType": "query", + "defaultValue": "all", + "required": false, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetServiceName", + "description": "Name of service whose instances are needed", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Source Instance not found" + }, + { + "code": 400, + "reason": "Unknown service name specified" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/services/{status}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return instances running in the zone managed by this Discovery Service", + "responseClass": "List[Instance]", + "nickname": "getServiceInstancesByStatus", + "parameters": [ + { + "name": "status", + "description": "The status for which services need to be returned", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ], + "errorResponses": [ + { + "code": 404, + "reason": "Instances not found" + }, + { + "code": 400, + "reason": "Unknown status specified" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/specs/discovery3.json b/specs/discovery3.json new file mode 100644 index 00000000000..831d123d275 --- /dev/null +++ b/specs/discovery3.json @@ -0,0 +1,403 @@ +{ + "apiVersion": "0.5", + "swaggerVersion": "1.1", + "basePath": "http://localhost:9000/", + "resourcePath": "/discovery.{format}", + "apis": [ + { + "path": "/discovery.{format}/config", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Returns configuration of an instance", + "responseClass": "ConfigurationResponse", + "nickname": "getInstanceConfiguration", + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ], + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service for which configuration is required", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/status", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Marks an instance's status", + "responseClass": "string", + "nickname": "updateInstanceStatus", + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ], + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service which is to be marked as available", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "status", + "description": "The new status", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/{targetServiceName}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return base urls accessible to a target service", + "responseClass": "List[String]", + "nickname": "getServiceInstancesUrls", + "errorResponses": [ + { + "code": 404, + "reason": "Source Instance not found" + }, + { + "code": 400, + "reason": "Unknown service name specified" + } + ], + "parameters": [ + { + "name": "sourceInstanceId", + "description": "InstanceId of the service which wants to call the target service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetZone", + "description": "The zone in which the target service instances should be located. Valid values are all - (all zones in the same region), same - (same zone a the source service), [zone-name] - (the name of zone for example us-west-1a, us-west-1b, us-west-1c)", + "paramType": "query", + "defaultValue": "all", + "required": false, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetServiceName", + "description": "Name of service whose instances are needed", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/commission", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Perpare for a service to boot up and make contact", + "responseClass": "string", + "nickname": "commissionInstance", + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service from which to anticipate contact", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "serviceName", + "description": "Name of service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "buildNumber", + "description": "Build Number of service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "cluster", + "description": "Name of cluster to launch this into", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/de-commission", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Decomission an instance and remove it", + "responseClass": "string", + "nickname": "decommissionInstance", + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ], + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service to be decommissioned", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/register", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "POST", + "summary": "Register an instance and return its configuration", + "responseClass": "RegistrationResponse", + "nickname": "registerInstance", + "errorResponses": [ + { + "code": 404, + "reason": "Instance not found" + } + ], + "parameters": [ + { + "name": "instanceId", + "description": "InstanceId of the service to be registered", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/instances/{targetServiceName}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return instances accessible to a target service", + "responseClass": "List[Instance]", + "nickname": "getServiceInstances", + "errorResponses": [ + { + "code": 404, + "reason": "Source Instance not found" + }, + { + "code": 400, + "reason": "Unknown service name specified" + } + ], + "parameters": [ + { + "name": "sourceInstanceId", + "description": "InstanceId of the service which wants to call the target service", + "paramType": "query", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetZone", + "description": "The zone in which the target service instances should be located. Valid values are all - (all zones in the same region), same - (same zone a the source service), [zone-name] - (the name of zone for example us-west-1a, us-west-1b, us-west-1c)", + "paramType": "query", + "defaultValue": "all", + "required": false, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetServiceName", + "description": "Name of service whose instances are needed", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/services/{status}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return instances running in the zone managed by this Discovery Service", + "responseClass": "List[Instance]", + "nickname": "getServiceInstancesByStatus", + "errorResponses": [ + { + "code": 404, + "reason": "Instances not found" + }, + { + "code": 400, + "reason": "Unknown status specified" + } + ], + "parameters": [ + { + "name": "status", + "description": "The status for which services need to be returned", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + }, + { + "path": "/discovery.{format}/services/{status}/{targetServiceName}", + "description": "Discovery Service's Core Operations", + "operations": [ + { + "httpMethod": "GET", + "summary": "Return instances in the zone managed by this Discovery Service for a given status and and service", + "responseClass": "List[Instance]", + "nickname": "getServiceInstancesByStatusAndName", + "errorResponses": [ + { + "code": 404, + "reason": "Instances not found" + }, + { + "code": 400, + "reason": "Unknown status specified" + } + ], + "parameters": [ + { + "name": "status", + "description": "The status for which services need to be returned", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + }, + { + "name": "targetServiceName", + "description": "Name of service whose instances are needed", + "paramType": "path", + "required": true, + "allowMultiple": false, + "dataType": "string" + } + ] + } + ] + } + ], + "models": { + "Instance": { + "id": "Instance", + "properties": { + "baseUrl": { + "type": "string" + }, + "id": { + "type": "long" + }, + "privateIp": { + "type": "string" + }, + "buildNumber": { + "type": "string" + }, + "lastPingedOn": { + "type": "Date" + }, + "status": { + "type": "string" + }, + "createdAt": { + "type": "Date" + }, + "awsInstanceId": { + "type": "string" + }, + "cluster": { + "type": "string" + }, + "publicIp": { + "type": "string" + }, + "zone": { + "type": "string" + }, + "serviceName": { + "type": "string" + } + } + }, + "ConfigurationResponse": { + "id": "ConfigurationResponse", + "properties": { + "config": { + "type": "string" + } + } + }, + "RegistrationResponse": { + "id": "RegistrationResponse", + "properties": { + "config": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/specs/resources.json b/specs/resources.json new file mode 100755 index 00000000000..9258a3f9f5f --- /dev/null +++ b/specs/resources.json @@ -0,0 +1,15 @@ +{ + "apiVersion": "0.5", + "swaggerVersion": "1.1", + "basePath": "http://localhost:8000", + "apis": [ + { + "path": "/admin.{format}", + "description": "Administrative operations" + }, + { + "path": "/discovery.{format}", + "description": "Discovery Service's Core Operations" + } + ] +} \ No newline at end of file