master
h 64 lines 1.62 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 ImageModel.h
8
9 Abstract:
10
11 This file contains the ImageModel definition.
12
13 --*/
14 #pragma once
15
16 namespace wsl::windows::wslc::models {
17 struct ImageInformation
18 {
19 std::optional<std::string> Repository;
20 std::optional<std::string> Tag;
21 std::string Id;
22 LONGLONG Created{};
23 int64_t Size{};
24 // Number of containers created from the image, or -1 when the count wasn't requested.
25 LONGLONG Containers{-1};
26
27 NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(ImageInformation, Repository, Tag, Id, Created, Size);
28 };
29
30 // The shape emitted by "image list --format json". Every value is reported as a string, and
31 // "<none>" is used rather than null for missing repository, tag, and digest data, so this is kept
32 // separate from ImageInformation, which mirrors the service's native types.
33 struct ImageOutputInformation
34 {
35 std::string Containers;
36 std::string CreatedAt;
37 std::string CreatedSince;
38 std::string Digest;
39 std::string ID;
40 std::string Repository;
41 std::string SharedSize;
42 std::string Size;
43 std::string Tag;
44 std::string UniqueSize;
45
46 NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(
47 ImageOutputInformation, Containers, CreatedAt, CreatedSince, Digest, ID, Repository, SharedSize, Size, Tag, UniqueSize);
48 };
49
50 inline constexpr std::string_view c_none = "<none>";
51
52 struct DeletedImageEntry
53 {
54 std::string Image;
55 bool Deleted{};
56 };
57
58 struct PruneImagesResult
59 {
60 std::vector<std::string> DeletedImages;
61 std::vector<std::string> UntaggedImages;
62 ULONGLONG SpaceReclaimed{};
63 };
64 } // namespace wsl::windows::wslc::models