# Path: freezer_api/api/common/resource.py
# class BaseResource(object):
#     def json_body(req):
# 
# 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/policy.py
# DEFAULT_POLICY_FILE = 'policy.yaml'
# ENFORCER = None
#         ENFORCER = policy.Enforcer(conf)
# def setup_policy(conf):
# def enforce(rule):
#     def decorator(func):
#         def handler(*args, **kwargs):


import uuid
import falcon
from freezer_api.api.common import resource
from freezer_api.common import exceptions as freezer_api_exc
from freezer_api import policy
                format(job_id))
        else:
            self.db.delete_job(user_id=user_id, job_id=job_id)
            resp.body = {'job_id': job_id}
            resp.status = falcon.HTTP_204

    @policy.enforce('jobs:update')
    def on_patch(self, req, resp, job_id):
        # PATCH /v1/jobs/{job_id}     updates the specified job
        user_id = req.get_header('X-User-ID') or ''
        job = Job(self.json_body(req))
        self.update_actions_in_job(user_id, job.doc)
        new_version = self.db.update_job(user_id=user_id,
                                         job_id=job_id,
                                         patch_doc=job.doc)
        resp.body = {'job_id': job_id, 'version': new_version}

    @policy.enforce('jobs:create')
    def on_post(self, req, resp, job_id):
        # PUT /v1/jobs/{job_id}     creates/replaces the specified job
        user_id = req.get_header('X-User-ID') or ''
        job = Job(self.json_body(req))
        self.update_actions_in_job(user_id, job.doc)
        new_version = self.db.replace_job(user_id=user_id,
                                          job_id=job_id,
                                          doc=job.doc)
        resp.status = falcon.HTTP_201
        resp.body = {'job_id': job_id, 'version': new_version}



# Path: freezer_api/api/common/resource.py
# class BaseResource(object):
#     def json_body(req):
# 
# 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/policy.py
# DEFAULT_POLICY_FILE = 'policy.yaml'
# ENFORCER = None
#         ENFORCER = policy.Enforcer(conf)
# def setup_policy(conf):
# def enforce(rule):
#     def decorator(func):
#         def handler(*args, **kwargs):


# Path: freezer_api/api/v1/jobs.py
import uuid
import falcon
from freezer_api.api.common import resource
from freezer_api.common import exceptions as freezer_api_exc
from freezer_api import policy

                format(job_id))
        else:
            self.db.delete_job(user_id=user_id, job_id=job_id)
            resp.body = {'job_id': job_id}
            resp.status = falcon.HTTP_204

    @policy.enforce('jobs:update')
    def on_patch(self, req, resp, job_id):
        # PATCH /v1/jobs/{job_id}     updates the specified job
        user_id = req.get_header('X-User-ID') or ''
        job = Job(self.json_body(req))
        self.update_actions_in_job(user_id, job.doc)
        new_version = self.db.update_job(user_id=user_id,
                                         job_id=job_id,
                                         patch_doc=job.doc)
        resp.body = {'job_id': job_id, 'version': new_version}

    @policy.enforce('jobs:create')
    def on_post(self, req, resp, job_id):
        # PUT /v1/jobs/{job_id}     creates/replaces the specified job
        user_id = req.get_header('X-User-ID') or ''
        job = Job(self.json_body(req))
        self.update_actions_in_job(user_id, job.doc)
        new_version = self.db.replace_job(user_id=user_id,
                                          job_id=job_id,
                                          doc=job.doc)
        resp.status = falcon.HTTP_201
        resp.body = {'job_id': job_id, 'version': new_version}



class JobsEvent(resource.BaseResource):