-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "chore: cleanup backend endpoints (#14418)"
This reverts commit d39bfff.
- Loading branch information
1 parent
d39bfff
commit 3cd9e23
Showing
36 changed files
with
1,920 additions
and
14 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
backend/src/Designer/Controllers/KubernetesDeploymentsController.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,44 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
using Altinn.Studio.Designer.Services.Interfaces; | ||
using Altinn.Studio.Designer.TypedHttpClients.KubernetesWrapper; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Altinn.Studio.Designer.Controllers | ||
{ | ||
/// <summary> | ||
/// Controller for getting kubernetes deployments | ||
/// </summary> | ||
[ApiController] | ||
[Authorize] | ||
[AutoValidateAntiforgeryToken] | ||
[Route("/designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/kubernetesDeployments")] | ||
public class KubernetesDeploymentsController : ControllerBase | ||
{ | ||
private readonly IKubernetesDeploymentsService _kubernetesDeploymentsService; | ||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
/// <param name="kubernetesDeploymentsService">IKubernetesDeploymentsService</param> | ||
public KubernetesDeploymentsController(IKubernetesDeploymentsService kubernetesDeploymentsService) | ||
{ | ||
_kubernetesDeploymentsService = kubernetesDeploymentsService; | ||
} | ||
|
||
/// <summary> | ||
/// Gets kubernetes deployments | ||
/// </summary> | ||
/// <param name="org">Organisation</param> | ||
/// <param name="app">Application name</param> | ||
/// <returns>List of kubernetes deployments</returns> | ||
[HttpGet] | ||
[ApiConventionMethod(typeof(DefaultApiConventions), nameof(DefaultApiConventions.Get))] | ||
public async Task<List<KubernetesDeployment>> Get(string org, string app) | ||
{ | ||
return await _kubernetesDeploymentsService.GetAsync(org, app); | ||
} | ||
} | ||
} |
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,49 @@ | ||
using System.Collections.Generic; | ||
|
||
using Altinn.Studio.Designer.Helpers; | ||
using Altinn.Studio.Designer.Services.Interfaces; | ||
|
||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Altinn.Studio.Designer.Controllers | ||
{ | ||
/// <summary> | ||
/// Controller containing actions related to languages | ||
/// </summary> | ||
[Authorize] | ||
[AutoValidateAntiforgeryToken] | ||
[Route("designer/api/{org}/{repo:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/languages")] | ||
public class LanguagesController : ControllerBase | ||
{ | ||
private readonly ILanguagesService _languagesService; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="LanguagesController"/> class. | ||
/// </summary> | ||
/// <param name="languagesService">The languages service.</param> | ||
public LanguagesController(ILanguagesService languagesService) | ||
{ | ||
_languagesService = languagesService; | ||
} | ||
|
||
/// <summary> | ||
/// Endpoint for getting the available languages in the application. | ||
/// </summary> | ||
/// <param name="org">Unique identifier of the organisation responsible for the app.</param> | ||
/// <param name="repo">Application identifier which is unique within an organisation.</param> | ||
/// <returns>List of languages as JSON</returns> | ||
[HttpGet] | ||
[Produces("application/json")] | ||
[ProducesResponseType(StatusCodes.Status200OK)] | ||
public ActionResult<List<string>> GetLanguages(string org, string repo) | ||
{ | ||
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); | ||
|
||
List<string> languages = new List<string>(_languagesService.GetLanguages(org, repo, developer)); | ||
|
||
return Ok(languages); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.