-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TM-1434] add endpoint for downloading reports as s3 presigned urls (#…
…538)
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
app/Http/Controllers/V2/Exports/GeneratePreSignedURLDownloadReportController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\V2\Exports; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class GeneratePreSignedURLDownloadReportController extends Controller | ||
{ | ||
public function __invoke(Request $request, string $entity, string $framework) | ||
{ | ||
$fileKey = 'exports/all-entity-records/'.$entity.'-'.$framework.'.csv'; | ||
|
||
$expiration = now()->addMinutes(60); | ||
|
||
$presignedUrl = Storage::disk('s3')->temporaryUrl($fileKey, $expiration); | ||
|
||
return response()->json(['url' => $presignedUrl]); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
openapi-src/V2/paths/Exports/get-v2-admin-entity-presigned-url-framework.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
operationId: get-v2-admin-entity-presigned-url-framework.yml | ||
summary: Export entities data | ||
tags: | ||
- V2 Projects | ||
- V2 Sites | ||
- V2 Nurseries | ||
- V2 Project Reports | ||
- V2 Site Reports | ||
- V2 Nursery Reports | ||
- Exports | ||
parameters: | ||
- type: string | ||
name: ENTITY | ||
in: path | ||
required: true | ||
description: allowed values projects/sites/nurseries/project-reports/site-reports/nursery-reports | ||
- type: string | ||
name: FRAMEWORK | ||
in: path | ||
required: true | ||
description: allowed values terrafund/ppc | ||
responses: | ||
'200': | ||
description: OK | ||
schema: | ||
type: object | ||
properties: | ||
url: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters