diff --git a/src/Common/FeatureToggles/RoadToggles.cs b/src/Common/FeatureToggles/RoadToggles.cs index 2d37895a4..610186a1d 100644 --- a/src/Common/FeatureToggles/RoadToggles.cs +++ b/src/Common/FeatureToggles/RoadToggles.cs @@ -89,4 +89,121 @@ public RoadJobsToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) : base(dynamicFeatureToggleService) { } } + + public sealed class RoadDownloadGetForEditorToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadDownloadGetForEditor"; + + public RoadDownloadGetForEditorToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadDownloadGetForProductToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadDownloadGetForProduct"; + + public RoadDownloadGetForProductToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractCreateJobToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractCreateJob"; + + public RoadExtractCreateJobToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractDownloadRequestsToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractDownloadRequests"; + + public RoadExtractDownloadRequestsToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractDownloadRequestsByContourToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractDownloadRequestsByContour"; + + public RoadExtractDownloadRequestsByContourToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractDownloadRequestsByFileToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractDownloadRequestsByFile"; + + public RoadExtractDownloadRequestsByFileToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractDownloadRequestsByNisCodeToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractDownloadRequestsByNisCode"; + + public RoadExtractDownloadRequestsByNisCodeToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractGetDownloadToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractGetDownload"; + + public RoadExtractGetDownloadToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractGetOverlappingTransactionZonesGeoJsonToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractGetOverlappingTransactionZonesGeoJson"; + + public RoadExtractGetOverlappingTransactionZonesGeoJsonToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractGetStatusToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractGetStatus"; + + public RoadExtractGetStatusToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadExtractGetTransactionZonesGeoJsonToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadExtractGetTransactionZonesGeoJson"; + + public RoadExtractGetTransactionZonesGeoJsonToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadGrbExtractByContourToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadGrbExtractByContour"; + + public RoadGrbExtractByContourToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } + + public sealed class RoadGrbUploadForDownloadToggle : KeyedFeatureToggleBase, IKeyedFeatureToggle + { + public override string Key => "RoadGrbUploadForDownload"; + + public RoadGrbUploadForDownloadToggle(IDynamicFeatureToggleService? dynamicFeatureToggleService) + : base(dynamicFeatureToggleService) + { } + } } diff --git a/src/Public.Api/Road/Downloads/DownloadController-GetForEditor.cs b/src/Public.Api/Road/Downloads/DownloadController-GetForEditor.cs index e3554ca51..b00f36e11 100644 --- a/src/Public.Api/Road/Downloads/DownloadController-GetForEditor.cs +++ b/src/Public.Api/Road/Downloads/DownloadController-GetForEditor.cs @@ -6,16 +6,20 @@ namespace Public.Api.Road.Downloads using System.Net.Http; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class DownloadController { [HttpGet("wegen/download/voor-editor")] public async Task GetForEditor( [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadDownloadGetForEditorToggle toggle, CancellationToken cancellationToken = default) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, "download/for-editor"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -26,6 +30,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, "download/for-editor"); } } } diff --git a/src/Public.Api/Road/Downloads/DownloadController-GetForProduct.cs b/src/Public.Api/Road/Downloads/DownloadController-GetForProduct.cs index fc85f8f0c..d99efd905 100644 --- a/src/Public.Api/Road/Downloads/DownloadController-GetForProduct.cs +++ b/src/Public.Api/Road/Downloads/DownloadController-GetForProduct.cs @@ -6,6 +6,7 @@ namespace Public.Api.Road.Downloads using System.Net.Http; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class DownloadController { @@ -13,10 +14,13 @@ public partial class DownloadController public async Task GetForProduct( [FromRoute] string datum, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadDownloadGetForProductToggle toggle, CancellationToken cancellationToken = default) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, $"download/for-product/{datum}"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -27,6 +31,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, $"download/for-product/{datum}"); } } } diff --git a/src/Public.Api/Road/Downloads/V2/DownloadController-GetForEditor.cs b/src/Public.Api/Road/Downloads/V2/DownloadController-GetForEditor.cs index a9de33172..d223a49f8 100644 --- a/src/Public.Api/Road/Downloads/V2/DownloadController-GetForEditor.cs +++ b/src/Public.Api/Road/Downloads/V2/DownloadController-GetForEditor.cs @@ -4,18 +4,22 @@ namespace Public.Api.Road.Downloads.V2 using System.Threading; using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; public partial class DownloadControllerV2 { [HttpGet("wegen/download/voor-editor")] public async Task GetForEditorV2( [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadDownloadGetForEditorToggle toggle, CancellationToken cancellationToken = default) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, "download/for-editor"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -26,6 +30,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, "download/for-editor"); } } } diff --git a/src/Public.Api/Road/Downloads/V2/DownloadController-GetForProduct.cs b/src/Public.Api/Road/Downloads/V2/DownloadController-GetForProduct.cs index cb8fd66cd..3f84f7a2e 100644 --- a/src/Public.Api/Road/Downloads/V2/DownloadController-GetForProduct.cs +++ b/src/Public.Api/Road/Downloads/V2/DownloadController-GetForProduct.cs @@ -4,8 +4,9 @@ namespace Public.Api.Road.Downloads.V2 using System.Threading; using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; public partial class DownloadControllerV2 { @@ -13,10 +14,13 @@ public partial class DownloadControllerV2 public async Task GetForProductV2( [FromRoute] string datum, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadDownloadGetForProductToggle toggle, CancellationToken cancellationToken = default) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, $"download/for-product/{datum}"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -27,6 +31,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, $"download/for-product/{datum}"); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-CreateJob.cs b/src/Public.Api/Road/Extracts/ExtractController-CreateJob.cs index 551edf187..6f2c2739a 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-CreateJob.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-CreateJob.cs @@ -4,7 +4,6 @@ namespace Public.Api.Road.Extracts using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; using Infrastructure; using Microsoft.AspNetCore.Http; @@ -26,7 +25,7 @@ public async Task RoadExtractCreateJob( [FromRoute] string downloadId, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] ProblemDetailsHelper problemDetailsHelper, - [FromServices] RoadJobsToggle featureToggle, + [FromServices] RoadExtractCreateJobToggle featureToggle, CancellationToken cancellationToken = default) { if (!featureToggle.FeatureEnabled) diff --git a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequests.cs b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequests.cs index 61e061739..3d634188f 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequests.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequests.cs @@ -4,6 +4,7 @@ namespace Public.Api.Road.Extracts using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; using Infrastructure; using Microsoft.AspNetCore.Mvc; @@ -17,11 +18,13 @@ public partial class ExtractController public async Task PostDownloadRequest( [FromBody]DownloadExtractRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractDownloadRequestsToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/downloadrequests") - .AddParameter(nameof(body), body, ParameterType.RequestBody); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +34,10 @@ RestRequest BackendRequest() => cancellationToken: cancellationToken); return new BackendResponseResult(response); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/downloadrequests") + .AddParameter(nameof(body), body, ParameterType.RequestBody); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByContour.cs b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByContour.cs index 5be7b9552..c8d257416 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByContour.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByContour.cs @@ -9,6 +9,7 @@ namespace Public.Api.Road.Extracts using RoadRegistry.BackOffice.Api.Extracts; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class ExtractController { @@ -17,11 +18,13 @@ public partial class ExtractController public async Task PostDownloadRequestByContour( [FromBody] DownloadExtractByContourRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractDownloadRequestsByContourToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/bycontour") - .AddJsonBodyOrEmpty(body); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +34,10 @@ RestRequest BackendRequest() => cancellationToken: cancellationToken); return new BackendResponseResult(response); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/bycontour") + .AddJsonBodyOrEmpty(body); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByFile.cs b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByFile.cs index f3f1a8db4..f89583515 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByFile.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByFile.cs @@ -9,6 +9,7 @@ namespace Public.Api.Road.Extracts using RoadRegistry.BackOffice.Api.Extracts; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class ExtractController { @@ -17,11 +18,13 @@ public partial class ExtractController public async Task PostDownloadRequestByFile( [FromBody] DownloadExtractByFileRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractDownloadRequestsByFileToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/byfile") - .AddJsonBodyOrEmpty(body); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +34,10 @@ RestRequest BackendRequest() => cancellationToken: cancellationToken); return new BackendResponseResult(response); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/byfile") + .AddJsonBodyOrEmpty(body); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByNisCode.cs b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByNisCode.cs index 2b5d088ce..2f4476fb3 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByNisCode.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-DownloadRequestsByNisCode.cs @@ -9,6 +9,7 @@ namespace Public.Api.Road.Extracts using RoadRegistry.BackOffice.Api.Extracts; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class ExtractController { @@ -17,11 +18,13 @@ public partial class ExtractController public async Task PostDownloadRequestByNisCode( [FromBody] DownloadExtractByNisCodeRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractDownloadRequestsByNisCodeToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/byniscode") - .AddJsonBodyOrEmpty(body); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +34,10 @@ RestRequest BackendRequest() => cancellationToken: cancellationToken); return new BackendResponseResult(response); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/byniscode") + .AddJsonBodyOrEmpty(body); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-GetDownload.cs b/src/Public.Api/Road/Extracts/ExtractController-GetDownload.cs index 9ae77753b..8be4d79fd 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-GetDownload.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-GetDownload.cs @@ -7,6 +7,7 @@ namespace Public.Api.Road.Extracts using System.Net.Http; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class ExtractController { @@ -15,10 +16,13 @@ public partial class ExtractController public async Task PostDownloadRequest( [FromRoute]string downloadId, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetDownloadToggle toggle, CancellationToken cancellationToken = default) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, $"extracts/download/{downloadId}"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -29,6 +33,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, $"extracts/download/{downloadId}"); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-GetOverlappingTransactionZonesGeoJson.cs b/src/Public.Api/Road/Extracts/ExtractController-GetOverlappingTransactionZonesGeoJson.cs index 5fc3de02d..f06dd6f2a 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-GetOverlappingTransactionZonesGeoJson.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-GetOverlappingTransactionZonesGeoJson.cs @@ -7,16 +7,20 @@ namespace Public.Api.Road.Extracts using RestSharp; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class ExtractController { [HttpGet("wegen/extract/overlappingtransactionzones.geojson")] public async Task GetOverlappingTransactionZonesGeoJson( [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetOverlappingTransactionZonesGeoJsonToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/overlappingtransactionzones.geojson"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +35,9 @@ RestRequest BackendRequest() => }; return response.ToActionResult(options); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/overlappingtransactionzones.geojson"); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-GetStatus.cs b/src/Public.Api/Road/Extracts/ExtractController-GetStatus.cs index 232ac4ae8..d9feb3509 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-GetStatus.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-GetStatus.cs @@ -8,6 +8,7 @@ namespace Public.Api.Road.Extracts using RestSharp; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class ExtractController { @@ -16,11 +17,13 @@ public partial class ExtractController public async Task GetStatus( [FromRoute]string uploadId, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetStatusToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/upload/{uploadId}/status") - .AddParameter(nameof(uploadId), uploadId, ParameterType.UrlSegment); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -35,6 +38,10 @@ RestRequest BackendRequest() => }; return response.ToActionResult(options); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/upload/{uploadId}/status") + .AddParameter(nameof(uploadId), uploadId, ParameterType.UrlSegment); } } } diff --git a/src/Public.Api/Road/Extracts/ExtractController-GetTransactionZonesGeoJson.cs b/src/Public.Api/Road/Extracts/ExtractController-GetTransactionZonesGeoJson.cs index b93fa72e7..134d4f222 100644 --- a/src/Public.Api/Road/Extracts/ExtractController-GetTransactionZonesGeoJson.cs +++ b/src/Public.Api/Road/Extracts/ExtractController-GetTransactionZonesGeoJson.cs @@ -7,16 +7,20 @@ namespace Public.Api.Road.Extracts using RestSharp; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class ExtractController { [HttpGet("wegen/extract/transactionzones.geojson")] public async Task GetTransactionZonesGeoJson( [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetTransactionZonesGeoJsonToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/transactionzones.geojson"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +35,9 @@ RestRequest BackendRequest() => }; return response.ToActionResult(options); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/transactionzones.geojson"); } } } diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-CreateJob.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-CreateJob.cs index fd7942403..f832144f1 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-CreateJob.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-CreateJob.cs @@ -5,7 +5,6 @@ namespace Public.Api.Road.Extracts.V2 using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Infrastructure; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -24,7 +23,7 @@ public partial class ExtractControllerV2 public async Task RoadExtractCreateJobV2( [FromRoute] string downloadId, [FromServices] ProblemDetailsHelper problemDetailsHelper, - [FromServices] RoadJobsToggle featureToggle, + [FromServices] RoadExtractCreateJobToggle featureToggle, CancellationToken cancellationToken = default) { if (!featureToggle.FeatureEnabled) diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequests.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequests.cs index d939b9b51..c2150575e 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequests.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequests.cs @@ -4,6 +4,7 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; using Infrastructure; using Microsoft.AspNetCore.Mvc; @@ -15,13 +16,15 @@ public partial class ExtractControllerV2 [ApiKeyAuth("Road", AllowAuthorizationHeader = true)] [HttpPost("wegen/extract/downloadaanvragen")] public async Task PostDownloadRequestV2( - [FromBody]DownloadExtractRequestBody body, + [FromBody] DownloadExtractRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractDownloadRequestsToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/downloadrequests") - .AddParameter(nameof(body), body, ParameterType.RequestBody); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +34,10 @@ RestRequest BackendRequest() => cancellationToken: cancellationToken); return new BackendResponseResult(response); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/downloadrequests") + .AddParameter(nameof(body), body, ParameterType.RequestBody); } } } diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByContour.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByContour.cs index 432343483..639ae1433 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByContour.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByContour.cs @@ -4,6 +4,7 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; using Infrastructure; using Microsoft.AspNetCore.Mvc; @@ -17,11 +18,13 @@ public partial class ExtractControllerV2 public async Task PostDownloadRequestByContourV2( [FromBody] DownloadExtractByContourRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractDownloadRequestsByContourToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/bycontour") - .AddJsonBodyOrEmpty(body); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +34,10 @@ RestRequest BackendRequest() => cancellationToken: cancellationToken); return new BackendResponseResult(response); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/bycontour") + .AddJsonBodyOrEmpty(body); } } } diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByFile.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByFile.cs index f8a8621f4..cdda82333 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByFile.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByFile.cs @@ -5,10 +5,10 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Microsoft.Extensions.Logging; using RestSharp; using RoadRegistry.BackOffice.Api.Extracts; @@ -20,9 +20,14 @@ public partial class ExtractControllerV2 public async Task PostDownloadRequestByFileV2( DownloadExtractByFileRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, - [FromServices] ILogger logger, + [FromServices] RoadExtractDownloadRequestsByFileToggle toggle, CancellationToken cancellationToken = default) { + if (!toggle.FeatureEnabled) + { + return NotFound(); + } + var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, BackendRequest, diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByNisCode.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByNisCode.cs index 10cbe98bd..718ab08cd 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByNisCode.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-DownloadRequestsByNisCode.cs @@ -4,9 +4,10 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; using RestSharp; using RoadRegistry.BackOffice.Api.Extracts; @@ -17,11 +18,13 @@ public partial class ExtractControllerV2 public async Task PostDownloadRequestByNisCodeV2( [FromBody] DownloadExtractByNisCodeRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractDownloadRequestsByNisCodeToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/byniscode") - .AddJsonBodyOrEmpty(body); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +34,10 @@ RestRequest BackendRequest() => cancellationToken: cancellationToken); return new BackendResponseResult(response); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Post, "extracts/downloadrequests/byniscode") + .AddJsonBodyOrEmpty(body); } } } diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownload.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownload.cs index 075ab58f1..9072d5543 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownload.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownload.cs @@ -4,9 +4,10 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading; using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; public partial class ExtractControllerV2 { @@ -15,10 +16,13 @@ public partial class ExtractControllerV2 public async Task PostDownloadRequestV2( [FromRoute]string downloadId, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetDownloadToggle toggle, CancellationToken cancellationToken = default) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, $"extracts/download/{downloadId}"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -29,6 +33,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, $"extracts/download/{downloadId}"); } } } diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownloadPreSignedUrl.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownloadPreSignedUrl.cs index eb8803c77..5560452f0 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownloadPreSignedUrl.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-GetDownloadPreSignedUrl.cs @@ -4,6 +4,7 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; using Infrastructure; using Microsoft.AspNetCore.Mvc; @@ -16,8 +17,14 @@ public partial class ExtractControllerV2 public async Task GetDownloadPreSignedUrlForExtract( [FromRoute] string downloadId, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetDownloadToggle toggle, CancellationToken cancellationToken = default) { + if (!toggle.FeatureEnabled) + { + return NotFound(); + } + var value = await GetFromBackendWithBadRequestAsync( AcceptType.Json, BackendRequest, diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-GetOverlappingTransactionZonesGeoJson.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-GetOverlappingTransactionZonesGeoJson.cs index 1f2698aa8..d196b756e 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-GetOverlappingTransactionZonesGeoJson.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-GetOverlappingTransactionZonesGeoJson.cs @@ -4,8 +4,9 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; using RestSharp; public partial class ExtractControllerV2 @@ -13,10 +14,13 @@ public partial class ExtractControllerV2 [HttpGet("wegen/extract/overlappingtransactionzones.geojson")] public async Task GetOverlappingTransactionZonesGeoJsonV2( [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetOverlappingTransactionZonesGeoJsonToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/overlappingtransactionzones.geojson"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -31,6 +35,9 @@ RestRequest BackendRequest() => }; return response.ToActionResult(options); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/overlappingtransactionzones.geojson"); } } } diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-GetStatus.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-GetStatus.cs index c1c827900..cb5018161 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-GetStatus.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-GetStatus.cs @@ -4,9 +4,10 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; using RestSharp; public partial class ExtractControllerV2 @@ -16,11 +17,13 @@ public partial class ExtractControllerV2 public async Task GetStatusV2( [FromRoute]string uploadId, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetStatusToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/upload/{uploadId}/status") - .AddParameter(nameof(uploadId), uploadId, ParameterType.UrlSegment); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -35,6 +38,10 @@ RestRequest BackendRequest() => }; return response.ToActionResult(options); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/upload/{uploadId}/status") + .AddParameter(nameof(uploadId), uploadId, ParameterType.UrlSegment); } } } diff --git a/src/Public.Api/Road/Extracts/V2/ExtractController-GetTransactionZonesGeoJson.cs b/src/Public.Api/Road/Extracts/V2/ExtractController-GetTransactionZonesGeoJson.cs index 35bdf773a..0eb536192 100644 --- a/src/Public.Api/Road/Extracts/V2/ExtractController-GetTransactionZonesGeoJson.cs +++ b/src/Public.Api/Road/Extracts/V2/ExtractController-GetTransactionZonesGeoJson.cs @@ -4,8 +4,9 @@ namespace Public.Api.Road.Extracts.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; using RestSharp; public partial class ExtractControllerV2 @@ -13,10 +14,13 @@ public partial class ExtractControllerV2 [HttpGet("wegen/extract/transactionzones.geojson")] public async Task GetTransactionZonesGeoJsonV2( [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadExtractGetTransactionZonesGeoJsonToggle toggle, CancellationToken cancellationToken = default) { - RestRequest BackendRequest() => - CreateBackendRestRequest(Method.Get, "extracts/transactionzones.geojson"); + if (!toggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, @@ -27,10 +31,13 @@ RestRequest BackendRequest() => var options = new BackendResponseResultOptions { - ForwardHeaders = new[] {"Retry-After"} + ForwardHeaders = ["Retry-After"] }; return response.ToActionResult(options); + + RestRequest BackendRequest() => + CreateBackendRestRequest(Method.Get, "extracts/transactionzones.geojson"); } } } diff --git a/src/Public.Api/Road/Grb/V2/GrbController-ExtractByContour.cs b/src/Public.Api/Road/Grb/V2/GrbController-ExtractByContour.cs index 428b0b6b0..61d432ad8 100644 --- a/src/Public.Api/Road/Grb/V2/GrbController-ExtractByContour.cs +++ b/src/Public.Api/Road/Grb/V2/GrbController-ExtractByContour.cs @@ -4,6 +4,7 @@ namespace Public.Api.Road.Grb.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Infrastructure; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -23,8 +24,14 @@ public partial class GrbControllerV2 public async Task ExtractByContour( [FromBody] DownloadExtractRequestBody body, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadGrbExtractByContourToggle toggle, CancellationToken cancellationToken = default) { + if (!toggle.FeatureEnabled) + { + return NotFound(); + } + var response = await GetFromBackendWithBadRequestAsync( AcceptType.Json, BackendRequest, diff --git a/src/Public.Api/Road/Grb/V2/GrbController-UploadForDownload.cs b/src/Public.Api/Road/Grb/V2/GrbController-UploadForDownload.cs index 2d290eaa8..2de6df44d 100644 --- a/src/Public.Api/Road/Grb/V2/GrbController-UploadForDownload.cs +++ b/src/Public.Api/Road/Grb/V2/GrbController-UploadForDownload.cs @@ -4,11 +4,10 @@ namespace Public.Api.Road.Grb.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; - using Common.Infrastructure.Extensions; + using Common.FeatureToggles; 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; @@ -26,8 +25,14 @@ public partial class GrbControllerV2 public async Task UploadForDownload( [FromRoute] string downloadId, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadGrbUploadForDownloadToggle toggle, CancellationToken cancellationToken = default) { + if (!toggle.FeatureEnabled) + { + return NotFound(); + } + var value = await GetFromBackendWithBadRequestAsync( AcceptType.Json, BackendRequest, diff --git a/src/Public.Api/Road/Uploads/UploadController-CancelJob.cs b/src/Public.Api/Road/Uploads/UploadController-CancelJob.cs index 7253b0598..e2e0f2466 100644 --- a/src/Public.Api/Road/Uploads/UploadController-CancelJob.cs +++ b/src/Public.Api/Road/Uploads/UploadController-CancelJob.cs @@ -5,7 +5,6 @@ namespace Public.Api.Road.Uploads using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; using Infrastructure; using Microsoft.AspNetCore.Http; diff --git a/src/Public.Api/Road/Uploads/UploadController-CreateJob.cs b/src/Public.Api/Road/Uploads/UploadController-CreateJob.cs index 91c8c6a13..1185a1643 100644 --- a/src/Public.Api/Road/Uploads/UploadController-CreateJob.cs +++ b/src/Public.Api/Road/Uploads/UploadController-CreateJob.cs @@ -4,7 +4,6 @@ namespace Public.Api.Road.Uploads using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; using Infrastructure; using Microsoft.AspNetCore.Http; diff --git a/src/Public.Api/Road/Uploads/UploadController-Get.cs b/src/Public.Api/Road/Uploads/UploadController-Get.cs index eb41986ed..920e2e562 100644 --- a/src/Public.Api/Road/Uploads/UploadController-Get.cs +++ b/src/Public.Api/Road/Uploads/UploadController-Get.cs @@ -6,6 +6,7 @@ namespace Public.Api.Road.Uploads using System.Net.Http; using System.Threading; using System.Threading.Tasks; + using Common.FeatureToggles; public partial class UploadController { @@ -13,10 +14,13 @@ public partial class UploadController public async Task RoadGetUpload( [FromRoute] string identifier, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadJobsToggle featureToggle, CancellationToken cancellationToken) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, $"upload/{identifier}"); + if (!featureToggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -27,6 +31,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, $"upload/{identifier}"); } } } diff --git a/src/Public.Api/Road/Uploads/UploadController-GetActiveJobs.cs b/src/Public.Api/Road/Uploads/UploadController-GetActiveJobs.cs index 1ebdc3cb1..b414a1857 100644 --- a/src/Public.Api/Road/Uploads/UploadController-GetActiveJobs.cs +++ b/src/Public.Api/Road/Uploads/UploadController-GetActiveJobs.cs @@ -4,7 +4,6 @@ namespace Public.Api.Road.Uploads using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; using Infrastructure; using Microsoft.AspNetCore.Http; diff --git a/src/Public.Api/Road/Uploads/UploadController-GetJob.cs b/src/Public.Api/Road/Uploads/UploadController-GetJob.cs index 618f4a245..e9e1c8cd3 100644 --- a/src/Public.Api/Road/Uploads/UploadController-GetJob.cs +++ b/src/Public.Api/Road/Uploads/UploadController-GetJob.cs @@ -5,7 +5,6 @@ namespace Public.Api.Road.Uploads using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; using Infrastructure; using Microsoft.AspNetCore.Http; diff --git a/src/Public.Api/Road/Uploads/UploadController-GetJobs.cs b/src/Public.Api/Road/Uploads/UploadController-GetJobs.cs index 1dc944f1d..e5176a5ee 100644 --- a/src/Public.Api/Road/Uploads/UploadController-GetJobs.cs +++ b/src/Public.Api/Road/Uploads/UploadController-GetJobs.cs @@ -4,7 +4,6 @@ namespace Public.Api.Road.Uploads using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; using Infrastructure; using Microsoft.AspNetCore.Http; diff --git a/src/Public.Api/Road/Uploads/V2/UploadController-CancelJob.cs b/src/Public.Api/Road/Uploads/V2/UploadController-CancelJob.cs index cbb4db367..5bea4d665 100644 --- a/src/Public.Api/Road/Uploads/V2/UploadController-CancelJob.cs +++ b/src/Public.Api/Road/Uploads/V2/UploadController-CancelJob.cs @@ -5,12 +5,11 @@ namespace Public.Api.Road.Uploads.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; + using Infrastructure; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; - using Public.Api.Infrastructure; using RestSharp; using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; diff --git a/src/Public.Api/Road/Uploads/V2/UploadController-CreateJob.cs b/src/Public.Api/Road/Uploads/V2/UploadController-CreateJob.cs index c4285ac6a..bf95addf2 100644 --- a/src/Public.Api/Road/Uploads/V2/UploadController-CreateJob.cs +++ b/src/Public.Api/Road/Uploads/V2/UploadController-CreateJob.cs @@ -5,7 +5,6 @@ namespace Public.Api.Road.Uploads.V2 using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Infrastructure; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; diff --git a/src/Public.Api/Road/Uploads/V2/UploadController-Get.cs b/src/Public.Api/Road/Uploads/V2/UploadController-Get.cs index 7efc3dfab..9a79ae3b1 100644 --- a/src/Public.Api/Road/Uploads/V2/UploadController-Get.cs +++ b/src/Public.Api/Road/Uploads/V2/UploadController-Get.cs @@ -4,8 +4,9 @@ namespace Public.Api.Road.Uploads.V2 using System.Threading; using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; + using Infrastructure; using Microsoft.AspNetCore.Mvc; - using Public.Api.Infrastructure; public partial class UploadControllerV2 { @@ -13,10 +14,13 @@ public partial class UploadControllerV2 public async Task RoadGetUploadV2( [FromRoute] string identifier, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadJobsToggle featureToggle, CancellationToken cancellationToken) { - HttpRequestMessage BackendRequest() => - CreateBackendHttpRequestMessage(HttpMethod.Get, $"upload/{identifier}"); + if (!featureToggle.FeatureEnabled) + { + return NotFound(); + } var response = await GetFromBackendWithBadRequestAsync( _httpClient, @@ -27,6 +31,9 @@ HttpRequestMessage BackendRequest() => ); return response.ToActionResult(); + + HttpRequestMessage BackendRequest() => + CreateBackendHttpRequestMessage(HttpMethod.Get, $"upload/{identifier}"); } } } diff --git a/src/Public.Api/Road/Uploads/V2/UploadController-GetActiveJobs.cs b/src/Public.Api/Road/Uploads/V2/UploadController-GetActiveJobs.cs index 6ee3398ba..6a28c01d1 100644 --- a/src/Public.Api/Road/Uploads/V2/UploadController-GetActiveJobs.cs +++ b/src/Public.Api/Road/Uploads/V2/UploadController-GetActiveJobs.cs @@ -4,12 +4,11 @@ namespace Public.Api.Road.Uploads.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; + using Infrastructure; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; - using Public.Api.Infrastructure; using RestSharp; using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; diff --git a/src/Public.Api/Road/Uploads/V2/UploadController-GetDownloadPreSignedUrl.cs b/src/Public.Api/Road/Uploads/V2/UploadController-GetDownloadPreSignedUrl.cs index 550359c27..febacb776 100644 --- a/src/Public.Api/Road/Uploads/V2/UploadController-GetDownloadPreSignedUrl.cs +++ b/src/Public.Api/Road/Uploads/V2/UploadController-GetDownloadPreSignedUrl.cs @@ -4,6 +4,7 @@ namespace Public.Api.Road.Uploads.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api; using Be.Vlaanderen.Basisregisters.Api.Exceptions; + using Common.FeatureToggles; using Common.Infrastructure.Controllers.Attributes; using Infrastructure; using Microsoft.AspNetCore.Mvc; @@ -16,8 +17,14 @@ public partial class UploadControllerV2 public async Task GetDownloadPreSignedUrlForUpload( [FromRoute] string identifier, [FromServices] ProblemDetailsHelper problemDetailsHelper, + [FromServices] RoadJobsToggle featureToggle, CancellationToken cancellationToken = default) { + if (!featureToggle.FeatureEnabled) + { + return NotFound(); + } + var value = await GetFromBackendWithBadRequestAsync( AcceptType.Json, BackendRequest, diff --git a/src/Public.Api/Road/Uploads/V2/UploadController-GetJob.cs b/src/Public.Api/Road/Uploads/V2/UploadController-GetJob.cs index 324c46204..e490d1143 100644 --- a/src/Public.Api/Road/Uploads/V2/UploadController-GetJob.cs +++ b/src/Public.Api/Road/Uploads/V2/UploadController-GetJob.cs @@ -5,12 +5,11 @@ namespace Public.Api.Road.Uploads.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; + using Infrastructure; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; - using Public.Api.Infrastructure; using RestSharp; using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; diff --git a/src/Public.Api/Road/Uploads/V2/UploadController-GetJobs.cs b/src/Public.Api/Road/Uploads/V2/UploadController-GetJobs.cs index 9feea064a..aa7b65c8f 100644 --- a/src/Public.Api/Road/Uploads/V2/UploadController-GetJobs.cs +++ b/src/Public.Api/Road/Uploads/V2/UploadController-GetJobs.cs @@ -4,12 +4,11 @@ namespace Public.Api.Road.Uploads.V2 using System.Threading.Tasks; using Be.Vlaanderen.Basisregisters.Api.Exceptions; using Common.FeatureToggles; - using Common.Infrastructure; using Common.Infrastructure.Extensions; + using Infrastructure; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; - using Public.Api.Infrastructure; using RestSharp; using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails;