""" Logic for healthcheck. Hello World is one of the most complex operations in the world. It requires all the robots and nanotechnology from Terminator to define whether or not our future will survive an apocalypse. In other words: always make sure that whenever you add a description it's something meaningful that you will enjoy reading days, months, or years later. One more thing: you will automatically be associated with those, and some of us really enjoy `git blame`. """ from contracts import response from contracts.models import healthcheck as healthcheck_model def status(): """Indicate the status of the service. Returns: response.Response: response object. """ return response.create_status_ok_response() def db_status(): """Perform a DB healthcheck and return the appropriate response. Returns: response.Response: response object. """ is_db_ok = healthcheck_model.check_db() if is_db_ok: return response.create_status_ok_response() else: return response.create_error_response( response.ERROR_CODE_SERVICE_UNAVAILABLE, 'Service Unavailable', status=503 )