Initial working prototype
This commit is contained in:
parent
3f6ff87370
commit
ccc5337dc1
17 changed files with 506 additions and 57 deletions
|
|
@ -25,29 +25,27 @@ public class ServiceController : ControllerBase
|
|||
}
|
||||
|
||||
[HttpPost()]
|
||||
public async Task<IActionResult> ToggleContainer(string containerName, string? containerNamespace, string action)
|
||||
public async Task<IActionResult> ToggleContainer([FromQuery] string containerName, string? containerNamespace, string action)
|
||||
{
|
||||
if (containerName == string.Empty || action == string.Empty)
|
||||
{
|
||||
return BadRequest("Missing required parameter");
|
||||
}
|
||||
|
||||
var container = await _service.GetContainer(containerName, containerNamespace);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case "START":
|
||||
await _service.StartContainer(container);
|
||||
await _service.StartContainer(containerName, containerNamespace);
|
||||
break;
|
||||
|
||||
case "STOP":
|
||||
await _service.StopContainer(container);
|
||||
await _service.StopContainer(containerName, containerNamespace);
|
||||
break;
|
||||
|
||||
default:
|
||||
return BadRequest("Incorrect action");
|
||||
}
|
||||
|
||||
return Ok(container);
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue