Skip to content

Commit

Permalink
more stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
ckuhtz committed Jul 25, 2024
1 parent d289b42 commit 70ed0fc
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 59 deletions.
14 changes: 12 additions & 2 deletions api/routers/configuration/delete.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Configuration DELETE

def delete():
return
from ast import Dict

def delete(
instance_param: str = None,
section_param: str = None
) -> Dict:

return_dict = {'instance': instance_param, 'section': section_param}

# redis code goes here

return return_dict
18 changes: 2 additions & 16 deletions api/routers/configuration/get.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
# Configuration GET

# from enum import Enum
from ast import Dict
from fastapi import Request, Response

# Data models

# class SectionName(str, Enum):
# n0nbh = 'n0nbh'
# couchbase = 'couchbase'

def get(
response: Response,
request: Request,
instance_param: str = None,
section_param: str = None
) -> Dict:

return_dict = {'section': section_param, 'instance': instance_param}
return_dict = {'instance': instance_param, 'section': section_param}

# match section_param:
# case SectionName.couchbase:
# return_dict.update({'message': 'i am a futon.'})
# case SectionName.n0nbh:
# return_dict.update({'message': 'it is dark.'})
# redis code goes here

return return_dict
69 changes: 32 additions & 37 deletions api/routers/configuration/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,73 +21,68 @@ class SectionName(str, Enum):
n0nbh = 'n0nbh'
couchbase = 'couchbase'


# GET

@router.get('/configuration')
@router.get('/configuration/{instance}')
@router.get('/configuration/{instance}/{section}')
def get_config(
request: Request,
response: Response,
async def get_config(
instance: str = None,
section: SectionName = None
):
return_dict = configuration_get(
request=request,
response=response,
return configuration_get(
instance_param=instance,
section_param=section
)

print(f'return_dict: {return_dict}')

return return_dict




# PUT

@router.put('/configuration')
async def put_config_all(body: dict = Body (...)):
return body

@router.get('/configuration/{instance}')
async def put_config_instance(instance: str, body: dict = Body (...)):
return body

@router.get('/configuration/{instance}/{section}')
async def put_config_instance_section(instance: str, section: SectionName, body: dict = Body (...)):
return body
@router.put('/configuration/{instance}')
@router.put('/configuration/{instance}/{section}')
async def put_config(
instance: str = None,
section: SectionName = None,
body: dict = Body (...)
):

return configuration_put(
instance_param=instance,
section_param=section
)



# PATCH

@router.patch('/configuration')
async def patch_config_all():
return {'instance': 'instance'}

@router.patch('/configuration/{instance}')
async def patch_config_instance(instance: str):
return {'instance': 'instance'}

@router.patch('/configuration/{instance}/{section}')
async def patch_config_instance_section(instance: str, section: SectionName):
return {'instance': 'instance'}
async def patch_config(
instance: str = None,
section: SectionName = None,
body: dict = Body (...)
):

return configuration_patch(
instance_param=instance,
section_param=section
)


# DELETE

@router.delete('/configuration')
async def delete_config_all():
return {'message': 'he\'s dead, jim.'}

@router.delete('/configuration/{instance}')
async def delete_config_instance(instance: str):
return {'message': 'he\'s dead, jim.'}

@router.delete('/configuration/{instance}/{section}')
async def delete_config_instance_section(instance: str, section: SectionName):
return {'message': 'he\'s dead, jim.'}
async def delete_config(
instance: str = None,
section: SectionName = None
):
return configuration_delete(
instance_param=instance,
section_param=section
)
14 changes: 12 additions & 2 deletions api/routers/configuration/patch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Configuration PATCH

def patch():
return
from ast import Dict

def patch(
instance_param: str = None,
section_param: str = None
) -> Dict:

return_dict = {'instance': instance_param, 'section': section_param}

# redis code goes here

return return_dict
14 changes: 12 additions & 2 deletions api/routers/configuration/put.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Configuration PUT

def put():
return
from ast import Dict

def put(
instance_param: str = None,
section_param: str = None
) -> Dict:

return_dict = {'instance': instance_param, 'section': section_param}

# redis code goes here

return return_dict

0 comments on commit 70ed0fc

Please sign in to comment.