| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | ContainerCreateCommand.cpp |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | Implementation of command execution logic. |
| 12 | |
| 13 | --*/ |
| 14 | |
| 15 | #include "ContainerCommand.h" |
| 16 | #include "CLIExecutionContext.h" |
| 17 | #include "ContainerTasks.h" |
| 18 | #include "SessionTasks.h" |
| 19 | #include "Task.h" |
| 20 | |
| 21 | using namespace wsl::windows::wslc::execution; |
| 22 | using namespace wsl::windows::wslc::task; |
| 23 | using namespace wsl::shared; |
| 24 | |
| 25 | namespace wsl::windows::wslc { |
| 26 | // Container Create Command |
| 27 | std::vector<Argument> ContainerCreateCommand::GetArguments() const |
| 28 | { |
| 29 | // clang-format off |
| 30 | return { |
| 31 | Argument::Create(ArgType::ImageId, {.Required = true}), |
| 32 | Argument::Create(ArgType::Command), |
| 33 | Argument::Create(ArgType::ForwardArgs), |
| 34 | Argument::Create(ArgType::CIDFile), |
| 35 | Argument::Create(ArgType::Cpus), |
| 36 | Argument::Create(ArgType::DNS, {.Limit = Limit::Unlimited}), |
| 37 | // Argument::Create(ArgType::DNSDomain), |
| 38 | Argument::Create(ArgType::DNSOption, {.Limit = Limit::Unlimited}), |
| 39 | Argument::Create(ArgType::DNSSearch, {.Limit = Limit::Unlimited}), |
| 40 | Argument::Create(ArgType::Domainname), |
| 41 | Argument::Create(ArgType::Entrypoint), |
| 42 | Argument::Create(ArgType::Env, {.Limit = Limit::Unlimited}), |
| 43 | Argument::Create(ArgType::EnvFile, {.Limit = Limit::Unlimited}), |
| 44 | // Argument::Create(ArgType::GroupId), |
| 45 | Argument::Create(ArgType::Gpus), |
| 46 | Argument::Create(ArgType::HealthCmd), |
| 47 | Argument::Create(ArgType::HealthInterval), |
| 48 | Argument::Create(ArgType::HealthRetries), |
| 49 | Argument::Create(ArgType::HealthStartPeriod), |
| 50 | Argument::Create(ArgType::HealthTimeout), |
| 51 | Argument::Create(ArgType::Hostname), |
| 52 | Argument::Create(ArgType::Interactive), |
| 53 | Argument::Create(ArgType::IpAddress), |
| 54 | Argument::Create(ArgType::Label, {.Limit = Limit::Unlimited}), |
| 55 | Argument::Create(ArgType::Memory), |
| 56 | Argument::Create(ArgType::Mount, {.Limit = Limit::Unlimited}), |
| 57 | Argument::Create(ArgType::Name), |
| 58 | Argument::Create(ArgType::Network, {.Limit = Limit::Unlimited}), |
| 59 | Argument::Create(ArgType::NetworkAlias, {.Limit = Limit::Unlimited}), |
| 60 | // Argument::Create(ArgType::NoDNS), |
| 61 | // Argument::Create(ArgType::Progress), |
| 62 | Argument::Create(ArgType::NoHealthcheck), |
| 63 | Argument::Create(ArgType::Publish, {.Limit = Limit::Unlimited}), |
| 64 | Argument::Create(ArgType::PublishAll), |
| 65 | Argument::Create(ArgType::Pull), |
| 66 | Argument::Create(ArgType::Remove), |
| 67 | // Argument::Create(ArgType::Scheme), |
| 68 | Argument::Create(ArgType::ShmSize), |
| 69 | Argument::Create(ArgType::StopSignal), |
| 70 | Argument::Create(ArgType::StopTimeout), |
| 71 | Argument::Create(ArgType::TMPFS, {.Limit = Limit::Unlimited}), |
| 72 | Argument::Create(ArgType::TTY), |
| 73 | Argument::Create(ArgType::Ulimit, {.Limit = Limit::Unlimited}), |
| 74 | Argument::Create(ArgType::User), |
| 75 | Argument::Create(ArgType::Volume, {.Limit = Limit::Unlimited}), |
| 76 | // Argument::Create(ArgType::Virtual), |
| 77 | Argument::Create(ArgType::WorkDir), |
| 78 | }; |
| 79 | // clang-format on |
| 80 | } |
| 81 | |
| 82 | std::wstring ContainerCreateCommand::ShortDescription() const |
| 83 | { |
| 84 | return Localization::WSLCCLI_ContainerCreateDesc(); |
| 85 | } |
| 86 | |
| 87 | std::wstring ContainerCreateCommand::LongDescription() const |
| 88 | { |
| 89 | return Localization::WSLCCLI_ContainerCreateLongDesc(); |
| 90 | } |
| 91 | |
| 92 | // clang-format off |
| 93 | void ContainerCreateCommand::ExecuteInternal(CLIExecutionContext& context) const |
| 94 | { |
| 95 | context |
| 96 | << ResolveSession |
| 97 | << SetContainerOptionsFromArgs |
| 98 | << CreateContainer; |
| 99 | } |
| 100 | // clang-format on |
| 101 | } // namespace wsl::windows::wslc |