# Path: freezer_api/api/common/utils.py
# LOG = log.getLogger(__name__)
# def inject_context(req, resp, params):
# def before_hooks():
# def json_encode(obj):
# def json_decode(binary):
#     def __init__(self, func):
#     def process_resource(self, req, resp, resource, params=None):
# class FuncMiddleware(object):
# 
# Path: freezer_api/common/_i18n.py

# 
# Path: freezer_api/common/elasticv2_utils.py
# LOG = log.getLogger(__name__)
# class BackupMetadataDoc(object):
# class JobDoc(object):
# class ActionDoc(object):
# class SessionDoc(object):
# class ClientDoc(object):
#     def __init__(self, project_id='', user_id='', user_name='', data={}):
#     def is_valid(self):
#     def serialize(self):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, project_id, user_id):
#     def update(doc, project_id, user_id, job_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id, project_id):
#     def update(doc, user_id, action_id, project_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id, project_id, hold_off=30):
#     def update(doc, user_id, session_id, project_id):
#     def validate(doc):
#     def create(doc, project_id, user_id):
# 
# Path: freezer_api/common/exceptions.py
# class FreezerAPIException(falcon.HTTPError):
# class BadDataFormat(FreezerAPIException):
# class DocumentExists(FreezerAPIException):
# class StorageEngineError(FreezerAPIException):
# class DocumentNotFound(FreezerAPIException):
# class AccessForbidden(FreezerAPIException):
# class MethodNotImplemented(FreezerAPIException):
#     def __init__(self, message=''):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
# 
# Path: freezer_api/common/utils.py
# class BackupMetadataDoc(object):
# class JobDoc(object):
# class ActionDoc(object):
# class SessionDoc(object):
# class ClientDoc(object):
#     def __init__(self, user_id='', user_name='', data={}):
#     def is_valid(self):
#     def serialize(self):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id):
#     def update(doc, user_id, job_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id):
#     def update(doc, user_id, action_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id, hold_off=30):
#     def update(doc, user_id, session_id):
#     def validate(doc):
#     def create(doc, user_id):
# 
# Path: freezer_api/db/sqlalchemy/models.py
# BASE = declarative_base()
# class FreezerBase(models.TimestampMixin,
#                   models.ModelBase):
# class Client(BASE, FreezerBase):
# class Action(BASE, FreezerBase):
# class Session(BASE, FreezerBase):
# class Job(BASE, FreezerBase):
# class ActionReport(BASE, FreezerBase):
# class Backup(BASE, FreezerBase):
#     def delete_values():
#     def delete(self, session):
# def register_models(engine):
# def unregister_models(engine):
# def get_tables(engine):


import sys
from oslo_config import cfg
from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import utils as sqlalchemyutils
from oslo_log import log
from freezer_api.api.common import utils as json_utils
from freezer_api.common._i18n import _
from freezer_api.common import elasticv2_utils as utilsv2
from freezer_api.common import exceptions as freezer_api_exc
from freezer_api.common import utils as utilsv1
from freezer_api.db.sqlalchemy import models

    add_tuple(tuple=client)

    LOG.info('Client registered, client_id: {0}'.format(client_id))
    return client_id


def delete_client(user_id, client_id, project_id=None):

    existing = get_client(project_id=project_id, user_id=user_id,
                          client_id=client_id)

    if existing:
        clientt = existing[0].get('client')
        clientid = clientt.get('uuid')
        delete_tuple(tablename=models.Client, user_id=user_id,
                     tuple_id=clientid, project_id=project_id)
        LOG.info('Client delete, client_id: {0} deleted'.
                 format(client_id))
    else:
        LOG.info('Client delete, client_id: {0} not found'.
                 format(client_id))
    return client_id


def delete_action(user_id, action_id, project_id=None):

    tupleid = delete_tuple(tablename=models.Action, user_id=user_id,
                           tuple_id=action_id, project_id=project_id)


