sagecontinuum / sage-ses

SAGE Edge Scheduler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sage-ses

SAGE Edge Scheduler

SAGE SES API

This is a mock API for the Sage Edge Scheduler (SES).

Authentication

SAGE users authenticate via token they can get from the SAGE website.

example:

-H "Authorization: sage <sage_user_token>"

for test environment:

-H "Authorization: sage user:test"

Start-up

docker-compose up

This starts a test environment without token verification.

CURL to GET and POST

To test the API:

export SES_URL="localhost:8080"
export SAGE_USER_TOKEN=user:testuser

/api/v1/metrics (to be completed)

To get stats of SES:

curl -X GET "${SES_URL}/api/v1/metrics"  -H "Authorization: sage ${SAGE_USER_TOKEN}"

/api/v1/goals

To get a list of goals:

curl -X GET "${SES_URL}/api/v1/goals"  -H "Authorization: sage ${SAGE_USER_TOKEN}"

To take a goal to be added:

curl -X POST "${SES_URL}/api/v1/goals?name=mygoal"  -H "Authorization: sage ${SAGE_USER_TOKEN}"

example response:

{
  "id": "0000000001",
  "name": "mygoal",
  "owner": "testuser"
}

to do the following:

export GOAL_ID=0000000001

/api/v1/goals/{id}/status

to get the current status of a goal:

curl -X GET "${SES_URL}/api/v1/goals/${GOAL_ID}/status"  -H "Authorization: sage ${SAGE_USER_TOKEN}"

to take a status of a goal to be added (e.g., SUBMITTED, SUSPENDED, SCHEDULED, ACTIVATED, DONE):

curl -X POST "${SES_URL}/api/v1/goals/${GOAL_ID}/status?status=scheduled"  -H "Authorization: sage ${SAGE_USER_TOKEN}"

/api/v1/goals/metrics

to get stats of goals:

curl -X GET "${SES_URL}/api/v1/goals/metrics"  -H "Authorization: sage ${SAGE_USER_TOKEN}"

About

SAGE Edge Scheduler


Languages

Language:Go 96.4%Language:Dockerfile 2.3%Language:Shell 1.3%