Update slightly add some test files

This commit is contained in:
Ivan Porto Carrero 2014-05-30 15:17:53 -07:00
parent 1c2c4fdcd3
commit 715913f3b4
7 changed files with 1270 additions and 11 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
SCRIPT="$0" SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala) SCALA_RUNNER_VERSION=2.10 #$(scala ./bin/Version.scala)
while [ -h "$SCRIPT" ] ; do while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"` ls=`ls -ld "$SCRIPT"`
@ -25,7 +25,7 @@ cd $APP_DIR
ags="com.wordnik.swagger.codegen.ScalaAsyncClientGenerator $@" ags="com.wordnik.swagger.codegen.ScalaAsyncClientGenerator $@"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then 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 else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly" echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi fi

View File

@ -7,7 +7,7 @@ name := "swagger-codegen"
version := "2.0.16" version := "2.0.16"
scalaVersion := "2.10.0" scalaVersion := "2.10.1"
crossVersion := CrossVersion.full 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") 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( libraryDependencies ++= Seq(
"org.json4s" %% "json4s-jackson" % "3.2.5", "org.json4s" %% "json4s-jackson" % "3.2.10",
"io.backchat.inflector" %% "scala-inflector" % "1.3.5", "io.backchat.inflector" %% "scala-inflector" % "1.3.5",
"commons-io" % "commons-io" % "2.3", "commons-io" % "commons-io" % "2.3",
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided", "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", "junit" % "junit" % "4.11" % "test",
"org.scalatest" %% "scalatest" % "1.9.1" % "test" "org.scalatest" %% "scalatest" % "2.1.7" % "test"
) )
libraryDependencies <+= scalaVersion { libraryDependencies <+= scalaVersion {
case v if v.startsWith("2.9") => case v if v.startsWith("2.9") =>
"org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1" "org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1"
case v if v.startsWith("2.10") => { case v if v.startsWith("2.10") =>
"org.fusesource.scalate" %% "scalate-core" % "1.6.1" "org.scalatra.scalate" %% "scalate-core" % "1.7.0"
} case v if v.startsWith("2.11") =>
"org.scalatra.scalate" %% "scalate-core" % "1.7.0"
} }
libraryDependencies ++= { libraryDependencies ++= {
scalaVersion.toString match { 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() case _ => Seq()
} }
} }

100
specs/admin.json Executable file
View File

@ -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"
}
}
}

337
specs/discovery.json Executable file
View File

@ -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"
}
}
}

403
specs/discovery2.json Normal file
View File

@ -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"
}
]
}
]
}
]
}

403
specs/discovery3.json Normal file
View File

@ -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"
}
}
}
}
}

15
specs/resources.json Executable file
View File

@ -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"
}
]
}