Exemple #1
0
        protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetContainerIds(Container, Id))
            {
                if (Force.ToBool())
                {
                    await DkrClient.Containers.KillContainerAsync(
                        id,
                        new ContainerKillParameters());
                }
                else
                {
                    if (!await DkrClient.Containers.StopContainerAsync(
                            id,
                            new ContainerStopParameters(),
                            CmdletCancellationToken))
                    {
                        throw new ApplicationFailedException("The container has already stopped.");
                    }
                }

                if (PassThru.ToBool())
                {
                    WriteObject(await ContainerOperations.GetContainerByIdOrName(id, DkrClient));
                }
            }
        }
Exemple #2
0
        protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetContainerIds(Container, Id))
            {
                if (!await DkrClient.Containers.StartContainerAsync(
                        id, new HostConfig()))
                {
                    throw new ApplicationFailedException("The container has already started.");
                }

                if (PassThru.ToBool())
                {
                    WriteObject(await ContainerOperations.GetContainerByIdOrName(id, DkrClient));
                }
            }
        }
Exemple #3
0
        protected override async Task ProcessRecordAsync()
        {
            foreach (var id in ParameterResolvers.GetContainerIds(Container, Id))
            {
                var waitResponse = await DkrClient.Containers.WaitContainerAsync(
                    id,
                    CmdletCancellationToken);

                WriteVerbose("Status Code: " + waitResponse.StatusCode.ToString());
                ContainerOperations.ThrowOnProcessExitCode(waitResponse.StatusCode);

                if (PassThru.ToBool())
                {
                    WriteObject(await ContainerOperations.GetContainerByIdOrName(id, DkrClient));
                }
            }
        }