# -- config --
# description: Deletes a role
# param: role - Your ROLE name
# http_method: post
# lock: False
# tags: Postgres, Psql
# -- end config --

from os import linesep
from extension import Sanitize, CmdRun
from extension import ToolKit, Constants
from extension import ParamHandle as Param

# Spawn Instances
p = Param()  # <class> Parameter manipulation
real_escape_string = Sanitize()  # <class> Escape Routines
toolkit = ToolKit()  # <class> Misc. functions
params = p.list()  # <dict>   Input params list
run = CmdRun()  # <class> Runs the query

# ************************************
# *  DEFINE PARAMETERS AND VALIDATE  *
# ************************************
sanitized_arguement = {}  # The actual API params we pass to psql

param = "role"
role = Param()
role.value = params[param]
role.name = param
role.max_length = Constants.POSTGRES_NAMEDATA_LEN
# param: rolename - Which role (only one currently) to add to
# param: groupname -  Which group (only one currently) to add to
# filtered_params: password
# http_method: post
# lock: False
# tags: Postgres, CREATEROLE, Psql
# -- end config --

from os import linesep
from extension import Sanitize, CmdRun
from extension import ToolKit, Constants
from extension import ParamHandle as Param
import psycopg2

# Spawn Instances
p = Param()  # <class> Parameter manipulation
real_escape_string = Sanitize()  # <class> Escape Routines
toolkit = ToolKit()  # <class> Misc. functions
params = p.list()  # <dict>   Input params list
run = CmdRun()  # <class> Runs the query

try:
    conn = psycopg2.connect("dbname='postgres' user='******' host='localhost'")
except:
    print "I am unable to connect to the database"

cursor = conn.cursor()

# ************************************
# *  DEFINE PARAMETERS AND VALIDATE  *
# ************************************
Esempio n. 3
0
# param: svc_login - If the svc account has login permission
# param: svc_maxsock - Svc account maximum sockets
# param: svc_password - Svc account password
# filtered_params: super_password, svc_password
# http_method: post
# lock: False
# tags: Postgres, CREATEAPPTIER, Psql
# -- end config --

from os import linesep
from extension import Sanitize, CmdRun
from extension import ToolKit, Constants
from extension import ParamHandle as Param

# Spawn Instances
p = Param()  # <class> Parameter manipulation
real_escape_string = Sanitize()  # <class> Escape Routines
toolkit = ToolKit()  # <class> Misc. functions
params = p.list()  # <dict>   Input params list
run = CmdRun()  # <class> Runs the query

# ************************************
# *  DEFINE PARAMETERS AND VALIDATE  *
# ************************************
sanitized_arguement = {}  # The actual API params we pass to psql

param = "application"
application = Param()
application.value = params[param]
application.name = param
application.max_length = Constants.POSTGRES_NAMEDATA_LEN
Esempio n. 4
0
# -- config --
# description: Create a new DATABASE in Postgres.
# param: database - Your ROLE name
# http_method: post
# lock: False
# tags: Postgres, CREATEROLE, Psql
# -- end config --

from os import linesep
from extension import Sanitize, CmdRun
from extension import ToolKit, Constants
from extension import ParamHandle as Param

# Spawn Instances
p = Param()  # <class> Parameter manipulation
real_escape_string = Sanitize()  # <class> Escape Routines
toolkit = ToolKit()  # <class> Misc. functions
params = p.list()  # <dict>   Input params list
run = CmdRun()  # <class> Runs the query

# ************************************
# *  DEFINE PARAMETERS AND VALIDATE  *
# ************************************
sanitized_arguement = {}  # The actual API params we pass to psql

param = "database"
database = Param()
database.value = params[param]
database.name = param
database.max_length = Constants.POSTGRES_NAMEDATA_LEN
Esempio n. 5
0
#    in all copies or substantial portions of the Software.

# -- config --
# description: A test file to validate functionality and get up and running
# param: name - Your name
# param: age - Your age
# http_method: post
# lock: False
# -- end config --

from extension import Constants
from extension import ParamHandle as Param
import datetime

# Spawn Instances
p = Param()  # <class> Parame ter manipulation
params = p.list()  # <dict>  A dict of params
dt = datetime.datetime.now()  #<datetime> object

# ************************************
# *  DEFINE PARAMETERS AND VALIDATE  *
# ************************************
arguement = {}  # The actual API params we pass

param = "name"
name = Param()
name.value = params[param]
name.name = param
name.require = True
name.max_length = 128
arguement[param] = name.get()
# param: database -  If supplied, will terminate all connections to this database.
# param: application -  If supplied, will terminate all connections to this appliccation.
# param: pid -  If supplied, will terminate all connections to this pid.
# param: client_address -  If supplied, will terminate all connections to this IP.
# http_method: post
# lock: False
# tags: Postgres, Psql
# -- end config --

from os import linesep
from extension import Sanitize, CmdRun
from extension import ToolKit, Constants
from extension import ParamHandle as Param

# Spawn Instances
p = Param()  # <class> Parameter manipulation
real_escape_string = Sanitize()  # <class> Escape Routines
toolkit = ToolKit()  # <class> Misc. functions
params = p.list()  # <dict>   Input params list
run = CmdRun()  # <class> Runs the query

# ************************************
# *  DEFINE PARAMETERS AND VALIDATE  *
# ************************************
sanitized_arguement = {}  # The actual API params we pass to psql

param = "database"
database = Param()
database.value = params[param]
database.name = param
database.max_length = Constants.POSTGRES_NAMEDATA_LEN