Skip to content
Snippets Groups Projects
Commit 0ec41229 authored by Shane Hutchins's avatar Shane Hutchins
Browse files

merge of master for CICD changes and backup api update

parent 6afd93c9
No related branches found
No related tags found
1 merge request!343Notice Update, Updated libraries, Version change and Backup API
Pipeline #185551 failed
import fastapi
from fastapi import Depends
import requests
from auth import auth
import logging
import conf
from starlette_context import context
from fastapi.responses import FileResponse, Response
from bundles import bundle
router = fastapi.APIRouter()
import correlation
from datetime import date
_logger = logging.getLogger(__name__)
logger = correlation.DefaultExtrasAdapter(_logger, {"correlation_id": "None"})
@router.get("/backup", response_class=FileResponse)
def backup(auth_data: auth.Auth = Depends(auth.require_authorized_admin)):
"""
Experimental Backup API.
"""
logger = correlation.DefaultExtrasAdapter(_logger, {"correlation_id": context["correlation_id"]})
today = date.today()
filename = f"bundle-{auth_data.data_partition_id}-{today}.tar.gz"
file_path = f"bundle-{auth_data.data_partition_id}-{today}.tar.gz"
data = bundle.get_bundle(data_partition=auth_data.data_partition_id)
print(data)
return Response(data)
#return FileResponse(path=file_path, filename=filename, media_type='application/gzip')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment