WIP poc
This commit is contained in:
parent
fde03662be
commit
e34fc520bd
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"serviceName": "session",
|
||||
"dotenv": ".env",
|
||||
"environment": "prod",
|
||||
"httpRequestDefinitions": {
|
||||
"sessionStart": {
|
||||
"put": {
|
||||
"username": "",
|
||||
"password": "",
|
||||
"appUUID": ""
|
||||
}
|
||||
},
|
||||
"sessionEnd": {
|
||||
"put": {
|
||||
"sessionID": "",
|
||||
"token": "",
|
||||
"appUUID": ""
|
||||
}
|
||||
},
|
||||
"keepSessionAlive": {
|
||||
"put": {
|
||||
"sessionID": "",
|
||||
"token": "",
|
||||
"appUUID": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,15 @@ from flask_restful import Resource
|
|||
|
||||
from hub_api.config import Config
|
||||
|
||||
import json
|
||||
|
||||
config_json_path = "../configs/config.json"
|
||||
|
||||
with open(config_json_path, "r") as stream:
|
||||
config = json.load(stream)
|
||||
if config:
|
||||
print(f'{json.dumps(config, indent=2)}')
|
||||
|
||||
|
||||
class Costs(Resource, Config):
|
||||
def __init__(self):
|
||||
|
|
23
microservice.py
Normal file
23
microservice.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import datetime
|
||||
|
||||
import flask
|
||||
import json
|
||||
from pathlib import Path
|
||||
from flasgger import LazyJSONEncoder, Swagger
|
||||
from flask import Response
|
||||
from flask_restful import Api
|
||||
import threading
|
||||
|
||||
app = flask.Flask('cerc_api')
|
||||
app.json_provider_class = LazyJSONEncoder
|
||||
api = Api(app)
|
||||
|
||||
# Parse and register services.json
|
||||
|
||||
services_json_path = "./configs/services.json"
|
||||
|
||||
for service in json.load(open(services_json_path)):
|
||||
print(f"service: {service}")
|
||||
api.add_resource(service["name"], service["endpoint"])
|
||||
|
||||
app.run(port=5000, debug=True, host="0.0.0.0")
|
0
microservice/__init__.py
Normal file
0
microservice/__init__.py
Normal file
9
microservice/services.json
Normal file
9
microservice/services.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"apiVersion": "v1.4.0",
|
||||
"services": [
|
||||
{
|
||||
"name": "Costs",
|
||||
"endpoint": "workflow/costs"
|
||||
}
|
||||
]
|
||||
}
|
16
microservice/workflow/costs.py
Normal file
16
microservice/workflow/costs.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from flask_restful import Resource
|
||||
|
||||
# from hub_api.config import Config
|
||||
|
||||
import json
|
||||
|
||||
|
||||
class Costs(Resource):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def post(self):
|
||||
"""
|
||||
API call for performing the cost workflow
|
||||
"""
|
||||
raise NotImplementedError()
|
Loading…
Reference in New Issue
Block a user