| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | NetworkCommand.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | Declaration of command classes and interfaces. |
| 12 | |
| 13 | --*/ |
| 14 | #pragma once |
| 15 | #include "Command.h" |
| 16 | |
| 17 | namespace wsl::windows::wslc { |
| 18 | // Root Network Command |
| 19 | struct NetworkCommand final : public Command |
| 20 | { |
| 21 | constexpr static std::wstring_view CommandName = L"network"; |
| 22 | NetworkCommand(const std::wstring& parent) : Command(CommandName, parent) |
| 23 | { |
| 24 | } |
| 25 | std::vector<Argument> GetArguments() const override; |
| 26 | std::wstring ShortDescription() const override; |
| 27 | std::wstring LongDescription() const override; |
| 28 | |
| 29 | std::vector<std::unique_ptr<Command>> GetCommands() const override; |
| 30 | |
| 31 | protected: |
| 32 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 33 | }; |
| 34 | |
| 35 | // Create Command |
| 36 | struct NetworkCreateCommand final : public Command |
| 37 | { |
| 38 | constexpr static std::wstring_view CommandName = L"create"; |
| 39 | NetworkCreateCommand(const std::wstring& parent) : Command(CommandName, parent) |
| 40 | { |
| 41 | } |
| 42 | std::vector<Argument> GetArguments() const override; |
| 43 | std::wstring ShortDescription() const override; |
| 44 | std::wstring LongDescription() const override; |
| 45 | |
| 46 | protected: |
| 47 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 48 | }; |
| 49 | |
| 50 | // Remove Command |
| 51 | struct NetworkRemoveCommand final : public Command |
| 52 | { |
| 53 | constexpr static std::wstring_view CommandName = L"remove"; |
| 54 | NetworkRemoveCommand(const std::wstring& parent) : Command(CommandName, {L"delete", L"rm"}, parent) |
| 55 | { |
| 56 | } |
| 57 | std::vector<Argument> GetArguments() const override; |
| 58 | std::wstring ShortDescription() const override; |
| 59 | std::wstring LongDescription() const override; |
| 60 | |
| 61 | protected: |
| 62 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 63 | }; |
| 64 | |
| 65 | // Inspect Command |
| 66 | struct NetworkInspectCommand final : public Command |
| 67 | { |
| 68 | constexpr static std::wstring_view CommandName = L"inspect"; |
| 69 | NetworkInspectCommand(const std::wstring& parent) : Command(CommandName, parent) |
| 70 | { |
| 71 | } |
| 72 | std::vector<Argument> GetArguments() const override; |
| 73 | std::wstring ShortDescription() const override; |
| 74 | std::wstring LongDescription() const override; |
| 75 | |
| 76 | protected: |
| 77 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 78 | }; |
| 79 | |
| 80 | // List Command |
| 81 | struct NetworkListCommand final : public Command |
| 82 | { |
| 83 | constexpr static std::wstring_view CommandName = L"list"; |
| 84 | NetworkListCommand(const std::wstring& parent) : Command(CommandName, {L"ls"}, parent) |
| 85 | { |
| 86 | } |
| 87 | std::vector<Argument> GetArguments() const override; |
| 88 | std::wstring ShortDescription() const override; |
| 89 | std::wstring LongDescription() const override; |
| 90 | |
| 91 | protected: |
| 92 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 93 | }; |
| 94 | |
| 95 | // Prune Command |
| 96 | struct NetworkPruneCommand final : public Command |
| 97 | { |
| 98 | constexpr static std::wstring_view CommandName = L"prune"; |
| 99 | NetworkPruneCommand(const std::wstring& parent) : Command(CommandName, parent) |
| 100 | { |
| 101 | } |
| 102 | std::vector<Argument> GetArguments() const override; |
| 103 | std::wstring ShortDescription() const override; |
| 104 | std::wstring LongDescription() const override; |
| 105 | |
| 106 | protected: |
| 107 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 108 | }; |
| 109 | |
| 110 | // Connect Command |
| 111 | struct NetworkConnectCommand final : public Command |
| 112 | { |
| 113 | constexpr static std::wstring_view CommandName = L"connect"; |
| 114 | NetworkConnectCommand(const std::wstring& parent) : Command(CommandName, parent) |
| 115 | { |
| 116 | } |
| 117 | std::vector<Argument> GetArguments() const override; |
| 118 | std::wstring ShortDescription() const override; |
| 119 | std::wstring LongDescription() const override; |
| 120 | |
| 121 | protected: |
| 122 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 123 | }; |
| 124 | |
| 125 | // Disconnect Command |
| 126 | struct NetworkDisconnectCommand final : public Command |
| 127 | { |
| 128 | constexpr static std::wstring_view CommandName = L"disconnect"; |
| 129 | NetworkDisconnectCommand(const std::wstring& parent) : Command(CommandName, parent) |
| 130 | { |
| 131 | } |
| 132 | std::vector<Argument> GetArguments() const override; |
| 133 | std::wstring ShortDescription() const override; |
| 134 | std::wstring LongDescription() const override; |
| 135 | |
| 136 | protected: |
| 137 | void ExecuteInternal(CLIExecutionContext& context) const override; |
| 138 | }; |
| 139 | } // namespace wsl::windows::wslc |