This commit is contained in:
Anh H Nguyen 2023-09-26 18:55:46 -04:00
parent fde03662be
commit e34fc520bd
No known key found for this signature in database
GPG Key ID: BBC7DA8CE2EAADE1
6 changed files with 64 additions and 35 deletions

View File

@ -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": ""
}
}
}
}

View File

@ -2,13 +2,22 @@ from flask_restful import Resource
from hub_api.config import Config 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): class Costs(Resource, Config):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
def post(self): def post(self):
""" """
API call for performing the cost workflow API call for performing the cost workflow
""" """
raise NotImplementedError() raise NotImplementedError()

23
microservice.py Normal file
View 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
View File

View File

@ -0,0 +1,9 @@
{
"apiVersion": "v1.4.0",
"services": [
{
"name": "Costs",
"endpoint": "workflow/costs"
}
]
}

View 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()