-
-
Notifications
You must be signed in to change notification settings - Fork 3
xdevdoc otdmDriverProto
class otdmDriverProto()
This is a programer documentation for otdmDriverProto. If you want to your owne Driver this is a place to be. It's python code explenation of what is in back of the idea and functions. This one is running in shell layer in python3. More about otdmTools info is comming....
To make tasks simple. Making work will be only by saing what to do but how to make it is Handle by selected corect DriverProto. It know if this work is on http API or file system or mysql database using some selections. Not important :) If you have driverProto for it it is in otdm-
- You can use your driverProto from yss / bash / otdm- instance
- one line tasks any ware
- will do for using in packitso .deb builder
By implementing your DriverProto you can extend options and join the family otdm-
$ otdmTools.py -dfs '/tmp' -oFile '--'
argument dfs if is same as your keyWord your driver will be execute to do the task. -oFile
store data to output file if -- to stdout.
$ otdmTools.py -dfs '/tmp/abc123' -act MKDIR -oFile '--'
-act
is not GET|POST|DELETE it will try your argument in try So you can put your own function handler and argument vector is pass from otdmTool.py
$ tm=`tempfile`;otdmTools.py -forceHost 192.168.43.220 -dnrfByUid "*" \
-oFile ${tm} >> /dev/null
cat ${tm} | jq '.[].id'
force different host then in .otdm/config.json / use Node-RED driver proto / GETAll () to tm
file then jq .id
from result
$ tm=`tempfile`
outTemp='{"name":.name,"path":.fullPath}'
otdmTools.py -dfs "/tmp" -oFile ${tm} >> /dev/null
cat ${tm} | jq '.[] | select( .isFile == false ) | '${outTemp}
Returns only directory from /tmp in array of dicts {"name":.name,"path":.fullPath}
.....
"path": "//tmp/jsdoc-api"
}
{
"name": "pyjsdoc",
"path": "//tmp/pyjsdoc"
}
.....
ver: 0.2.2
It's for inhereting and overriting some of it's function / method.
There is a name restriction for new files otdmDriver
YOURNAME.py
Adding otdmDriver
YOURNAMEProto.py
in name will make skip your file in
plugin init step.
All your driversProto should to extand by otdmDriverProto
nice cmd: python import pdb; pdb.set_trace()
keyWord: string - @overwriteIt important to invoce from arguments from console.
iKey: string - @overwriteIt if want to use driver in packitso
iUid: string - @overwriteIt if want to use driver int packitso
isPackitso: bool - @overwriteIt important to use in packitso only if ready
def __init__(args, conf, name, suffix)
Arguments
- args: dict - with argumens to parse and look for your inputs
- conf: dict - from otdmTools.py instance .otdm/config.json is comming
- name: string - to identyfy in .otdm/config.json
- suffix: string | dict - to pass some args in instance
def getHelp(implemented=0)
@overwriteIt - to set your own help as extra. After the default $ otdmTools.py -h '1'
def getHost()
@overwriteIt - use rest as curl instance for http api HOST:getPort/getSuffix/getApiPath Returns
[string] - host defined from config and iff set handles -forceHost (then call super)
def getPort()
@overwriteIt - use rest as curl instance for http api getHost:PORT/getSuffix/getApiPath Returns
[string] - port defined from config
def getSuffix()
@overwriteIt - use rest as curl instance for http api getHost:getPort/suffix/getApiPath Returns
[string] - suffix defined from self.suffix set on super()
def getApiPath()
@overwriteIt - use rest as curl instance for http api getHost:getPort/getSuffix/path Returns
[string] - suffix defined from config
def getHeaders()
@overwriteIt - if want to make http api with this header or overwriteit
def GETAll()
@overwriteIt - to hendle request of all something like all Returns
[list] - of data some form
def GET(d)
@overwriteIt - to hendle request of single work read Arguments
- d: object - to identyfy your work to get it Returns
[list] - data some form file storable json preffered
def POST(d)
@overwriteIt - to hendle request of single work write / make / execute / do taks Arguments
- d: object - to put in work as data input to work Returns
[json] - to raport status
def DELETE(d)
@overwriteIt - to hendle request of deleting / removing / dropping / eresing something like all Returns
[list] - to raport status