Standard Version of Serverless Server.
Prerequisites:
additional Prerequisites:
TODO make and link jar
Body:
You will receive a JSON Webtoken, which you should keep, because you'll need this to access your uploaded lambda.
Body:
You will receive a JSON Webtoken, which you should keep, because you'll need this to access your updated lambda.
The old JWT is not valid anymore.
This will send you your lambda configuration.
Body:
Note that subtokens can only execute and not upload/etc. So keep your
mastertoken (token you get when you upload or update) to yourself to
maintain your function and
only give subtokens to customers.
More examples can be found under
from https://github.com/serverlessserver/standard
Serverless Server Standard
Standard Version of Serverless Server
Serverless Server lets you upload and run lambdas without much hassle about running and maintaining the server itself. It communicates through REST, so it is easy to use and extend. Applications can be build on top of it.Prerequisites:
- Docker
- Java 7 or higher
To build and run the Server:
Method 1: from Scratch
The Server runs on Spring, which needs to be imported.additional Prerequisites:
- Clone the repo:
https://github.com/serverlessserver/standard.git
- Import it into Intellij/Eclipse etc.
- Import Modules with Maven, given in
pom.xml
. - Run.
Method 2: JAR
It works on Unix-like Systems. Windows should work too but no guarantee.TODO make and link jar
- Download JAR.
- Run jar.
Method 3: Run in Docker
TODO make download link- Start Docker.
- Download Serverless Server Image from Dockerhub.
- Run.
Communicate with Server
The Server listens tohttp://localhost:8080/
, so you can try things out.Upload
If you have a lambda, you can upload it by sending aPOST
request:http://localhost:8080/lambdas
Headers:Content-Type: application/json
{
"name":"yourlambdaname",
"runtimeAttributes":{
"language":"Python3",
"libraries":[],
"code":"print(\"Hello world\")"
}
}
Update
If you want to update your lambda send aPUT
to:http://localhost:8080/lambdas/yourlambdaname
Headers:Content-Type: application/json
Authorization: Bearer tokenyougotwhenyouuploadedyourfunction
{
"name":"yourlambdaname",
"runtimeAttributes":{
"language":"Python3",
"libraries":[],
"code":"print(\"Bye world\")"
}
}
Show
If you want to check what you've uploaded, send aGET
to:http://localhost:8080/lambdas/yourlambdaname
Headers:Content-Type: application/json
Authorization: Bearer token
Execute
If you want to execute your lambda, sendPOST
to:http://localhost:8080/lambdas/yourlambdaname/execute
Headers:Content-Type: application/json
Authorization: Bearer token
{
"times":"1",
"parameters":[]
}
Subtoken
If you want to generate a Subtoken e.g. for other apps to use (= only execute) the lambda, you can send aGET
with an expirydate to:
http://localhost:8080/lambdas/panda/token?expiryDate=yourexpirydate
Content-Type: application/json
Authorization: Bearer token
Delete
If you want to delete your lambda, send aDEL
to:http://localhost:8080/lambdas/yourlambdaname
Headers:Content-Type: application/json
Authorization: Bearer token
/src/testjava/edu/teco/serverless/
and also you can check out the documentation
and concepts.from https://github.com/serverlessserver/standard
No comments:
Post a Comment