Definition for SDK projection / object model (#40121)

Flor Chacón committed May 13, 2026 at 17:07 UTC ab71550431ecf8f638ecee0b620cd0087a3eb310
38 files changed +1756 -137
src/windows/WslcSDK/winrt/CMakeLists.txt
+32 -2
@@ -2,16 +2,46 @@ add_idl_winrt(wslcsdkwinrtidl "wslcsdk.idl")
2 set_target_properties(wslcsdkwinrtidl PROPERTIES FOLDER windows)
3
4 set(SOURCES
5 + Container.cpp
6 + ContainerNamedVolume.cpp
7 + ContainerPortMapping.cpp
8 + ContainerSettings.cpp
9 + ContainerVolume.cpp
10 + ImageInfo.cpp
11 + ImageProgress.cpp
12 + InstallProgress.cpp
13 + Process.cpp
14 + ProcessSettings.cpp
15 + PullImageOptions.cpp
16 + PushImageOptions.cpp
17 + ServiceVersion.cpp
18 Session.cpp
19 SessionSettings.cpp
7 - VhdRequirements.cpp
20 + TagImageOptions.cpp
21 + VhdOptions.cpp
22 + WslcService.cpp
23 )
24
25 set(HEADERS
26 + Container.h
27 + ContainerNamedVolume.h
28 + ContainerPortMapping.h
29 + ContainerSettings.h
30 + ContainerVolume.h
31 Helpers.h
32 + ImageInfo.h
33 + ImageProgress.h
34 + InstallProgress.h
35 + Process.h
36 + ProcessSettings.h
37 + PullImageOptions.h
38 + PushImageOptions.h
39 + ServiceVersion.h
40 Session.h
41 SessionSettings.h
14 - VhdRequirements.h
42 + TagImageOptions.h
43 + VhdOptions.h
44 + WslcService.h
45 )
46
47 add_library(wslcsdkwinrt STATIC ${SOURCES} ${HEADERS})
src/windows/WslcSDK/winrt/Container.cpp new
+52
@@ -0,0 +1,52 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + Container.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK Container class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "Container.h"
17 +#include "Microsoft.WSL.Containers.Container.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +void Container::Start(winrt::Microsoft::WSL::Containers::ContainerStartFlags const& flags)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +void Container::Stop(winrt::Microsoft::WSL::Containers::Signal const& signal, uint32_t timeoutSeconds)
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void Container::Delete(winrt::Microsoft::WSL::Containers::DeleteContainerFlags const& flags)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +winrt::Microsoft::WSL::Containers::Process Container::CreateProcess(winrt::Microsoft::WSL::Containers::ProcessSettings const& newProcessSettings)
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +hstring Container::Inspect()
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +hstring Container::Id()
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +winrt::Microsoft::WSL::Containers::Process Container::InitProcess()
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +winrt::Microsoft::WSL::Containers::ContainerState Container::State()
49 +{
50 + throw hresult_not_implemented();
51 +}
52 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/Container.h new
+32
@@ -0,0 +1,32 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + Container.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK Container class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.Container.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct Container : ContainerT<Container>
20 +{
21 + Container() = default;
22 +
23 + void Start(winrt::Microsoft::WSL::Containers::ContainerStartFlags const& flags);
24 + void Stop(winrt::Microsoft::WSL::Containers::Signal const& signal, uint32_t timeoutSeconds);
25 + void Delete(winrt::Microsoft::WSL::Containers::DeleteContainerFlags const& flags);
26 + winrt::Microsoft::WSL::Containers::Process CreateProcess(winrt::Microsoft::WSL::Containers::ProcessSettings const& newProcessSettings);
27 + hstring Inspect();
28 + hstring Id();
29 + winrt::Microsoft::WSL::Containers::Process InitProcess();
30 + winrt::Microsoft::WSL::Containers::ContainerState State();
31 +};
32 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ContainerNamedVolume.cpp new
+48
@@ -0,0 +1,48 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerNamedVolume.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ContainerNamedVolume class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ContainerNamedVolume.h"
17 +#include "Microsoft.WSL.Containers.ContainerNamedVolume.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +ContainerNamedVolume::ContainerNamedVolume(hstring const& name, hstring const& containerPath, bool readOnly)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +hstring ContainerNamedVolume::Name()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void ContainerNamedVolume::Name(hstring const& value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +hstring ContainerNamedVolume::ContainerPath()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void ContainerNamedVolume::ContainerPath(hstring const& value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +bool ContainerNamedVolume::ReadOnly()
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +void ContainerNamedVolume::ReadOnly(bool value)
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ContainerNamedVolume.h new
+36
@@ -0,0 +1,36 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerNamedVolume.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ContainerNamedVolume class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ContainerNamedVolume.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ContainerNamedVolume : ContainerNamedVolumeT<ContainerNamedVolume>
20 +{
21 + ContainerNamedVolume() = default;
22 +
23 + ContainerNamedVolume(hstring const& name, hstring const& containerPath, bool readOnly);
24 + hstring Name();
25 + void Name(hstring const& value);
26 + hstring ContainerPath();
27 + void ContainerPath(hstring const& value);
28 + bool ReadOnly();
29 + void ReadOnly(bool value);
30 +};
31 +} // namespace winrt::Microsoft::WSL::Containers::implementation
32 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
33 +struct ContainerNamedVolume : ContainerNamedVolumeT<ContainerNamedVolume, implementation::ContainerNamedVolume>
34 +{
35 +};
36 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/ContainerPortMapping.cpp new
+56
@@ -0,0 +1,56 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerPortMapping.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ContainerPortMapping class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ContainerPortMapping.h"
17 +#include "Microsoft.WSL.Containers.ContainerPortMapping.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +ContainerPortMapping::ContainerPortMapping(uint16_t windowsPort, uint16_t containerPort, winrt::Microsoft::WSL::Containers::PortProtocol const& protocol)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +uint16_t ContainerPortMapping::WindowsPort()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void ContainerPortMapping::WindowsPort(uint16_t value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +uint16_t ContainerPortMapping::ContainerPort()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void ContainerPortMapping::ContainerPort(uint16_t value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +winrt::Microsoft::WSL::Containers::PortProtocol ContainerPortMapping::Protocol()
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +void ContainerPortMapping::Protocol(winrt::Microsoft::WSL::Containers::PortProtocol const& value)
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +winrt::Windows::Networking::HostName ContainerPortMapping::WindowsAddress()
49 +{
50 + throw hresult_not_implemented();
51 +}
52 +void ContainerPortMapping::WindowsAddress(winrt::Windows::Networking::HostName const& value)
53 +{
54 + throw hresult_not_implemented();
55 +}
56 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ContainerPortMapping.h new
+38
@@ -0,0 +1,38 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerPortMapping.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ContainerPortMapping class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ContainerPortMapping.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ContainerPortMapping : ContainerPortMappingT<ContainerPortMapping>
20 +{
21 + ContainerPortMapping() = default;
22 +
23 + ContainerPortMapping(uint16_t windowsPort, uint16_t containerPort, winrt::Microsoft::WSL::Containers::PortProtocol const& protocol);
24 + uint16_t WindowsPort();
25 + void WindowsPort(uint16_t value);
26 + uint16_t ContainerPort();
27 + void ContainerPort(uint16_t value);
28 + winrt::Microsoft::WSL::Containers::PortProtocol Protocol();
29 + void Protocol(winrt::Microsoft::WSL::Containers::PortProtocol const& value);
30 + winrt::Windows::Networking::HostName WindowsAddress();
31 + void WindowsAddress(winrt::Windows::Networking::HostName const& value);
32 +};
33 +} // namespace winrt::Microsoft::WSL::Containers::implementation
34 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
35 +struct ContainerPortMapping : ContainerPortMappingT<ContainerPortMapping, implementation::ContainerPortMapping>
36 +{
37 +};
38 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/ContainerSettings.cpp new
+104
@@ -0,0 +1,104 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerSettings.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ContainerSettings class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ContainerSettings.h"
17 +#include "Microsoft.WSL.Containers.ContainerSettings.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +ContainerSettings::ContainerSettings(hstring const& imageName)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +hstring ContainerSettings::ImageName()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void ContainerSettings::ImageName(hstring const& value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +hstring ContainerSettings::Name()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void ContainerSettings::Name(hstring const& value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +winrt::Microsoft::WSL::Containers::ProcessSettings ContainerSettings::InitProcess()
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +void ContainerSettings::InitProcess(winrt::Microsoft::WSL::Containers::ProcessSettings const& value)
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +winrt::Windows::Foundation::IReference<winrt::Microsoft::WSL::Containers::ContainerNetworkingMode> ContainerSettings::NetworkingMode()
49 +{
50 + throw hresult_not_implemented();
51 +}
52 +void ContainerSettings::NetworkingMode(winrt::Windows::Foundation::IReference<winrt::Microsoft::WSL::Containers::ContainerNetworkingMode> const& value)
53 +{
54 + throw hresult_not_implemented();
55 +}
56 +hstring ContainerSettings::HostName()
57 +{
58 + throw hresult_not_implemented();
59 +}
60 +void ContainerSettings::HostName(hstring const& value)
61 +{
62 + throw hresult_not_implemented();
63 +}
64 +hstring ContainerSettings::DomainName()
65 +{
66 + throw hresult_not_implemented();
67 +}
68 +void ContainerSettings::DomainName(hstring const& value)
69 +{
70 + throw hresult_not_implemented();
71 +}
72 +winrt::Microsoft::WSL::Containers::ContainerFlags ContainerSettings::Flags()
73 +{
74 + throw hresult_not_implemented();
75 +}
76 +void ContainerSettings::Flags(winrt::Microsoft::WSL::Containers::ContainerFlags const& value)
77 +{
78 + throw hresult_not_implemented();
79 +}
80 +winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerPortMapping> ContainerSettings::PortMappings()
81 +{
82 + throw hresult_not_implemented();
83 +}
84 +void ContainerSettings::PortMappings(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerPortMapping> const& value)
85 +{
86 + throw hresult_not_implemented();
87 +}
88 +winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerVolume> ContainerSettings::Volumes()
89 +{
90 + throw hresult_not_implemented();
91 +}
92 +void ContainerSettings::Volumes(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerVolume> const& value)
93 +{
94 + throw hresult_not_implemented();
95 +}
96 +winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerNamedVolume> ContainerSettings::NamedVolumes()
97 +{
98 + throw hresult_not_implemented();
99 +}
100 +void ContainerSettings::NamedVolumes(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerNamedVolume> const& value)
101 +{
102 + throw hresult_not_implemented();
103 +}
104 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ContainerSettings.h new
+50
@@ -0,0 +1,50 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerSettings.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ContainerSettings class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ContainerSettings.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ContainerSettings : ContainerSettingsT<ContainerSettings>
20 +{
21 + ContainerSettings() = default;
22 +
23 + ContainerSettings(hstring const& imageName);
24 + hstring ImageName();
25 + void ImageName(hstring const& value);
26 + hstring Name();
27 + void Name(hstring const& value);
28 + winrt::Microsoft::WSL::Containers::ProcessSettings InitProcess();
29 + void InitProcess(winrt::Microsoft::WSL::Containers::ProcessSettings const& value);
30 + winrt::Windows::Foundation::IReference<winrt::Microsoft::WSL::Containers::ContainerNetworkingMode> NetworkingMode();
31 + void NetworkingMode(winrt::Windows::Foundation::IReference<winrt::Microsoft::WSL::Containers::ContainerNetworkingMode> const& value);
32 + hstring HostName();
33 + void HostName(hstring const& value);
34 + hstring DomainName();
35 + void DomainName(hstring const& value);
36 + winrt::Microsoft::WSL::Containers::ContainerFlags Flags();
37 + void Flags(winrt::Microsoft::WSL::Containers::ContainerFlags const& value);
38 + winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerPortMapping> PortMappings();
39 + void PortMappings(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerPortMapping> const& value);
40 + winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerVolume> Volumes();
41 + void Volumes(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerVolume> const& value);
42 + winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerNamedVolume> NamedVolumes();
43 + void NamedVolumes(winrt::Windows::Foundation::Collections::IVector<winrt::Microsoft::WSL::Containers::ContainerNamedVolume> const& value);
44 +};
45 +} // namespace winrt::Microsoft::WSL::Containers::implementation
46 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
47 +struct ContainerSettings : ContainerSettingsT<ContainerSettings, implementation::ContainerSettings>
48 +{
49 +};
50 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/ContainerVolume.cpp new
+48
@@ -0,0 +1,48 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerVolume.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ContainerVolume class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ContainerVolume.h"
17 +#include "Microsoft.WSL.Containers.ContainerVolume.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +ContainerVolume::ContainerVolume(hstring const& windowsPath, hstring const& containerPath, bool readOnly)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +hstring ContainerVolume::WindowsPath()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void ContainerVolume::WindowsPath(hstring const& value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +hstring ContainerVolume::ContainerPath()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void ContainerVolume::ContainerPath(hstring const& value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +bool ContainerVolume::ReadOnly()
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +void ContainerVolume::ReadOnly(bool value)
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ContainerVolume.h new
+36
@@ -0,0 +1,36 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ContainerVolume.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ContainerVolume class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ContainerVolume.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ContainerVolume : ContainerVolumeT<ContainerVolume>
20 +{
21 + ContainerVolume() = default;
22 +
23 + ContainerVolume(hstring const& windowsPath, hstring const& containerPath, bool readOnly);
24 + hstring WindowsPath();
25 + void WindowsPath(hstring const& value);
26 + hstring ContainerPath();
27 + void ContainerPath(hstring const& value);
28 + bool ReadOnly();
29 + void ReadOnly(bool value);
30 +};
31 +} // namespace winrt::Microsoft::WSL::Containers::implementation
32 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
33 +struct ContainerVolume : ContainerVolumeT<ContainerVolume, implementation::ContainerVolume>
34 +{
35 +};
36 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/ImageInfo.cpp new
+36
@@ -0,0 +1,36 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ImageInfo.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ImageInfo class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ImageInfo.h"
17 +#include "Microsoft.WSL.Containers.ImageInfo.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +hstring ImageInfo::Name()
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +winrt::Windows::Storage::Streams::IBuffer ImageInfo::Sha256()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +uint64_t ImageInfo::SizeBytes()
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +winrt::Windows::Foundation::DateTime ImageInfo::CreatedTimestamp()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ImageInfo.h new
+28
@@ -0,0 +1,28 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ImageInfo.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ImageInfo class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ImageInfo.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ImageInfo : ImageInfoT<ImageInfo>
20 +{
21 + ImageInfo() = default;
22 +
23 + hstring Name();
24 + winrt::Windows::Storage::Streams::IBuffer Sha256();
25 + uint64_t SizeBytes();
26 + winrt::Windows::Foundation::DateTime CreatedTimestamp();
27 +};
28 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ImageProgress.cpp new
+36
@@ -0,0 +1,36 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ImageProgress.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ImageProgress class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ImageProgress.h"
17 +#include "Microsoft.WSL.Containers.ImageProgress.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +hstring ImageProgress::Id()
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +winrt::Microsoft::WSL::Containers::ImageProgressStatus ImageProgress::Status()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +uint64_t ImageProgress::CurrentBytes()
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +uint64_t ImageProgress::TotalBytes()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ImageProgress.h new
+28
@@ -0,0 +1,28 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ImageProgress.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ImageProgress class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ImageProgress.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ImageProgress : ImageProgressT<ImageProgress>
20 +{
21 + ImageProgress() = default;
22 +
23 + hstring Id();
24 + winrt::Microsoft::WSL::Containers::ImageProgressStatus Status();
25 + uint64_t CurrentBytes();
26 + uint64_t TotalBytes();
27 +};
28 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/InstallProgress.cpp new
+32
@@ -0,0 +1,32 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + InstallProgress.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK InstallProgress class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "InstallProgress.h"
17 +#include "Microsoft.WSL.Containers.InstallProgress.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +winrt::Microsoft::WSL::Containers::ComponentFlags InstallProgress::Component()
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +uint32_t InstallProgress::Progress()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +uint32_t InstallProgress::Total()
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/InstallProgress.h new
+27
@@ -0,0 +1,27 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + InstallProgress.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK InstallProgress class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.InstallProgress.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct InstallProgress : InstallProgressT<InstallProgress>
20 +{
21 + InstallProgress() = default;
22 +
23 + winrt::Microsoft::WSL::Containers::ComponentFlags Component();
24 + uint32_t Progress();
25 + uint32_t Total();
26 +};
27 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/Process.cpp new
+72
@@ -0,0 +1,72 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + Process.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK Process class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "Process.h"
17 +#include "Microsoft.WSL.Containers.Process.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +void Process::Start()
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +uint32_t Process::Pid()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +winrt::Microsoft::WSL::Containers::ProcessState Process::State()
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +int32_t Process::ExitCode()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void Process::Signal(winrt::Microsoft::WSL::Containers::Signal const& signal)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +winrt::Windows::Storage::Streams::IInputStream Process::GetOutputStream(winrt::Microsoft::WSL::Containers::ProcessOutputHandle const& outputHandle)
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +winrt::Windows::Storage::Streams::IOutputStream Process::GetInputStream()
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +winrt::event_token Process::OutputReceived(winrt::Microsoft::WSL::Containers::ProcessOutputHandler const& handler)
49 +{
50 + throw hresult_not_implemented();
51 +}
52 +void Process::OutputReceived(winrt::event_token const& token) noexcept
53 +{
54 + assert(false); // TODO: not implemented, but this can't throw
55 +}
56 +winrt::event_token Process::ErrorReceived(winrt::Microsoft::WSL::Containers::ProcessOutputHandler const& handler)
57 +{
58 + throw hresult_not_implemented();
59 +}
60 +void Process::ErrorReceived(winrt::event_token const& token) noexcept
61 +{
62 + assert(false); // TODO: not implemented, but this can't throw
63 +}
64 +winrt::event_token Process::Exited(winrt::Microsoft::WSL::Containers::ProcessExitHandler const& handler)
65 +{
66 + throw hresult_not_implemented();
67 +}
68 +void Process::Exited(winrt::event_token const& token) noexcept
69 +{
70 + assert(false); // TODO: not implemented, but this can't throw
71 +}
72 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/Process.h new
+37
@@ -0,0 +1,37 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + Process.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK Process class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.Process.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct Process : ProcessT<Process>
20 +{
21 + Process() = default;
22 +
23 + void Start();
24 + uint32_t Pid();
25 + winrt::Microsoft::WSL::Containers::ProcessState State();
26 + int32_t ExitCode();
27 + void Signal(winrt::Microsoft::WSL::Containers::Signal const& signal);
28 + winrt::Windows::Storage::Streams::IInputStream GetOutputStream(winrt::Microsoft::WSL::Containers::ProcessOutputHandle const& outputHandle);
29 + winrt::Windows::Storage::Streams::IOutputStream GetInputStream();
30 + winrt::event_token OutputReceived(winrt::Microsoft::WSL::Containers::ProcessOutputHandler const& handler);
31 + void OutputReceived(winrt::event_token const& token) noexcept;
32 + winrt::event_token ErrorReceived(winrt::Microsoft::WSL::Containers::ProcessOutputHandler const& handler);
33 + void ErrorReceived(winrt::event_token const& token) noexcept;
34 + winrt::event_token Exited(winrt::Microsoft::WSL::Containers::ProcessExitHandler const& handler);
35 + void Exited(winrt::event_token const& token) noexcept;
36 +};
37 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ProcessSettings.cpp new
+44
@@ -0,0 +1,44 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ProcessSettings.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ProcessSettings class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ProcessSettings.h"
17 +#include "Microsoft.WSL.Containers.ProcessSettings.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +hstring ProcessSettings::WorkingDirectory()
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +void ProcessSettings::WorkingDirectory(hstring const& value)
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +winrt::Windows::Foundation::Collections::IVector<hstring> ProcessSettings::CmdLine()
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +void ProcessSettings::CmdLine(winrt::Windows::Foundation::Collections::IVector<hstring> const& value)
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +winrt::Windows::Foundation::Collections::IMap<hstring, hstring> ProcessSettings::EnvironmentVariables()
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +void ProcessSettings::EnvironmentVariables(winrt::Windows::Foundation::Collections::IMap<hstring, hstring> const& value)
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ProcessSettings.h new
+35
@@ -0,0 +1,35 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ProcessSettings.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ProcessSettings class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ProcessSettings.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ProcessSettings : ProcessSettingsT<ProcessSettings>
20 +{
21 + ProcessSettings() = default;
22 +
23 + hstring WorkingDirectory();
24 + void WorkingDirectory(hstring const& value);
25 + winrt::Windows::Foundation::Collections::IVector<hstring> CmdLine();
26 + void CmdLine(winrt::Windows::Foundation::Collections::IVector<hstring> const& value);
27 + winrt::Windows::Foundation::Collections::IMap<hstring, hstring> EnvironmentVariables();
28 + void EnvironmentVariables(winrt::Windows::Foundation::Collections::IMap<hstring, hstring> const& value);
29 +};
30 +} // namespace winrt::Microsoft::WSL::Containers::implementation
31 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
32 +struct ProcessSettings : ProcessSettingsT<ProcessSettings, implementation::ProcessSettings>
33 +{
34 +};
35 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/PullImageOptions.cpp new
+40
@@ -0,0 +1,40 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + PullImageOptions.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK PullImageOptions class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "PullImageOptions.h"
17 +#include "Microsoft.WSL.Containers.PullImageOptions.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +PullImageOptions::PullImageOptions(hstring const& uri)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +hstring PullImageOptions::Uri()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void PullImageOptions::Uri(hstring const& value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +hstring PullImageOptions::RegistryAuth()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void PullImageOptions::RegistryAuth(hstring const& value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/PullImageOptions.h new
+34
@@ -0,0 +1,34 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + PullImageOptions.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK PullImageOptions class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.PullImageOptions.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct PullImageOptions : PullImageOptionsT<PullImageOptions>
20 +{
21 + PullImageOptions() = default;
22 +
23 + PullImageOptions(hstring const& uri);
24 + hstring Uri();
25 + void Uri(hstring const& value);
26 + hstring RegistryAuth();
27 + void RegistryAuth(hstring const& value);
28 +};
29 +} // namespace winrt::Microsoft::WSL::Containers::implementation
30 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
31 +struct PullImageOptions : PullImageOptionsT<PullImageOptions, implementation::PullImageOptions>
32 +{
33 +};
34 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/PushImageOptions.cpp new
+40
@@ -0,0 +1,40 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + PushImageOptions.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK PushImageOptions class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "PushImageOptions.h"
17 +#include "Microsoft.WSL.Containers.PushImageOptions.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +PushImageOptions::PushImageOptions(hstring const& image, hstring const& registryAuth)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +hstring PushImageOptions::Image()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void PushImageOptions::Image(hstring const& value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +hstring PushImageOptions::RegistryAuth()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void PushImageOptions::RegistryAuth(hstring const& value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/PushImageOptions.h new
+34
@@ -0,0 +1,34 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + PushImageOptions.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK PushImageOptions class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.PushImageOptions.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct PushImageOptions : PushImageOptionsT<PushImageOptions>
20 +{
21 + PushImageOptions() = default;
22 +
23 + PushImageOptions(hstring const& image, hstring const& registryAuth);
24 + hstring Image();
25 + void Image(hstring const& value);
26 + hstring RegistryAuth();
27 + void RegistryAuth(hstring const& value);
28 +};
29 +} // namespace winrt::Microsoft::WSL::Containers::implementation
30 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
31 +struct PushImageOptions : PushImageOptionsT<PushImageOptions, implementation::PushImageOptions>
32 +{
33 +};
34 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/ServiceVersion.cpp new
+32
@@ -0,0 +1,32 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ServiceVersion.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK ServiceVersion class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "ServiceVersion.h"
17 +#include "Microsoft.WSL.Containers.ServiceVersion.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +uint32_t ServiceVersion::Major()
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +uint32_t ServiceVersion::Minor()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +uint32_t ServiceVersion::Revision()
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/ServiceVersion.h new
+27
@@ -0,0 +1,27 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + ServiceVersion.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK ServiceVersion class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.ServiceVersion.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct ServiceVersion : ServiceVersionT<ServiceVersion>
20 +{
21 + ServiceVersion() = default;
22 +
23 + uint32_t Major();
24 + uint32_t Minor();
25 + uint32_t Revision();
26 +};
27 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/Session.cpp
+58 -28
@@ -13,44 +13,74 @@ Abstract:
13 --*/
14
15 #include "precomp.h"
16 -
16 #include "Session.h"
17 #include "Microsoft.WSL.Containers.Session.g.cpp"
18
20 -namespace WSLC = winrt::Microsoft::WSL::Containers;
21 -
22 -namespace winrt::Microsoft::WSL::Containers {
23 -
24 -implementation::Session::~Session()
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +Session::Session(winrt::Microsoft::WSL::Containers::SessionSettings const& settings)
21 {
26 - if (m_session)
27 - {
28 - WslcReleaseSession(m_session);
29 - m_session = nullptr;
30 - }
22 + throw hresult_not_implemented();
23 }
32 -
33 -WSLC::Session implementation::Session::Create(WSLC::SessionSettings const& settings)
24 +void Session::Start()
25 {
35 - auto session = winrt::make_self<implementation::Session>();
36 - wil::unique_cotaskmem_string errorMessage;
37 - auto hr = WslcCreateSession(implementation::GetStructPointer(settings), implementation::GetHandlePointer(session), &errorMessage);
38 - THROW_MSG_IF_FAILED(hr, errorMessage);
39 - return *session;
26 + throw hresult_not_implemented();
27 }
41 -
42 -void implementation::Session::Terminate()
28 +void Session::Terminate()
29 {
44 - winrt::check_hresult(WslcTerminateSession(m_session));
30 + throw hresult_not_implemented();
31 }
46 -
47 -WslcSession implementation::Session::ToHandle()
32 +winrt::Microsoft::WSL::Containers::Container Session::CreateContainer(winrt::Microsoft::WSL::Containers::ContainerSettings const& containerSettings)
33 {
49 - return m_session;
34 + throw hresult_not_implemented();
35 }
51 -
52 -WslcSession* implementation::Session::ToHandlePointer()
36 +winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> Session::PullImageAsync(
37 + winrt::Microsoft::WSL::Containers::PullImageOptions options)
38 +{
39 + throw hresult_not_implemented();
40 +}
41 +winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> Session::ImportImageAsync(hstring path, hstring imageName)
42 +{
43 + throw hresult_not_implemented();
44 +}
45 +winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> Session::LoadImageAsync(hstring path)
46 +{
47 + throw hresult_not_implemented();
48 +}
49 +winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> Session::PushImageAsync(
50 + winrt::Microsoft::WSL::Containers::PushImageOptions options)
51 +{
52 + throw hresult_not_implemented();
53 +}
54 +void Session::DeleteImage(hstring const& nameOrId)
55 +{
56 + throw hresult_not_implemented();
57 +}
58 +void Session::TagImage(winrt::Microsoft::WSL::Containers::TagImageOptions const& options)
59 +{
60 + throw hresult_not_implemented();
61 +}
62 +void Session::CreateVhdVolume(winrt::Microsoft::WSL::Containers::VhdOptions const& options)
63 +{
64 + throw hresult_not_implemented();
65 +}
66 +void Session::DeleteVhdVolume(hstring const& name)
67 +{
68 + throw hresult_not_implemented();
69 +}
70 +hstring Session::Authenticate(winrt::Windows::Foundation::Uri const& serverAddress, hstring const& username, hstring const& password)
71 +{
72 + throw hresult_not_implemented();
73 +}
74 +winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::WSL::Containers::ImageInfo> Session::Images()
75 +{
76 + throw hresult_not_implemented();
77 +}
78 +winrt::event_token Session::Terminated(winrt::Microsoft::WSL::Containers::SessionTerminationHandler const& handler)
79 +{
80 + throw hresult_not_implemented();
81 +}
82 +void Session::Terminated(winrt::event_token const& token) noexcept
83 {
54 - return &m_session;
84 + assert(false); // TODO: not implemented, but this can't throw
85 }
56 -} // namespace winrt::Microsoft::WSL::Containers
86 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/Session.h
+17 -13
@@ -14,30 +14,34 @@ Abstract:
14
15 #pragma once
16 #include "Microsoft.WSL.Containers.Session.g.h"
17 -#include "SessionSettings.h"
18 -#include "Helpers.h"
17
18 namespace winrt::Microsoft::WSL::Containers::implementation {
19 struct Session : SessionT<Session>
20 {
21 Session() = default;
24 - ~Session();
22 + Session(winrt::Microsoft::WSL::Containers::SessionSettings const& settings);
23
26 - static winrt::Microsoft::WSL::Containers::Session Create(winrt::Microsoft::WSL::Containers::SessionSettings const& settings);
24 + void Start();
25 void Terminate();
28 -
29 - WslcSession ToHandle();
30 - WslcSession* ToHandlePointer();
31 -
32 -private:
33 - WslcSession m_session{nullptr};
26 + winrt::Microsoft::WSL::Containers::Container CreateContainer(winrt::Microsoft::WSL::Containers::ContainerSettings const& containerSettings);
27 + winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> PullImageAsync(
28 + winrt::Microsoft::WSL::Containers::PullImageOptions options);
29 + winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> ImportImageAsync(hstring path, hstring imageName);
30 + winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> LoadImageAsync(hstring path);
31 + winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::ImageProgress> PushImageAsync(
32 + winrt::Microsoft::WSL::Containers::PushImageOptions options);
33 + void DeleteImage(hstring const& nameOrId);
34 + void TagImage(winrt::Microsoft::WSL::Containers::TagImageOptions const& options);
35 + void CreateVhdVolume(winrt::Microsoft::WSL::Containers::VhdOptions const& options);
36 + void DeleteVhdVolume(hstring const& name);
37 + hstring Authenticate(winrt::Windows::Foundation::Uri const& serverAddress, hstring const& username, hstring const& password);
38 + winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::WSL::Containers::ImageInfo> Images();
39 + winrt::event_token Terminated(winrt::Microsoft::WSL::Containers::SessionTerminationHandler const& handler);
40 + void Terminated(winrt::event_token const& token) noexcept;
41 };
42 } // namespace winrt::Microsoft::WSL::Containers::implementation
36 -
43 namespace winrt::Microsoft::WSL::Containers::factory_implementation {
44 struct Session : SessionT<Session, implementation::Session>
45 {
46 };
47 } // namespace winrt::Microsoft::WSL::Containers::factory_implementation
42 -
43 -DEFINE_TYPE_HELPERS(Session);
\ No newline at end of file
src/windows/WslcSDK/winrt/SessionSettings.cpp
+34 -53
@@ -16,84 +16,65 @@ Abstract:
16 #include "SessionSettings.h"
17 #include "Microsoft.WSL.Containers.SessionSettings.g.cpp"
18
19 -namespace WSLC = winrt::Microsoft::WSL::Containers;
20 -
21 -namespace winrt::Microsoft::WSL::Containers {
22 -implementation::SessionSettings::SessionSettings(hstring const& name, hstring const& storagePath) :
23 - m_name(name), m_storagePath(storagePath)
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +SessionSettings::SessionSettings(hstring const& name, hstring const& storagePath)
21 {
25 - winrt::check_hresult(WslcInitSessionSettings(m_name.c_str(), m_storagePath.c_str(), &m_sessionSettings));
22 + throw hresult_not_implemented();
23 }
27 -
28 -hstring implementation::SessionSettings::Name()
24 +hstring SessionSettings::Name()
25 {
30 - return hstring{m_name};
26 + throw hresult_not_implemented();
27 }
32 -
33 -hstring implementation::SessionSettings::StoragePath()
28 +void SessionSettings::Name(hstring const& value)
29 {
35 - return hstring{m_storagePath};
30 + throw hresult_not_implemented();
31 }
37 -
38 -uint32_t implementation::SessionSettings::CpuCount()
32 +hstring SessionSettings::StoragePath()
33 {
40 - return m_cpuCount;
34 + throw hresult_not_implemented();
35 }
42 -
43 -void implementation::SessionSettings::CpuCount(uint32_t value)
36 +void SessionSettings::StoragePath(hstring const& value)
37 {
45 - m_cpuCount = value;
46 - winrt::check_hresult(WslcSetSessionSettingsCpuCount(&m_sessionSettings, m_cpuCount));
38 + throw hresult_not_implemented();
39 }
48 -
49 -uint32_t implementation::SessionSettings::MemoryMb()
40 +winrt::Windows::Foundation::IReference<uint32_t> SessionSettings::CpuCount()
41 {
51 - return m_memoryMb;
42 + throw hresult_not_implemented();
43 }
53 -
54 -void implementation::SessionSettings::MemoryMb(uint32_t value)
44 +void SessionSettings::CpuCount(winrt::Windows::Foundation::IReference<uint32_t> const& value)
45 {
56 - m_memoryMb = value;
57 - winrt::check_hresult(WslcSetSessionSettingsMemory(&m_sessionSettings, m_memoryMb));
46 + throw hresult_not_implemented();
47 }
59 -
60 -uint32_t implementation::SessionSettings::TimeoutMS()
48 +winrt::Windows::Foundation::IReference<uint32_t> SessionSettings::MemoryMB()
49 {
62 - return m_timeoutMS;
50 + throw hresult_not_implemented();
51 }
64 -
65 -void implementation::SessionSettings::TimeoutMS(uint32_t value)
52 +void SessionSettings::MemoryMB(winrt::Windows::Foundation::IReference<uint32_t> const& value)
53 {
67 - m_timeoutMS = value;
68 - winrt::check_hresult(WslcSetSessionSettingsTimeout(&m_sessionSettings, m_timeoutMS));
54 + throw hresult_not_implemented();
55 }
70 -
71 -WSLC::VhdRequirements implementation::SessionSettings::VhdRequirements()
56 +winrt::Windows::Foundation::IReference<uint32_t> SessionSettings::TimeoutMS()
57 {
73 - return m_vhdRequirements;
58 + throw hresult_not_implemented();
59 }
75 -
76 -void implementation::SessionSettings::VhdRequirements(WSLC::VhdRequirements const& value)
60 +void SessionSettings::TimeoutMS(winrt::Windows::Foundation::IReference<uint32_t> const& value)
61 {
78 - m_vhdRequirements = value;
79 - auto vhdRequirements =
80 - m_vhdRequirements ? winrt::get_self<implementation::VhdRequirements>(m_vhdRequirements)->ToStructPointer() : nullptr;
81 - winrt::check_hresult(WslcSetSessionSettingsVhd(&m_sessionSettings, vhdRequirements));
62 + throw hresult_not_implemented();
63 }
83 -
84 -WSLC::SessionFeatureFlags implementation::SessionSettings::FeatureFlags()
64 +winrt::Microsoft::WSL::Containers::VhdOptions SessionSettings::VhdRequirements()
65 {
86 - return m_featureFlags;
66 + throw hresult_not_implemented();
67 }
88 -
89 -void implementation::SessionSettings::FeatureFlags(WSLC::SessionFeatureFlags const& value)
68 +void SessionSettings::VhdRequirements(winrt::Microsoft::WSL::Containers::VhdOptions const& value)
69 {
91 - m_featureFlags = value;
92 - winrt::check_hresult(WslcSetSessionSettingsFeatureFlags(&m_sessionSettings, static_cast<WslcSessionFeatureFlags>(m_featureFlags)));
70 + throw hresult_not_implemented();
71 }
94 -
95 -WslcSessionSettings* implementation::SessionSettings::ToStructPointer()
72 +winrt::Microsoft::WSL::Containers::SessionFeatureFlags SessionSettings::FeatureFlags()
73 +{
74 + throw hresult_not_implemented();
75 +}
76 +void SessionSettings::FeatureFlags(winrt::Microsoft::WSL::Containers::SessionFeatureFlags const& value)
77 {
97 - return &m_sessionSettings;
78 + throw hresult_not_implemented();
79 }
99 -} // namespace winrt::Microsoft::WSL::Containers
80 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/SessionSettings.h
+10 -26
@@ -14,9 +14,6 @@ Abstract:
14
15 #pragma once
16 #include "Microsoft.WSL.Containers.SessionSettings.g.h"
17 -#include "VhdRequirements.h"
18 -#include "Helpers.h"
19 -#include "Defaults.h"
17
18 namespace winrt::Microsoft::WSL::Containers::implementation {
19 struct SessionSettings : SessionSettingsT<SessionSettings>
@@ -25,36 +22,23 @@ struct SessionSettings : SessionSettingsT<SessionSettings>
22
23 SessionSettings(hstring const& name, hstring const& storagePath);
24 hstring Name();
25 + void Name(hstring const& value);
26 hstring StoragePath();
29 - uint32_t CpuCount();
30 - void CpuCount(uint32_t value);
31 - uint32_t MemoryMb();
32 - void MemoryMb(uint32_t value);
33 - uint32_t TimeoutMS();
34 - void TimeoutMS(uint32_t value);
35 - winrt::Microsoft::WSL::Containers::VhdRequirements VhdRequirements();
36 - void VhdRequirements(winrt::Microsoft::WSL::Containers::VhdRequirements const& value);
27 + void StoragePath(hstring const& value);
28 + winrt::Windows::Foundation::IReference<uint32_t> CpuCount();
29 + void CpuCount(winrt::Windows::Foundation::IReference<uint32_t> const& value);
30 + winrt::Windows::Foundation::IReference<uint32_t> MemoryMB();
31 + void MemoryMB(winrt::Windows::Foundation::IReference<uint32_t> const& value);
32 + winrt::Windows::Foundation::IReference<uint32_t> TimeoutMS();
33 + void TimeoutMS(winrt::Windows::Foundation::IReference<uint32_t> const& value);
34 + winrt::Microsoft::WSL::Containers::VhdOptions VhdRequirements();
35 + void VhdRequirements(winrt::Microsoft::WSL::Containers::VhdOptions const& value);
36 winrt::Microsoft::WSL::Containers::SessionFeatureFlags FeatureFlags();
37 void FeatureFlags(winrt::Microsoft::WSL::Containers::SessionFeatureFlags const& value);
39 -
40 - WslcSessionSettings* ToStructPointer();
41 -
42 -private:
43 - WslcSessionSettings m_sessionSettings{};
44 - std::wstring m_name;
45 - std::wstring m_storagePath;
46 - uint32_t m_cpuCount{s_DefaultCPUCount};
47 - uint32_t m_memoryMb{s_DefaultMemoryMB};
48 - uint32_t m_timeoutMS{s_DefaultBootTimeout};
49 - winrt::Microsoft::WSL::Containers::VhdRequirements m_vhdRequirements{nullptr};
50 - winrt::Microsoft::WSL::Containers::SessionFeatureFlags m_featureFlags{winrt::Microsoft::WSL::Containers::SessionFeatureFlags::None};
38 };
39 } // namespace winrt::Microsoft::WSL::Containers::implementation
53 -
40 namespace winrt::Microsoft::WSL::Containers::factory_implementation {
41 struct SessionSettings : SessionSettingsT<SessionSettings, implementation::SessionSettings>
42 {
43 };
44 } // namespace winrt::Microsoft::WSL::Containers::factory_implementation
59 -
60 -DEFINE_TYPE_HELPERS(SessionSettings);
\ No newline at end of file
src/windows/WslcSDK/winrt/TagImageOptions.cpp new
+48
@@ -0,0 +1,48 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + TagImageOptions.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK TagImageOptions class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "TagImageOptions.h"
17 +#include "Microsoft.WSL.Containers.TagImageOptions.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +TagImageOptions::TagImageOptions(hstring const& image, hstring const& repository, hstring const& tag)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +hstring TagImageOptions::Image()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void TagImageOptions::Image(hstring const& value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +hstring TagImageOptions::Repository()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void TagImageOptions::Repository(hstring const& value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +hstring TagImageOptions::Tag()
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +void TagImageOptions::Tag(hstring const& value)
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/TagImageOptions.h new
+36
@@ -0,0 +1,36 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + TagImageOptions.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK TagImageOptions class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.TagImageOptions.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct TagImageOptions : TagImageOptionsT<TagImageOptions>
20 +{
21 + TagImageOptions() = default;
22 +
23 + TagImageOptions(hstring const& image, hstring const& repository, hstring const& tag);
24 + hstring Image();
25 + void Image(hstring const& value);
26 + hstring Repository();
27 + void Repository(hstring const& value);
28 + hstring Tag();
29 + void Tag(hstring const& value);
30 +};
31 +} // namespace winrt::Microsoft::WSL::Containers::implementation
32 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
33 +struct TagImageOptions : TagImageOptionsT<TagImageOptions, implementation::TagImageOptions>
34 +{
35 +};
36 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/VhdOptions.cpp new
+52
@@ -0,0 +1,52 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + VhdOptions.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK VhdOptions class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "VhdOptions.h"
17 +#include "Microsoft.WSL.Containers.VhdOptions.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +VhdOptions::VhdOptions(hstring const& name, uint64_t sizeInBytes, winrt::Microsoft::WSL::Containers::VhdType const& type)
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +hstring VhdOptions::Name()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +void VhdOptions::Name(hstring const& value)
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +uint64_t VhdOptions::SizeInBytes()
33 +{
34 + throw hresult_not_implemented();
35 +}
36 +void VhdOptions::SizeInBytes(uint64_t value)
37 +{
38 + throw hresult_not_implemented();
39 +}
40 +winrt::Microsoft::WSL::Containers::VhdType VhdOptions::Type()
41 +{
42 + throw hresult_not_implemented();
43 +}
44 +void VhdOptions::Type(winrt::Microsoft::WSL::Containers::VhdType const& value)
45 +{
46 + throw hresult_not_implemented();
47 +}
48 +void VhdOptions::SetOwner(uint32_t uid, uint32_t gid)
49 +{
50 + throw hresult_not_implemented();
51 +}
52 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/VhdOptions.h new
+38
@@ -0,0 +1,38 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + VhdOptions.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK VhdOptions class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.VhdOptions.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct VhdOptions : VhdOptionsT<VhdOptions>
20 +{
21 + VhdOptions() = default;
22 +
23 + VhdOptions(hstring const& name, uint64_t sizeInBytes, winrt::Microsoft::WSL::Containers::VhdType const& type);
24 + hstring Name();
25 + void Name(hstring const& value);
26 + uint64_t SizeInBytes();
27 + void SizeInBytes(uint64_t value);
28 + winrt::Microsoft::WSL::Containers::VhdType Type();
29 + void Type(winrt::Microsoft::WSL::Containers::VhdType const& value);
30 +
31 + void SetOwner(uint32_t uid, uint32_t gid);
32 +};
33 +} // namespace winrt::Microsoft::WSL::Containers::implementation
34 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
35 +struct VhdOptions : VhdOptionsT<VhdOptions, implementation::VhdOptions>
36 +{
37 +};
38 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/WslcService.cpp new
+32
@@ -0,0 +1,32 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + WslcService.cpp
8 +
9 +Abstract:
10 +
11 + This file contains the implementation of the WinRT wrapper for the WSLC SDK WslcService class.
12 +
13 +--*/
14 +
15 +#include "precomp.h"
16 +#include "WslcService.h"
17 +#include "Microsoft.WSL.Containers.WslcService.g.cpp"
18 +
19 +namespace winrt::Microsoft::WSL::Containers::implementation {
20 +winrt::Microsoft::WSL::Containers::ComponentFlags WslcService::GetMissingComponents()
21 +{
22 + throw hresult_not_implemented();
23 +}
24 +winrt::Microsoft::WSL::Containers::ServiceVersion WslcService::GetVersion()
25 +{
26 + throw hresult_not_implemented();
27 +}
28 +winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::InstallProgress> WslcService::InstallWithDependenciesAsync()
29 +{
30 + throw hresult_not_implemented();
31 +}
32 +} // namespace winrt::Microsoft::WSL::Containers::implementation
src/windows/WslcSDK/winrt/WslcService.h new
+32
@@ -0,0 +1,32 @@
1 +/*++
2 +
3 +Copyright (c) Microsoft. All rights reserved.
4 +
5 +Module Name:
6 +
7 + WslcService.h
8 +
9 +Abstract:
10 +
11 + This file contains the definition of the WinRT wrapper for the WSLC SDK WslcService class.
12 +
13 +--*/
14 +
15 +#pragma once
16 +#include "Microsoft.WSL.Containers.WslcService.g.h"
17 +
18 +namespace winrt::Microsoft::WSL::Containers::implementation {
19 +struct WslcService
20 +{
21 + WslcService() = default;
22 +
23 + static winrt::Microsoft::WSL::Containers::ComponentFlags GetMissingComponents();
24 + static winrt::Microsoft::WSL::Containers::ServiceVersion GetVersion();
25 + static winrt::Windows::Foundation::IAsyncActionWithProgress<winrt::Microsoft::WSL::Containers::InstallProgress> InstallWithDependenciesAsync();
26 +};
27 +} // namespace winrt::Microsoft::WSL::Containers::implementation
28 +namespace winrt::Microsoft::WSL::Containers::factory_implementation {
29 +struct WslcService : WslcServiceT<WslcService, implementation::WslcService>
30 +{
31 +};
32 +} // namespace winrt::Microsoft::WSL::Containers::factory_implementation
src/windows/WslcSDK/winrt/wslcsdk.idl
+285 -15
@@ -14,32 +14,250 @@ Abstract:
14
15 namespace Microsoft.WSL.Containers
16 {
17 + [flags]
18 + enum SessionFeatureFlags
19 + {
20 + None = 0x00000000,
21 + EnableGpu = 0x00000004
22 + };
23 +
24 + enum SessionTerminationReason
25 + {
26 + Unknown = 0,
27 + Shutdown = 1,
28 + Crashed = 2,
29 + };
30 +
31 + delegate void SessionTerminationHandler(Session session, SessionTerminationReason reason);
32 +
33 runtimeclass SessionSettings
34 {
35 SessionSettings(String name, String storagePath);
36
21 - String Name { get; };
22 - String StoragePath { get; };
37 + String Name;
38 + String StoragePath;
39
24 - UInt32 CpuCount { get; set; };
25 - UInt32 MemoryMb { get; set; };
26 - UInt32 TimeoutMS { get; set; };
27 - VhdRequirements VhdRequirements { get; set; };
28 - SessionFeatureFlags FeatureFlags { get; set; };
40 + Windows.Foundation.IReference<UInt32> CpuCount;
41 + Windows.Foundation.IReference<UInt32> MemoryMB;
42 + Windows.Foundation.IReference<UInt32> TimeoutMS;
43 + VhdOptions VhdRequirements;
44 + SessionFeatureFlags FeatureFlags;
45 };
46
47 runtimeclass Session
48 {
33 - static Session Create(SessionSettings settings);
49 + Session(SessionSettings settings);
50
51 + void Start();
52 void Terminate();
53 +
54 + Container CreateContainer(ContainerSettings containerSettings);
55 +
56 + Windows.Foundation.IAsyncActionWithProgress<ImageProgress> PullImageAsync(PullImageOptions options);
57 + // TODO: Explore additional overloads for other types of input streams
58 + Windows.Foundation.IAsyncActionWithProgress<ImageProgress> ImportImageAsync(String path, String imageName);
59 + Windows.Foundation.IAsyncActionWithProgress<ImageProgress> LoadImageAsync(String path);
60 + Windows.Foundation.IAsyncActionWithProgress<ImageProgress> PushImageAsync(PushImageOptions options);
61 +
62 + void DeleteImage(String nameOrId);
63 + void TagImage(TagImageOptions options);
64 +
65 + void CreateVhdVolume(VhdOptions options);
66 + void DeleteVhdVolume(String name);
67 +
68 + String Authenticate(Windows.Foundation.Uri serverAddress, String username, String password);
69 +
70 + IVectorView<ImageInfo> Images { get; };
71 +
72 + event SessionTerminationHandler Terminated;
73 + };
74 +
75 +
76 + enum ContainerNetworkingMode
77 + {
78 + None = 0,
79 + Bridged = 1,
80 };
81
82 [flags]
39 - enum SessionFeatureFlags
83 + enum ContainerFlags
84 {
85 None = 0x00000000,
42 - EnableGpu = 0x00000004
86 + AutoRemove = 0x00000001,
87 + EnableGpu = 0x00000002,
88 + Privileged = 0x00000004,
89 + };
90 +
91 + enum PortProtocol
92 + {
93 + TCP = 0,
94 + UDP = 1,
95 + };
96 +
97 + runtimeclass ContainerPortMapping
98 + {
99 + ContainerPortMapping(UInt16 windowsPort, UInt16 containerPort, PortProtocol protocol);
100 +
101 + UInt16 WindowsPort;
102 + UInt16 ContainerPort;
103 + PortProtocol Protocol;
104 +
105 + Windows.Networking.HostName WindowsAddress;
106 + };
107 +
108 + runtimeclass ContainerVolume
109 + {
110 + ContainerVolume(String windowsPath, String containerPath, Boolean readOnly);
111 +
112 + String WindowsPath;
113 + String ContainerPath;
114 + Boolean ReadOnly;
115 + };
116 +
117 + runtimeclass ContainerNamedVolume
118 + {
119 + ContainerNamedVolume(String name, String containerPath, Boolean readOnly);
120 +
121 + String Name;
122 + String ContainerPath;
123 + Boolean ReadOnly;
124 + };
125 +
126 + [flags]
127 + enum ContainerStartFlags
128 + {
129 + None = 0x00000000,
130 + Attach = 0x00000001,
131 + };
132 +
133 + enum ContainerState
134 + {
135 + Invalid = 0,
136 + Created = 1,
137 + Running = 2,
138 + Exited = 3,
139 + Deleted = 4,
140 + };
141 +
142 + [flags]
143 + enum DeleteContainerFlags
144 + {
145 + None = 0,
146 + Force = 0x00000001
147 + };
148 +
149 + runtimeclass ContainerSettings
150 + {
151 + ContainerSettings(String imageName);
152 +
153 + String ImageName;
154 +
155 + String Name;
156 + ProcessSettings InitProcess;
157 + Windows.Foundation.IReference<ContainerNetworkingMode> NetworkingMode;
158 + String HostName;
159 + String DomainName;
160 + ContainerFlags Flags;
161 + IVector<ContainerPortMapping> PortMappings;
162 + IVector<ContainerVolume> Volumes;
163 + IVector<ContainerNamedVolume> NamedVolumes;
164 + };
165 +
166 + enum Signal
167 + {
168 + None = 0, // No signal; reserved for future use
169 + SIGHUP = 1, // SIGHUP: reload / hangup
170 + SIGINT = 2, // SIGINT: interrupt (Ctrl-C)
171 + SIGQUIT = 3, // SIGQUIT: quit with core dump
172 + SIGKILL = 9, // SIGKILL: immediate termination
173 + SIGTERM = 15, // SIGTERM: graceful shutdown
174 + };
175 +
176 + runtimeclass Container
177 + {
178 + void Start(ContainerStartFlags flags);
179 + void Stop(Signal signal, UInt32 timeoutSeconds);
180 + void Delete(DeleteContainerFlags flags);
181 +
182 + Process CreateProcess(ProcessSettings newProcessSettings);
183 +
184 + String Inspect();
185 +
186 + String Id { get; };
187 + Process InitProcess { get; };
188 + ContainerState State { get; };
189 + };
190 +
191 + enum ProcessOutputHandle
192 + {
193 + StandardOutput = 1,
194 + StandardError = 2,
195 + };
196 +
197 + runtimeclass ProcessSettings
198 + {
199 + ProcessSettings();
200 +
201 + String WorkingDirectory;
202 + IVector<String> CmdLine;
203 + IMap<String, String> EnvironmentVariables;
204 + };
205 +
206 + enum ProcessState
207 + {
208 + Unknown = 0,
209 + Running = 1,
210 + Exited = 2,
211 + Signalled = 3,
212 + };
213 +
214 + delegate void ProcessOutputHandler(Process process, UInt8[] data);
215 + delegate void ProcessExitHandler(Process process, Int32 exitCode);
216 +
217 + runtimeclass Process
218 + {
219 + void Start();
220 +
221 + void Signal(Signal signal);
222 + Windows.Storage.Streams.IInputStream GetOutputStream(ProcessOutputHandle outputHandle);
223 + Windows.Storage.Streams.IOutputStream GetInputStream();
224 +
225 + UInt32 Pid { get; };
226 + ProcessState State { get; };
227 + Int32 ExitCode { get; };
228 +
229 + event ProcessOutputHandler OutputReceived;
230 + event ProcessOutputHandler ErrorReceived;
231 + event ProcessExitHandler Exited;
232 + };
233 +
234 + [flags]
235 + enum ComponentFlags
236 + {
237 + None = 0,
238 + VirtualMachinePlatform = 1,
239 + WslPackage = 2,
240 + };
241 +
242 + runtimeclass ServiceVersion
243 + {
244 + UInt32 Major { get; };
245 + UInt32 Minor { get; };
246 + UInt32 Revision { get; };
247 + };
248 +
249 + runtimeclass InstallProgress
250 + {
251 + ComponentFlags Component { get; };
252 + UInt32 Progress { get; };
253 + UInt32 Total { get; };
254 + };
255 +
256 + runtimeclass WslcService
257 + {
258 + static ComponentFlags GetMissingComponents();
259 + static ServiceVersion GetVersion();
260 + static Windows.Foundation.IAsyncActionWithProgress<InstallProgress> InstallWithDependenciesAsync();
261 };
262
263 enum VhdType
@@ -48,17 +266,69 @@ namespace Microsoft.WSL.Containers
266 Fixed = 1,
267 };
268
51 - runtimeclass VhdRequirements
269 + runtimeclass VhdOptions
270 {
53 - VhdRequirements(String name, UInt64 sizeInBytes, VhdType type);
271 + VhdOptions(String name, UInt64 sizeInBytes, VhdType type);
272
55 - String Name { get; };
56 - UInt64 SizeInBytes { get; };
57 - VhdType Type { get; };
273 + String Name;
274 + UInt64 SizeInBytes;
275 + VhdType Type;
276
277 // Sets owner uid/gid on the volume root inode at mkfs time. Only
278 // supported on named volumes; setting this on a SessionSettings
279 // VhdRequirements fails at property-set time with E_INVALIDARG.
280 void SetOwner(UInt32 uid, UInt32 gid);
281 };
282 +
283 + enum ImageProgressStatus
284 + {
285 + Unknown = 0,
286 + Pulling = 1,
287 + Waiting = 2,
288 + Downloading = 3,
289 + Verifying = 4,
290 + Extracting = 5,
291 + Complete = 6,
292 + };
293 +
294 + runtimeclass ImageProgress
295 + {
296 + String Id { get; };
297 + ImageProgressStatus Status { get; };
298 + UInt64 CurrentBytes { get; };
299 + UInt64 TotalBytes { get; };
300 + };
301 +
302 + runtimeclass PullImageOptions
303 + {
304 + PullImageOptions(String uri);
305 +
306 + String Uri;
307 + String RegistryAuth;
308 + };
309 +
310 + runtimeclass PushImageOptions
311 + {
312 + PushImageOptions(String image, String registryAuth);
313 +
314 + String Image;
315 + String RegistryAuth;
316 + };
317 +
318 + runtimeclass TagImageOptions
319 + {
320 + TagImageOptions(String image, String repository, String tag);
321 +
322 + String Image;
323 + String Repository;
324 + String Tag;
325 + };
326 +
327 + runtimeclass ImageInfo
328 + {
329 + String Name { get; };
330 + Windows.Storage.Streams.IBuffer Sha256 { get; };
331 + UInt64 SizeBytes { get; };
332 + Windows.Foundation.DateTime CreatedTimestamp { get; };
333 + };
334 }
\ No newline at end of file