| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | NetworkModel.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | This file contains the NetworkModel definitions |
| 12 | |
| 13 | --*/ |
| 14 | |
| 15 | #pragma once |
| 16 | |
| 17 | #include "JsonUtils.h" |
| 18 | #include <string> |
| 19 | |
| 20 | namespace wsl::windows::wslc::models { |
| 21 | |
| 22 | struct CreateNetworkOptions |
| 23 | { |
| 24 | std::string Name; |
| 25 | std::optional<std::string> Driver; |
| 26 | std::vector<std::pair<std::string, std::string>> DriverOpts{}; |
| 27 | std::vector<std::pair<std::string, std::string>> Labels{}; |
| 28 | bool Internal{false}; |
| 29 | std::optional<std::string> Subnet; |
| 30 | std::optional<std::string> Gateway; |
| 31 | std::optional<std::string> IpRange; |
| 32 | }; |
| 33 | |
| 34 | struct NetworkEndpointOptions |
| 35 | { |
| 36 | std::vector<std::string> Aliases; |
| 37 | std::optional<std::string> IpAddress; |
| 38 | std::vector<std::string> Links; |
| 39 | std::vector<std::string> LinkLocalIps; |
| 40 | std::vector<std::string> DriverOpts; |
| 41 | }; |
| 42 | |
| 43 | struct ConnectNetworkOptions |
| 44 | { |
| 45 | std::string NetworkName; |
| 46 | std::string ContainerId; |
| 47 | std::vector<std::string> Aliases; |
| 48 | std::optional<std::string> IpAddress; |
| 49 | std::vector<std::string> Links; |
| 50 | std::vector<std::string> LinkLocalIps; |
| 51 | std::vector<std::string> DriverOpts; |
| 52 | }; |
| 53 | |
| 54 | struct PruneNetworksResult |
| 55 | { |
| 56 | std::vector<std::string> PrunedNetworks; |
| 57 | }; |
| 58 | |
| 59 | // The shape emitted by "network list --format json"; every value is reported as a string. |
| 60 | struct NetworkOutputInformation |
| 61 | { |
| 62 | std::string CreatedAt; |
| 63 | std::string Driver; |
| 64 | std::string ID; |
| 65 | std::string IPv4; |
| 66 | std::string IPv6; |
| 67 | std::string Internal; |
| 68 | std::string Labels; |
| 69 | std::string Name; |
| 70 | std::string Scope; |
| 71 | |
| 72 | NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(NetworkOutputInformation, CreatedAt, Driver, ID, IPv4, IPv6, Internal, Labels, Name, Scope); |
| 73 | }; |
| 74 | |
| 75 | } // namespace wsl::windows::wslc::models |