Add project files.
This commit is contained in:
		
							
								
								
									
										44
									
								
								Core.Blueprint.DAL.API/Controllers/KeyVaultController.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								Core.Blueprint.DAL.API/Controllers/KeyVaultController.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| using Asp.Versioning; | ||||
| using Core.Blueprint.DAL.KeyVault.Contracts; | ||||
| using Core.Blueprint.KeyVault; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
|  | ||||
| namespace Core.Blueprint.DAL.API.Controllers | ||||
| { | ||||
|     [ApiVersion("1.0")] | ||||
|     [Route("api/v{api-version:apiVersion}/[controller]")] | ||||
|     [Produces("application/json")] | ||||
|     [ApiController] | ||||
|     [AllowAnonymous] | ||||
|     public class KeyVaultController(IKeyVaultService service) : ControllerBase | ||||
|     { | ||||
|         [HttpPost("CreateSecret")] | ||||
|         public async Task<IActionResult> CreateSecret([FromBody] KeyVaultRequest newSecret, CancellationToken cancellationToken) | ||||
|         { | ||||
|             var result = await service.CreateSecretAsync(newSecret, cancellationToken); | ||||
|             return Ok(result); | ||||
|         } | ||||
|  | ||||
|         [HttpGet("{secretName}/GetSecret")] | ||||
|         public async Task<IActionResult> GetSecret([FromRoute] string secretName, CancellationToken cancellationToken) | ||||
|         { | ||||
|             var result = await service.GetSecretAsync(secretName, cancellationToken); | ||||
|             return Ok(result); | ||||
|         } | ||||
|  | ||||
|         [HttpPut("UpdateSecret")] | ||||
|         public async Task<IActionResult> UpdateSecret([FromBody] KeyVaultRequest newSecret, CancellationToken cancellationToken) | ||||
|         { | ||||
|             var result = await service.UpdateSecretAsync(newSecret, cancellationToken); | ||||
|             return Ok(result); | ||||
|         } | ||||
|  | ||||
|         [HttpDelete("{secretName}/DeleteSecret")] | ||||
|         public async Task<IActionResult> DeleteSecret([FromRoute] string secretName, CancellationToken cancellationToken) | ||||
|         { | ||||
|             var result = await service.DeleteSecretAsync(secretName, cancellationToken); | ||||
|             return Ok(result); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin