# 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
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.






CONF = cfg.CONF
LOG = log.getLogger(__name__)


main_context_manager = enginefacade.transaction_context()
api_context_manager = enginefacade.transaction_context()


def _get_db_conf(conf_group, connection=None):
    kw = dict(
        connection=connection or conf_group.connection,
        slave_connection=conf_group.slave_connection,
        sqlite_fk=False,

# 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

#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.






CONF = cfg.CONF
LOG = log.getLogger(__name__)


main_context_manager = enginefacade.transaction_context()
api_context_manager = enginefacade.transaction_context()


def _get_db_conf(conf_group, connection=None):
    kw = dict(
        connection=connection or conf_group.connection,
        slave_connection=conf_group.slave_connection,
        sqlite_fk=False,

        __autocommit=True,