public async static Task RemoveContainer(RemoveContainerParameters parameters, IProducer <Null, string> p) { try { CancellationToken cancellation = new CancellationToken(); await client.Containers.RemoveContainerAsync(parameters.ContainerId, new ContainerRemoveParameters { Force = true, RemoveVolumes = parameters.RemoveVolumes }, cancellation); // Updating the containers with the new configurations right away and sending it out var updatedContainers = await DockerUpdater.FetchOverviewData(); var overviewContainerUpdate = DockerUpdater.CreateOverViewData(updatedContainers); await KafkaHelpers.SendMessageAsync(DockerUpdater.OverviewTopic, overviewContainerUpdate, p); // Send response await KafkaHelpers.SendMessageAsync(_responseTopic, new ContainerResponse { ResponseStatusCode = 200, Message = ResponseMessageContracts.CONTAINER_REMOVED, ContainerIds = new string[] { parameters.ContainerId } }, p); } catch (DockerApiException ex) { await KafkaHelpers.SendMessageAsync(_responseTopic, new ContainerResponse { ResponseStatusCode = 400, Message = ex.Message, ContainerIds = new string[] { parameters.ContainerId } }, p); } }
public Task RemoveContainerAsync(string id, RemoveContainerParameters parameters) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException("id"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } string path = string.Format(CultureInfo.InvariantCulture, "containers/{0}", id); IQueryString queryParameters = new QueryString <RemoveContainerParameters>(parameters); return(this.Client.MakeRequestAsync(new[] { NoSuchContainerHandler }, HttpMethod.Delete, path, queryParameters)); }