geen/

directory
v6.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2023 License: MIT

README

Vostok/REST example

To go back to Vostok: here.


Introduction

This example illustrates several things:

  • auto-migration
  • using the CRUD functionalities (create, read, etc.)
  • scheduled jobs: starting them, rescheduling them, stopping them, tracking them

Top


Building the project & starting the server

To build

go build -i -o $GOPATH/src/bitbucket.org/oscaroscar/vostok/examples/geen/bin/rest -v bitbucket.org/oscaroscar/vostok/examples/geen/go/main

To run:

cd $GOPATH/src/bitbucket.org/oscaroscar/vostok/examples/geen && ./bin/rest -config=conf/example.dev.localhost.json

Top


Accessing the job configs

curl -H "Authorization: Bearer $(example-token-admin)"      -X GET             \
-H "Content-Type: application/json"                                            \
http://localhost:10101/restexample/rest/jobconfiguration/list/-1

where:

example-token-admin: aliased to curl --silent -X POST -H "Authorization: Basic dGVzdEBhdXRvcGFzcy5wcm86dGVzdA==" http://localhost:10101/restexample/oauth/token\?grant_type\=client_credentials | jq -r '.access_token'

Top


Force-Starting a job

curl -H "Authorization: Bearer $(example-token-admin)"      -X POST            \
-H "Content-Type: application/json"                                            \
http://localhost:10101/restexample/rest/job/run/MAKE_DEPOSIT

Top


Consulting bank account

curl -H "Authorization: Bearer $(example-token-admin)"      -X GET             \
-H "Content-Type: application/json"                                            \
http://localhost:10101/restexample/rest/account/read/1

Top


Track job execution

curl -H "Authorization: Bearer $(example-token-admin)"      -X POST            \
-H "Content-Type: application/json"                                            \
-d '{"kind":"jobsearch", "maxResults": 10}'                                    \
http://localhost:10101/restexample/rest/job/search

Top


Stopping a job

curl -H "Authorization: Bearer $(example-token-admin)"      -X POST            \
-H "Content-Type: application/json"                                            \
-d '{"kind": "jobconfiguration",
    "id": 1,
    "uid": "MAKE_DEPOSIT",
    "description": "Making a deposit",
    "schedule": "* * * * *",
    "active": false}'                                                          \
http://localhost:10101/restexample/rest/jobconfiguration/update

Top


Dry-running all the jobs

curl -H "Authorization: Bearer $(example-token-admin)"      -X GET             \
-H "Content-Type: application/json"                                            \
http://localhost:10101/restexample/rest/job/list/dryrun

Top


Directories

Path Synopsis
go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL