-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
220 additions
and
13 deletions.
There are no files selected for viewing
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
6 changes: 3 additions & 3 deletions
6
src/Public.Api/Road/Extracts/ExtractController-DownloadRequests.cs
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
38 changes: 38 additions & 0 deletions
38
src/Public.Api/Road/Extracts/V2/ExtractController-GetDownloadPreSignedUrl.cs
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,38 @@ | ||
namespace Public.Api.Road.Extracts.V2 | ||
{ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Common.Infrastructure.Controllers.Attributes; | ||
using Common.Infrastructure.Extensions; | ||
using Infrastructure; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using RestSharp; | ||
|
||
public partial class ExtractControllerV2 | ||
{ | ||
[ApiKeyAuth("Road", AllowAuthorizationHeader = true)] | ||
[HttpGet("wegen/extract/download/{downloadId}/presignedurl")] | ||
public async Task<ActionResult> GetDownloadPreSignedUrlForExtract( | ||
[FromRoute]string downloadId, | ||
[FromServices] IActionContextAccessor actionContextAccessor, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var value = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
|
||
return new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice()); | ||
|
||
RestRequest BackendRequest() => new RestRequest("extracts/download/{downloadId}/presignedurl", Method.Get) | ||
.AddParameter("downloadId", downloadId, ParameterType.UrlSegment) | ||
.AddHeaderAuthorization(actionContextAccessor); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Public.Api/Road/Grb/V2/GrbController-ExtractByContour.cs
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,45 @@ | ||
namespace Public.Api.Road.Grb.V2 | ||
{ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Common.Infrastructure.Extensions; | ||
using Infrastructure; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using RestSharp; | ||
using RoadRegistry.BackOffice.Abstractions.Extracts; | ||
using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; | ||
|
||
public partial class GrbControllerV2 | ||
{ | ||
[ProducesResponseType(typeof(DownloadExtractResponseBody), StatusCodes.Status200OK)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status403Forbidden)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status429TooManyRequests)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] | ||
[HttpPost("wegen/grb/extracts/bycontour", Name = nameof(ExtractByContour))] | ||
public async Task<IActionResult> ExtractByContour( | ||
[FromBody] DownloadExtractRequestBody body, | ||
[FromServices] IActionContextAccessor actionContextAccessor, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var value = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
|
||
return new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice()); | ||
|
||
RestRequest BackendRequest() => new RestRequest("grb/extracts/bycontour", Method.Post) | ||
.AddJsonBodyOrEmpty(body) | ||
.AddHeaderAuthorization(actionContextAccessor); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/Public.Api/Road/Grb/V2/GrbController-UploadForDownload.cs
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,46 @@ | ||
namespace Public.Api.Road.Grb.V2 | ||
{ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Common.Infrastructure.Extensions; | ||
using Infrastructure; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using RestSharp; | ||
using RoadRegistry.BackOffice.Abstractions.Jobs; | ||
using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; | ||
|
||
public partial class GrbControllerV2 | ||
{ | ||
[ProducesResponseType(typeof(GetPresignedUploadUrlResponse), StatusCodes.Status200OK)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status403Forbidden)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status429TooManyRequests)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] | ||
[HttpPost("wegen/grb/download/{downloadId}/upload", Name = nameof(UploadForDownload))] | ||
public async Task<IActionResult> UploadForDownload( | ||
[FromRoute] string downloadId, | ||
[FromServices] IActionContextAccessor actionContextAccessor, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var value = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
|
||
return new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice()); | ||
|
||
RestRequest BackendRequest() => new RestRequest("grb/download/{downloadId}/upload", Method.Post) | ||
.AddParameter("downloadId", downloadId, ParameterType.UrlSegment) | ||
.AddHeaderAuthorization(actionContextAccessor); | ||
} | ||
} | ||
} |
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,39 @@ | ||
namespace Public.Api.Road.Grb.V2 | ||
{ | ||
using Asp.Versioning; | ||
using Autofac.Features.AttributeFilters; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Common.Infrastructure; | ||
using Common.Infrastructure.Controllers.Attributes; | ||
using FeatureToggle; | ||
using Infrastructure.Configuration; | ||
using Infrastructure.Swagger; | ||
using Infrastructure.Version; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using Microsoft.Extensions.Logging; | ||
using RestSharp; | ||
|
||
[ApiVersion(Version.V2)] | ||
[AdvertiseApiVersions(Version.CurrentAdvertised)] | ||
[ApiRoute("")] | ||
[ApiExplorerSettings(GroupName = "Grb")] | ||
[ApiOrder(ApiOrder.Road.RoadGrb)] | ||
[ApiKeyAuth("Road", AllowAuthorizationHeader = true)] | ||
public partial class GrbControllerV2 : RoadRegistryApiController<GrbControllerV2> | ||
{ | ||
protected override string NotFoundExceptionMessage => "Onbestaande upload."; | ||
protected override string GoneExceptionMessage => "Verwijderde upload."; | ||
|
||
public GrbControllerV2( | ||
IHttpContextAccessor httpContextAccessor, | ||
IActionContextAccessor actionContextAccessor, | ||
[KeyFilter(RegistryKeys.Road)] RestClient restClient, | ||
[KeyFilter(RegistryKeys.Road)] IFeatureToggle cacheToggle, | ||
ConnectionMultiplexerProvider redis, | ||
ILogger<GrbControllerV2> logger) | ||
: base(httpContextAccessor, redis, logger, restClient, cacheToggle, actionContextAccessor) | ||
{ } | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/Public.Api/Road/Uploads/V2/UploadController-GetDownloadPreSignedUrl.cs
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,38 @@ | ||
namespace Public.Api.Road.Uploads.V2 | ||
{ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using Be.Vlaanderen.Basisregisters.Api.Exceptions; | ||
using Common.Infrastructure.Controllers.Attributes; | ||
using Common.Infrastructure.Extensions; | ||
using Infrastructure; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using RestSharp; | ||
|
||
public partial class UploadControllerV2 | ||
{ | ||
[ApiKeyAuth("Road", AllowAuthorizationHeader = true)] | ||
[HttpGet("wegen/upload/{identifier}/presignedurl")] | ||
public async Task<ActionResult> GetDownloadPreSignedUrlForUpload( | ||
[FromRoute]string identifier, | ||
[FromServices] IActionContextAccessor actionContextAccessor, | ||
[FromServices] ProblemDetailsHelper problemDetailsHelper, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var value = await GetFromBackendWithBadRequestAsync( | ||
AcceptType.Json, | ||
BackendRequest, | ||
CreateDefaultHandleBadRequest(), | ||
problemDetailsHelper, | ||
cancellationToken: cancellationToken); | ||
|
||
return new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice()); | ||
|
||
RestRequest BackendRequest() => new RestRequest("upload/{identifier}/presignedurl", Method.Get) | ||
.AddParameter("identifier", identifier, ParameterType.UrlSegment) | ||
.AddHeaderAuthorization(actionContextAccessor); | ||
} | ||
} | ||
} |