An Upstream Service Object has the following schema:
Config Value: swagger1
The upstream service exposes its documentation using the Swagger 1 format. The serviceLocation
setting must be
an HTTP
or HTTPS
URI with no auth, path, query, or fragment. Communication with the service is done via either HTTP
or HTTPS, as indicated by the protocol in the serviceLocation
.
Config Value: swagger2
The upstream service exposes its documentation using the Swagger 2 format. The serviceLocation
setting must be
an HTTP
or HTTPS
URI with no auth, path, query, or fragment. Communication with the service is done via either HTTP
or HTTPS, as indicated by the protocol in the serviceLocation
.
Config Value: lambda
The upstream service exposes its documentation using the Swagger 2 format. The serviceLocation
setting must be
the ARN
of the lambda function to invoke.
Requests are sent to the upstream service as a JSON object, formatted as follows:
{
"method": String,
"uri": String,
"headers": [
["header1", String],
["header2", String],
etc...
],
"body": base64string
}
Explanation:
method
: The http method of the request. (i.e GET
, POST
, PUT
, etc.)uri
: The endpoint called by the client.headers
: A list of all the headers, each value stored as lsit of 2 strings.body
: (optional) The body of the request, formatted as a base64 encoded string. (Note: regardless of type, the body will be passed along as a string. It is up to the Lambda microservice to decode and convert it to JSON, XML, etc.)Responses returned by the upstream service should also be a JSON object, formatted as follows:
{
"status": Int,
"headers": [
["header1", String],
["header2", String],
etc...
],
"body": base64string
}
Explanation:
status
: The three digit http status code.headers
: A list of all the headers, each value stored as list of 2 strings.body
: (optional) The body of the request, formatted as a base64 encoded string. (Note: regardless of type, the Lambda microservice should format the body as an encoded string for Shield to handle it properly.)Shield uses the AWS Java SDK for communicating with AWS Services. See the documentation on how to set up Shield with AWS Credentials.