# Path: freezer_api/api/common/utils.py
# LOG = log.getLogger(__name__)
# def inject_context(req, resp, params):
# def before_hooks():
# def json_encode(obj):
# def json_decode(binary):
#     def __init__(self, func):
#     def process_resource(self, req, resp, resource, params=None):
# class FuncMiddleware(object):
# 
# Path: freezer_api/common/_i18n.py

# 
# Path: freezer_api/common/elasticv2_utils.py
# LOG = log.getLogger(__name__)
# class BackupMetadataDoc(object):
# class JobDoc(object):
# class ActionDoc(object):
# class SessionDoc(object):
# class ClientDoc(object):
#     def __init__(self, project_id='', user_id='', user_name='', data={}):
#     def is_valid(self):
#     def serialize(self):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, project_id, user_id):
#     def update(doc, project_id, user_id, job_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id, project_id):
#     def update(doc, user_id, action_id, project_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id, project_id, hold_off=30):
#     def update(doc, user_id, session_id, project_id):
#     def validate(doc):
#     def create(doc, project_id, user_id):
# 
# Path: freezer_api/common/exceptions.py
# class FreezerAPIException(falcon.HTTPError):
# class BadDataFormat(FreezerAPIException):
# class DocumentExists(FreezerAPIException):
# class StorageEngineError(FreezerAPIException):
# class DocumentNotFound(FreezerAPIException):
# class AccessForbidden(FreezerAPIException):
# class MethodNotImplemented(FreezerAPIException):
#     def __init__(self, message=''):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
#     def handle(ex, req, resp, params):
# 
# Path: freezer_api/common/utils.py
# class BackupMetadataDoc(object):
# class JobDoc(object):
# class ActionDoc(object):
# class SessionDoc(object):
# class ClientDoc(object):
#     def __init__(self, user_id='', user_name='', data={}):
#     def is_valid(self):
#     def serialize(self):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id):
#     def update(doc, user_id, job_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id):
#     def update(doc, user_id, action_id):
#     def validate(doc):
#     def validate_patch(doc):
#     def create_patch(doc):
#     def create(doc, user_id, hold_off=30):
#     def update(doc, user_id, session_id):
#     def validate(doc):
#     def create(doc, user_id):
# 
# Path: freezer_api/db/sqlalchemy/models.py
# BASE = declarative_base()
# class FreezerBase(models.TimestampMixin,
#                   models.ModelBase):
# class Client(BASE, FreezerBase):
# class Action(BASE, FreezerBase):
# class Session(BASE, FreezerBase):
# class Job(BASE, FreezerBase):
# class ActionReport(BASE, FreezerBase):
# class Backup(BASE, FreezerBase):
#     def delete_values():
#     def delete(self, session):
# def register_models(engine):
# def unregister_models(engine):
# def get_tables(engine):


# Path: freezer_api/db/sqlalchemy/api.py
import sys
from oslo_config import cfg
from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import utils as sqlalchemyutils
from oslo_log import log
from freezer_api.api.common import utils as json_utils
from freezer_api.common._i18n import _
from freezer_api.common import elasticv2_utils as utilsv2
from freezer_api.common import exceptions as freezer_api_exc
from freezer_api.common import utils as utilsv1
from freezer_api.db.sqlalchemy import models


    add_tuple(tuple=client)

    LOG.info('Client registered, client_id: {0}'.format(client_id))
    return client_id


def delete_client(user_id, client_id, project_id=None):

    existing = get_client(project_id=project_id, user_id=user_id,
                          client_id=client_id)

    if existing:
        clientt = existing[0].get('client')
        clientid = clientt.get('uuid')
        delete_tuple(tablename=models.Client, user_id=user_id,
                     tuple_id=clientid, project_id=project_id)
        LOG.info('Client delete, client_id: {0} deleted'.
                 format(client_id))
    else:
        LOG.info('Client delete, client_id: {0} not found'.
                 format(client_id))
    return client_id


def delete_action(user_id, action_id, project_id=None):

    tupleid = delete_tuple(tablename=models.Action, user_id=user_id,
                           tuple_id=action_id, project_id=project_id)


    tupleid = delete_tuple(tablename=models.ActionReport, user_id=user_id,