Пример #1
0
        public async Task <IActionResult> DeleteServiceAsync
            ([FromRoute] string serviceName,
            [FromRoute] string tenantName,
            [FromRoute] string groupName)
        {
            var serviceController = new MTAServiceController(serviceName, tenantName, groupName);
            var respondeModel     = await serviceController.DeleteServiceAsync(_k8sClient);

            if (respondeModel != null)
            {
                return(BadRequest(respondeModel));
            }

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> CreateServiceAsync
            ([FromBody] MTAServiceModel serviceBody,
            [FromRoute] string serviceName,
            [FromRoute] string tenantName,
            [FromRoute] string groupName)
        {
            var path         = string.Concat(GetTemplatesPath(), "/template-svc.yaml");
            var servicesList = await Yaml.LoadAllFromFileAsync(path);

            var yamlBody          = servicesList[0] as V1Service;
            var serviceController = new MTAServiceController(serviceName, tenantName, groupName);
            var respondeModel     = await serviceController.CreateServiceAsync
                                        (_k8sClient, yamlBody, serviceBody);

            if (respondeModel.Item2 != null)
            {
                return(BadRequest(respondeModel.Item2));
            }

            return(Created(Url.RouteUrl("CreateService", new { serviceName, groupName }),
                           respondeModel.Item1));
        }