From 9c54684786d26c15feec9f6ea636414bd4aede38 Mon Sep 17 00:00:00 2001 From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com> Date: Sat, 16 Sep 2023 19:08:36 +0200 Subject: [PATCH] chore: Generate Docker client from OpenAPI specifications --- Testcontainers.sln | 14 + src/DockerEngine/.editorconfig | 1 + src/DockerEngine/DockerClient.cs | 25168 ++++++++++++++++ src/DockerEngine/DockerEngine.csproj | 15 + src/DockerEngine/NSwag.json | 18 + tests/DockerEngine.Tests/.editorconfig | 1 + tests/DockerEngine.Tests/DockerClientTest.cs | 53 + .../DockerEngine.Tests.csproj | 18 + tests/DockerEngine.Tests/Usings.cs | 6 + 9 files changed, 25294 insertions(+) create mode 100644 src/DockerEngine/.editorconfig create mode 100644 src/DockerEngine/DockerClient.cs create mode 100644 src/DockerEngine/DockerEngine.csproj create mode 100644 src/DockerEngine/NSwag.json create mode 100644 tests/DockerEngine.Tests/.editorconfig create mode 100644 tests/DockerEngine.Tests/DockerClientTest.cs create mode 100644 tests/DockerEngine.Tests/DockerEngine.Tests.csproj create mode 100644 tests/DockerEngine.Tests/Usings.cs diff --git a/Testcontainers.sln b/Testcontainers.sln index 4a415068d..f3167bd47 100644 --- a/Testcontainers.sln +++ b/Testcontainers.sln @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{673F23AE-769 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockerEngine", "src\DockerEngine\DockerEngine.csproj", "{64B58ABB-A849-4FC1-9D3B-2620140427A9}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Azurite", "src\Testcontainers.Azurite\Testcontainers.Azurite.csproj", "{3F2E254F-C203-43FD-A078-DC3E2CBC0F9F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.ClickHouse", "src\Testcontainers.ClickHouse\Testcontainers.ClickHouse.csproj", "{B061A78E-536E-4CA1-8401-234D5FBFBAB7}" @@ -71,6 +73,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.WebDriver", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers", "src\Testcontainers\Testcontainers.csproj", "{EC76857B-A3B8-4B7A-A1B0-8D867A4D1733}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockerEngine.Tests", "tests\DockerEngine.Tests\DockerEngine.Tests.csproj", "{F54DE0D3-D1C4-4A30-9B78-9F72338B5E6A}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Azurite.Tests", "tests\Testcontainers.Azurite.Tests\Testcontainers.Azurite.Tests.csproj", "{B272FDDE-5E01-425D-B9E1-10FF883DDAAA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.ClickHouse.Tests", "tests\Testcontainers.ClickHouse.Tests\Testcontainers.ClickHouse.Tests.csproj", "{9D0A0B32-4921-400C-99CB-8650677E3E44}" @@ -146,6 +150,10 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64B58ABB-A849-4FC1-9D3B-2620140427A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64B58ABB-A849-4FC1-9D3B-2620140427A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64B58ABB-A849-4FC1-9D3B-2620140427A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64B58ABB-A849-4FC1-9D3B-2620140427A9}.Release|Any CPU.Build.0 = Release|Any CPU {3F2E254F-C203-43FD-A078-DC3E2CBC0F9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F2E254F-C203-43FD-A078-DC3E2CBC0F9F}.Debug|Any CPU.Build.0 = Debug|Any CPU {3F2E254F-C203-43FD-A078-DC3E2CBC0F9F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -262,6 +270,10 @@ Global {EC76857B-A3B8-4B7A-A1B0-8D867A4D1733}.Debug|Any CPU.Build.0 = Debug|Any CPU {EC76857B-A3B8-4B7A-A1B0-8D867A4D1733}.Release|Any CPU.ActiveCfg = Release|Any CPU {EC76857B-A3B8-4B7A-A1B0-8D867A4D1733}.Release|Any CPU.Build.0 = Release|Any CPU + {F54DE0D3-D1C4-4A30-9B78-9F72338B5E6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F54DE0D3-D1C4-4A30-9B78-9F72338B5E6A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F54DE0D3-D1C4-4A30-9B78-9F72338B5E6A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F54DE0D3-D1C4-4A30-9B78-9F72338B5E6A}.Release|Any CPU.Build.0 = Release|Any CPU {B272FDDE-5E01-425D-B9E1-10FF883DDAAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B272FDDE-5E01-425D-B9E1-10FF883DDAAA}.Debug|Any CPU.Build.0 = Debug|Any CPU {B272FDDE-5E01-425D-B9E1-10FF883DDAAA}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -396,6 +408,7 @@ Global {EBA72C3B-57D5-43FF-A5B4-3D55B3B6D4C2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution + {64B58ABB-A849-4FC1-9D3B-2620140427A9} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} {3F2E254F-C203-43FD-A078-DC3E2CBC0F9F} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} {B061A78E-536E-4CA1-8401-234D5FBFBAB7} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} {A724806F-8C94-4438-8011-04A9A1575318} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} @@ -425,6 +438,7 @@ Global {C95A3B2F-2B28-49A7-8806-731C158BBC21} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} {64A87DE5-29B0-4A54-9E74-560484D8C7C0} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} {EC76857B-A3B8-4B7A-A1B0-8D867A4D1733} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} + {F54DE0D3-D1C4-4A30-9B78-9F72338B5E6A} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} {B272FDDE-5E01-425D-B9E1-10FF883DDAAA} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} {9D0A0B32-4921-400C-99CB-8650677E3E44} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} {2478673C-B063-469D-ABD1-0C3E0A25541B} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} diff --git a/src/DockerEngine/.editorconfig b/src/DockerEngine/.editorconfig new file mode 100644 index 000000000..6f066619d --- /dev/null +++ b/src/DockerEngine/.editorconfig @@ -0,0 +1 @@ +root = true \ No newline at end of file diff --git a/src/DockerEngine/DockerClient.cs b/src/DockerEngine/DockerClient.cs new file mode 100644 index 000000000..fc42c8090 --- /dev/null +++ b/src/DockerEngine/DockerClient.cs @@ -0,0 +1,25168 @@ +//---------------------- +// +// Generated using the NSwag toolchain v13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 612 // Disable "CS0612 '...' is obsolete" +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." +#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" +#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" +#pragma warning disable 8603 // Disable "CS8603 Possible null reference return" +#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter" + +namespace DockerEngine +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DockerClient + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public DockerClient(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings, true); + } + + private System.Text.Json.JsonSerializerOptions CreateSerializerSettings() + { + var settings = new System.Text.Json.JsonSerializerOptions(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// + /// List containers + /// + /// + /// Returns a list of containers. For details on the format, see the + ///
[inspect endpoint](#operation/ContainerInspect). + ///
+ ///
Note that it uses a different, smaller representation of a container + ///
than inspecting a single container. For example, the list of linked + ///
containers is not propagated . + ///
+ /// Return all containers. By default, only running containers are shown. + /// Return this number of most recently created containers, including + ///
non-running ones. + /// Return the size of container as fields `SizeRw` and `SizeRootFs`. + /// Filters to process on the container list, encoded as JSON (a + ///
`map[string][]string`). For example, `{"status": ["paused"]}` will + ///
only return paused containers. + ///
+ ///
Available filters: + ///
+ ///
- `ancestor`=(`<image-name>[:<tag>]`, `<image id>`, or `<image@digest>`) + ///
- `before`=(`<container id>` or `<container name>`) + ///
- `expose`=(`<port>[/<proto>]`|`<startport-endport>/[<proto>]`) + ///
- `exited=<int>` containers with exit code of `<int>` + ///
- `health`=(`starting`|`healthy`|`unhealthy`|`none`) + ///
- `id=<ID>` a container's ID + ///
- `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only) + ///
- `is-task=`(`true`|`false`) + ///
- `label=key` or `label="key=value"` of a container label + ///
- `name=<name>` a container's name + ///
- `network`=(`<network id>` or `<network name>`) + ///
- `publish`=(`<port>[/<proto>]`|`<startport-endport>/[<proto>]`) + ///
- `since`=(`<container id>` or `<container name>`) + ///
- `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`) + ///
- `volume`=(`<volume name>` or `<mount point destination>`) + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ContainerListAsync(bool? all, int? limit, bool? size, string filters) + { + return ContainerListAsync(all, limit, size, filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List containers + /// + /// + /// Returns a list of containers. For details on the format, see the + ///
[inspect endpoint](#operation/ContainerInspect). + ///
+ ///
Note that it uses a different, smaller representation of a container + ///
than inspecting a single container. For example, the list of linked + ///
containers is not propagated . + ///
+ /// Return all containers. By default, only running containers are shown. + /// Return this number of most recently created containers, including + ///
non-running ones. + /// Return the size of container as fields `SizeRw` and `SizeRootFs`. + /// Filters to process on the container list, encoded as JSON (a + ///
`map[string][]string`). For example, `{"status": ["paused"]}` will + ///
only return paused containers. + ///
+ ///
Available filters: + ///
+ ///
- `ancestor`=(`<image-name>[:<tag>]`, `<image id>`, or `<image@digest>`) + ///
- `before`=(`<container id>` or `<container name>`) + ///
- `expose`=(`<port>[/<proto>]`|`<startport-endport>/[<proto>]`) + ///
- `exited=<int>` containers with exit code of `<int>` + ///
- `health`=(`starting`|`healthy`|`unhealthy`|`none`) + ///
- `id=<ID>` a container's ID + ///
- `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only) + ///
- `is-task=`(`true`|`false`) + ///
- `label=key` or `label="key=value"` of a container label + ///
- `name=<name>` a container's name + ///
- `network`=(`<network id>` or `<network name>`) + ///
- `publish`=(`<port>[/<proto>]`|`<startport-endport>/[<proto>]`) + ///
- `since`=(`<container id>` or `<container name>`) + ///
- `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`) + ///
- `volume`=(`<volume name>` or `<mount point destination>`) + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ContainerListAsync(bool? all, int? limit, bool? size, string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/json?"); + if (all != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("all") + "=").Append(System.Uri.EscapeDataString(ConvertToString(all, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit") + "=").Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a container + /// + /// Assign the specified name to the container. Must match + ///
`/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`. + /// Platform in the format `os[/arch[/variant]]` used for image lookup. + ///
+ ///
When specified, the daemon checks if the requested image is present + ///
in the local image cache with the given OS and Architecture, and + ///
otherwise returns a `404` status. + ///
+ ///
If the option is not set, the host's native OS and Architecture are + ///
used to look up the image in the image cache. However, if no platform + ///
is passed and the given image does exist in the local image cache, + ///
but its OS or architecture does not match, the container is created + ///
with the available image, and a warning is added to the `Warnings` + ///
field in the response, for example; + ///
+ ///
WARNING: The requested image's platform (linux/arm64/v8) does not + ///
match the detected host platform (linux/amd64) and no + ///
specific platform was requested + /// Container to create + /// Container created successfully + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerCreateAsync(string name, string platform, Body body) + { + return ContainerCreateAsync(name, platform, body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a container + /// + /// Assign the specified name to the container. Must match + ///
`/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`. + /// Platform in the format `os[/arch[/variant]]` used for image lookup. + ///
+ ///
When specified, the daemon checks if the requested image is present + ///
in the local image cache with the given OS and Architecture, and + ///
otherwise returns a `404` status. + ///
+ ///
If the option is not set, the host's native OS and Architecture are + ///
used to look up the image in the image cache. However, if no platform + ///
is passed and the given image does exist in the local image cache, + ///
but its OS or architecture does not match, the container is created + ///
with the available image, and a warning is added to the `Warnings` + ///
field in the response, for example; + ///
+ ///
WARNING: The requested image's platform (linux/arm64/v8) does not + ///
match the detected host platform (linux/amd64) and no + ///
specific platform was requested + /// Container to create + /// Container created successfully + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerCreateAsync(string name, string platform, Body body, System.Threading.CancellationToken cancellationToken) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/create?"); + if (name != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("name") + "=").Append(System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (platform != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("platform") + "=").Append(System.Uri.EscapeDataString(ConvertToString(platform, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such image", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a container + /// + /// + /// Return low-level information about a container. + /// + /// ID or name of the container + /// Return the size of container as fields `SizeRw` and `SizeRootFs` + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerInspectAsync(string id, bool? size) + { + return ContainerInspectAsync(id, size, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a container + /// + /// + /// Return low-level information about a container. + /// + /// ID or name of the container + /// Return the size of container as fields `SizeRw` and `SizeRootFs` + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerInspectAsync(string id, bool? size, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/json?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List processes running inside a container + /// + /// + /// On Unix systems, this is done by running the `ps` command. This endpoint + ///
is not supported on Windows. + ///
+ /// ID or name of the container + /// The arguments to pass to `ps`. For example, `aux` + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerTopAsync(string id, string ps_args) + { + return ContainerTopAsync(id, ps_args, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List processes running inside a container + /// + /// + /// On Unix systems, this is done by running the `ps` command. This endpoint + ///
is not supported on Windows. + ///
+ /// ID or name of the container + /// The arguments to pass to `ps`. For example, `aux` + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerTopAsync(string id, string ps_args, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/top?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (ps_args != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("ps_args") + "=").Append(System.Uri.EscapeDataString(ConvertToString(ps_args, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get container logs + /// + /// + /// Get `stdout` and `stderr` logs from a container. + ///
+ ///
Note: This endpoint works only for containers with the `json-file` or + ///
`journald` logging driver. + ///
+ /// ID or name of the container + /// Keep connection after returning logs. + /// Return logs from `stdout` + /// Return logs from `stderr` + /// Only return logs since this time, as a UNIX timestamp + /// Only return logs before this time, as a UNIX timestamp + /// Add timestamps to every log line + /// Only return this number of log lines from the end of the logs. + ///
Specify as an integer or `all` to output all log lines. + /// logs returned as a stream in response body. + ///
For the stream format, [see the documentation for the attach endpoint](#operation/ContainerAttach). + ///
Note that unlike the attach endpoint, the logs endpoint does not + ///
upgrade the connection and does not set Content-Type.
+ /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerLogsAsync(string id, bool? follow, bool? stdout, bool? stderr, int? since, int? until, bool? timestamps, string tail) + { + return ContainerLogsAsync(id, follow, stdout, stderr, since, until, timestamps, tail, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get container logs + /// + /// + /// Get `stdout` and `stderr` logs from a container. + ///
+ ///
Note: This endpoint works only for containers with the `json-file` or + ///
`journald` logging driver. + ///
+ /// ID or name of the container + /// Keep connection after returning logs. + /// Return logs from `stdout` + /// Return logs from `stderr` + /// Only return logs since this time, as a UNIX timestamp + /// Only return logs before this time, as a UNIX timestamp + /// Add timestamps to every log line + /// Only return this number of log lines from the end of the logs. + ///
Specify as an integer or `all` to output all log lines. + /// logs returned as a stream in response body. + ///
For the stream format, [see the documentation for the attach endpoint](#operation/ContainerAttach). + ///
Note that unlike the attach endpoint, the logs endpoint does not + ///
upgrade the connection and does not set Content-Type.
+ /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerLogsAsync(string id, bool? follow, bool? stdout, bool? stderr, int? since, int? until, bool? timestamps, string tail, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/logs?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (follow != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("follow") + "=").Append(System.Uri.EscapeDataString(ConvertToString(follow, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stdout != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stdout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stdout, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stderr != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stderr") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stderr, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (since != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("since") + "=").Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (until != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("until") + "=").Append(System.Uri.EscapeDataString(ConvertToString(until, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (timestamps != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("timestamps") + "=").Append(System.Uri.EscapeDataString(ConvertToString(timestamps, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (tail != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tail") + "=").Append(System.Uri.EscapeDataString(ConvertToString(tail, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/vnd.docker.raw-stream")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); + disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse + return fileResponse_; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get changes on a container’s filesystem + /// + /// + /// Returns which files in a container's filesystem have been added, deleted, + ///
or modified. The `Kind` of modification can be one of: + ///
+ ///
- `0`: Modified ("C") + ///
- `1`: Added ("A") + ///
- `2`: Deleted ("D") + ///
+ /// ID or name of the container + /// The list of changes + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ContainerChangesAsync(string id) + { + return ContainerChangesAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get changes on a container’s filesystem + /// + /// + /// Returns which files in a container's filesystem have been added, deleted, + ///
or modified. The `Kind` of modification can be one of: + ///
+ ///
- `0`: Modified ("C") + ///
- `1`: Added ("A") + ///
- `2`: Deleted ("D") + ///
+ /// ID or name of the container + /// The list of changes + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ContainerChangesAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/changes"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Export a container + /// + /// + /// Export the contents of a container as a tarball. + /// + /// ID or name of the container + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerExportAsync(string id) + { + return ContainerExportAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Export a container + /// + /// + /// Export the contents of a container as a tarball. + /// + /// ID or name of the container + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerExportAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/export"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/octet-stream")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + return default(FileResponse); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get container stats based on resource usage + /// + /// + /// This endpoint returns a live stream of a container’s resource usage + ///
statistics. + ///
+ ///
The `precpu_stats` is the CPU statistic of the *previous* read, and is + ///
used to calculate the CPU usage percentage. It is not an exact copy + ///
of the `cpu_stats` field. + ///
+ ///
If either `precpu_stats.online_cpus` or `cpu_stats.online_cpus` is + ///
nil then for compatibility with older daemons the length of the + ///
corresponding `cpu_usage.percpu_usage` array should be used. + ///
+ ///
On a cgroup v2 host, the following fields are not set + ///
* `blkio_stats`: all fields other than `io_service_bytes_recursive` + ///
* `cpu_stats`: `cpu_usage.percpu_usage` + ///
* `memory_stats`: `max_usage` and `failcnt` + ///
Also, `memory_stats.stats` fields are incompatible with cgroup v1. + ///
+ ///
To calculate the values shown by the `stats` command of the docker cli tool + ///
the following formulas can be used: + ///
* used_memory = `memory_stats.usage - memory_stats.stats.cache` + ///
* available_memory = `memory_stats.limit` + ///
* Memory usage % = `(used_memory / available_memory) * 100.0` + ///
* cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage` + ///
* system_cpu_delta = `cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage` + ///
* number_cpus = `lenght(cpu_stats.cpu_usage.percpu_usage)` or `cpu_stats.online_cpus` + ///
* CPU usage % = `(cpu_delta / system_cpu_delta) * number_cpus * 100.0` + ///
+ /// ID or name of the container + /// Stream the output. If false, the stats will be output once and then + ///
it will disconnect. + /// Only get a single stat instead of waiting for 2 cycles. Must be used + ///
with `stream=false`. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerStatsAsync(string id, bool? stream, bool? one_shot) + { + return ContainerStatsAsync(id, stream, one_shot, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get container stats based on resource usage + /// + /// + /// This endpoint returns a live stream of a container’s resource usage + ///
statistics. + ///
+ ///
The `precpu_stats` is the CPU statistic of the *previous* read, and is + ///
used to calculate the CPU usage percentage. It is not an exact copy + ///
of the `cpu_stats` field. + ///
+ ///
If either `precpu_stats.online_cpus` or `cpu_stats.online_cpus` is + ///
nil then for compatibility with older daemons the length of the + ///
corresponding `cpu_usage.percpu_usage` array should be used. + ///
+ ///
On a cgroup v2 host, the following fields are not set + ///
* `blkio_stats`: all fields other than `io_service_bytes_recursive` + ///
* `cpu_stats`: `cpu_usage.percpu_usage` + ///
* `memory_stats`: `max_usage` and `failcnt` + ///
Also, `memory_stats.stats` fields are incompatible with cgroup v1. + ///
+ ///
To calculate the values shown by the `stats` command of the docker cli tool + ///
the following formulas can be used: + ///
* used_memory = `memory_stats.usage - memory_stats.stats.cache` + ///
* available_memory = `memory_stats.limit` + ///
* Memory usage % = `(used_memory / available_memory) * 100.0` + ///
* cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage` + ///
* system_cpu_delta = `cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage` + ///
* number_cpus = `lenght(cpu_stats.cpu_usage.percpu_usage)` or `cpu_stats.online_cpus` + ///
* CPU usage % = `(cpu_delta / system_cpu_delta) * number_cpus * 100.0` + ///
+ /// ID or name of the container + /// Stream the output. If false, the stats will be output once and then + ///
it will disconnect. + /// Only get a single stat instead of waiting for 2 cycles. Must be used + ///
with `stream=false`. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerStatsAsync(string id, bool? stream, bool? one_shot, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/stats?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (stream != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stream") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stream, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (one_shot != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("one-shot") + "=").Append(System.Uri.EscapeDataString(ConvertToString(one_shot, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Resize a container TTY + /// + /// + /// Resize the TTY for a container. + /// + /// ID or name of the container + /// Height of the TTY session in characters + /// Width of the TTY session in characters + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerResizeAsync(string id, int? h, int? w) + { + return ContainerResizeAsync(id, h, w, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Resize a container TTY + /// + /// + /// Resize the TTY for a container. + /// + /// ID or name of the container + /// Height of the TTY session in characters + /// Width of the TTY session in characters + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerResizeAsync(string id, int? h, int? w, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/resize?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (h != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("h") + "=").Append(System.Uri.EscapeDataString(ConvertToString(h, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (w != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("w") + "=").Append(System.Uri.EscapeDataString(ConvertToString(w, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("cannot resize container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Start a container + /// + /// ID or name of the container + /// Override the key sequence for detaching a container. Format is a + ///
single character `[a-Z]` or `ctrl-<value>` where `<value>` is one + ///
of: `a-z`, `@`, `^`, `[`, `,` or `_`. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerStartAsync(string id, string detachKeys) + { + return ContainerStartAsync(id, detachKeys, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Start a container + /// + /// ID or name of the container + /// Override the key sequence for detaching a container. Format is a + ///
single character `[a-Z]` or `ctrl-<value>` where `<value>` is one + ///
of: `a-z`, `@`, `^`, `[`, `,` or `_`. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerStartAsync(string id, string detachKeys, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/start?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (detachKeys != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("detachKeys") + "=").Append(System.Uri.EscapeDataString(ConvertToString(detachKeys, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 304) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("container already started", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Stop a container + /// + /// ID or name of the container + /// Signal to send to the container as an integer or string (e.g. `SIGINT`). + /// Number of seconds to wait before killing the container + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerStopAsync(string id, string signal, int? t) + { + return ContainerStopAsync(id, signal, t, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Stop a container + /// + /// ID or name of the container + /// Signal to send to the container as an integer or string (e.g. `SIGINT`). + /// Number of seconds to wait before killing the container + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerStopAsync(string id, string signal, int? t, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/stop?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (signal != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("signal") + "=").Append(System.Uri.EscapeDataString(ConvertToString(signal, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (t != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("t") + "=").Append(System.Uri.EscapeDataString(ConvertToString(t, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 304) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("container already stopped", status_, responseText_, headers_, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Restart a container + /// + /// ID or name of the container + /// Signal to send to the container as an integer or string (e.g. `SIGINT`). + /// Number of seconds to wait before killing the container + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerRestartAsync(string id, string signal, int? t) + { + return ContainerRestartAsync(id, signal, t, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Restart a container + /// + /// ID or name of the container + /// Signal to send to the container as an integer or string (e.g. `SIGINT`). + /// Number of seconds to wait before killing the container + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerRestartAsync(string id, string signal, int? t, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/restart?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (signal != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("signal") + "=").Append(System.Uri.EscapeDataString(ConvertToString(signal, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (t != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("t") + "=").Append(System.Uri.EscapeDataString(ConvertToString(t, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Kill a container + /// + /// + /// Send a POSIX signal to a container, defaulting to killing to the + ///
container. + ///
+ /// ID or name of the container + /// Signal to send to the container as an integer or string (e.g. `SIGINT`). + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerKillAsync(string id, string signal) + { + return ContainerKillAsync(id, signal, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Kill a container + /// + /// + /// Send a POSIX signal to a container, defaulting to killing to the + ///
container. + ///
+ /// ID or name of the container + /// Signal to send to the container as an integer or string (e.g. `SIGINT`). + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerKillAsync(string id, string signal, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/kill?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (signal != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("signal") + "=").Append(System.Uri.EscapeDataString(ConvertToString(signal, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("container is not running", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Update a container + /// + /// + /// Change various configuration options of a container without having to + ///
recreate it. + ///
+ /// ID or name of the container + /// The container has been updated. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerUpdateAsync(string id, Update update) + { + return ContainerUpdateAsync(id, update, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update a container + /// + /// + /// Change various configuration options of a container without having to + ///
recreate it. + ///
+ /// ID or name of the container + /// The container has been updated. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerUpdateAsync(string id, Update update, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (update == null) + throw new System.ArgumentNullException("update"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/update"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(update, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Rename a container + /// + /// ID or name of the container + /// New name for the container + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerRenameAsync(string id, string name) + { + return ContainerRenameAsync(id, name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Rename a container + /// + /// ID or name of the container + /// New name for the container + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerRenameAsync(string id, string name, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/rename?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("name") + "=").Append(System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("name already in use", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Pause a container + /// + /// + /// Use the freezer cgroup to suspend all processes in a container. + ///
+ ///
Traditionally, when suspending a process the `SIGSTOP` signal is used, + ///
which is observable by the process being suspended. With the freezer + ///
cgroup the process is unaware, and unable to capture, that it is being + ///
suspended, and subsequently resumed. + ///
+ /// ID or name of the container + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerPauseAsync(string id) + { + return ContainerPauseAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Pause a container + /// + /// + /// Use the freezer cgroup to suspend all processes in a container. + ///
+ ///
Traditionally, when suspending a process the `SIGSTOP` signal is used, + ///
which is observable by the process being suspended. With the freezer + ///
cgroup the process is unaware, and unable to capture, that it is being + ///
suspended, and subsequently resumed. + ///
+ /// ID or name of the container + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerPauseAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/pause"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Unpause a container + /// + /// + /// Resume a container which has been paused. + /// + /// ID or name of the container + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerUnpauseAsync(string id) + { + return ContainerUnpauseAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Unpause a container + /// + /// + /// Resume a container which has been paused. + /// + /// ID or name of the container + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerUnpauseAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/unpause"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Attach to a container + /// + /// + /// Attach to a container to read its output or send it input. You can attach + ///
to the same container multiple times and you can reattach to containers + ///
that have been detached. + ///
+ ///
Either the `stream` or `logs` parameter must be `true` for this endpoint + ///
to do anything. + ///
+ ///
See the [documentation for the `docker attach` command](https://docs.docker.com/engine/reference/commandline/attach/) + ///
for more details. + ///
+ ///
### Hijacking + ///
+ ///
This endpoint hijacks the HTTP connection to transport `stdin`, `stdout`, + ///
and `stderr` on the same socket. + ///
+ ///
This is the response from the daemon for an attach request: + ///
+ ///
``` + ///
HTTP/1.1 200 OK + ///
Content-Type: application/vnd.docker.raw-stream + ///
+ ///
[STREAM] + ///
``` + ///
+ ///
After the headers and two new lines, the TCP connection can now be used + ///
for raw, bidirectional communication between the client and server. + ///
+ ///
To hint potential proxies about connection hijacking, the Docker client + ///
can also optionally send connection upgrade headers. + ///
+ ///
For example, the client sends this request to upgrade the connection: + ///
+ ///
``` + ///
POST /containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1 + ///
Upgrade: tcp + ///
Connection: Upgrade + ///
``` + ///
+ ///
The Docker daemon will respond with a `101 UPGRADED` response, and will + ///
similarly follow with the raw stream: + ///
+ ///
``` + ///
HTTP/1.1 101 UPGRADED + ///
Content-Type: application/vnd.docker.raw-stream + ///
Connection: Upgrade + ///
Upgrade: tcp + ///
+ ///
[STREAM] + ///
``` + ///
+ ///
### Stream format + ///
+ ///
When the TTY setting is disabled in [`POST /containers/create`](#operation/ContainerCreate), + ///
the HTTP Content-Type header is set to application/vnd.docker.multiplexed-stream + ///
and the stream over the hijacked connected is multiplexed to separate out + ///
`stdout` and `stderr`. The stream consists of a series of frames, each + ///
containing a header and a payload. + ///
+ ///
The header contains the information which the stream writes (`stdout` or + ///
`stderr`). It also contains the size of the associated frame encoded in + ///
the last four bytes (`uint32`). + ///
+ ///
It is encoded on the first eight bytes like this: + ///
+ ///
```go + ///
header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4} + ///
``` + ///
+ ///
`STREAM_TYPE` can be: + ///
+ ///
- 0: `stdin` (is written on `stdout`) + ///
- 1: `stdout` + ///
- 2: `stderr` + ///
+ ///
`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size + ///
encoded as big endian. + ///
+ ///
Following the header is the payload, which is the specified number of + ///
bytes of `STREAM_TYPE`. + ///
+ ///
The simplest way to implement this protocol is the following: + ///
+ ///
1. Read 8 bytes. + ///
2. Choose `stdout` or `stderr` depending on the first byte. + ///
3. Extract the frame size from the last four bytes. + ///
4. Read the extracted size and output it on the correct output. + ///
5. Goto 1. + ///
+ ///
### Stream format when using a TTY + ///
+ ///
When the TTY setting is enabled in [`POST /containers/create`](#operation/ContainerCreate), + ///
the stream is not multiplexed. The data exchanged over the hijacked + ///
connection is simply the raw data from the process PTY and client's + ///
`stdin`. + ///
+ /// ID or name of the container + /// Override the key sequence for detaching a container.Format is a single + ///
character `[a-Z]` or `ctrl-<value>` where `<value>` is one of: `a-z`, + ///
`@`, `^`, `[`, `,` or `_`. + /// Replay previous logs from the container. + ///
+ ///
This is useful for attaching to a container that has started and you + ///
want to output everything since the container started. + ///
+ ///
If `stream` is also enabled, once all the previous output has been + ///
returned, it will seamlessly transition into streaming current + ///
output. + /// Stream attached streams from the time the request was made onwards. + /// Attach to `stdin` + /// Attach to `stdout` + /// Attach to `stderr` + /// no error, no upgrade header found + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerAttachAsync(string id, string detachKeys, bool? logs, bool? stream, bool? stdin, bool? stdout, bool? stderr) + { + return ContainerAttachAsync(id, detachKeys, logs, stream, stdin, stdout, stderr, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Attach to a container + /// + /// + /// Attach to a container to read its output or send it input. You can attach + ///
to the same container multiple times and you can reattach to containers + ///
that have been detached. + ///
+ ///
Either the `stream` or `logs` parameter must be `true` for this endpoint + ///
to do anything. + ///
+ ///
See the [documentation for the `docker attach` command](https://docs.docker.com/engine/reference/commandline/attach/) + ///
for more details. + ///
+ ///
### Hijacking + ///
+ ///
This endpoint hijacks the HTTP connection to transport `stdin`, `stdout`, + ///
and `stderr` on the same socket. + ///
+ ///
This is the response from the daemon for an attach request: + ///
+ ///
``` + ///
HTTP/1.1 200 OK + ///
Content-Type: application/vnd.docker.raw-stream + ///
+ ///
[STREAM] + ///
``` + ///
+ ///
After the headers and two new lines, the TCP connection can now be used + ///
for raw, bidirectional communication between the client and server. + ///
+ ///
To hint potential proxies about connection hijacking, the Docker client + ///
can also optionally send connection upgrade headers. + ///
+ ///
For example, the client sends this request to upgrade the connection: + ///
+ ///
``` + ///
POST /containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1 + ///
Upgrade: tcp + ///
Connection: Upgrade + ///
``` + ///
+ ///
The Docker daemon will respond with a `101 UPGRADED` response, and will + ///
similarly follow with the raw stream: + ///
+ ///
``` + ///
HTTP/1.1 101 UPGRADED + ///
Content-Type: application/vnd.docker.raw-stream + ///
Connection: Upgrade + ///
Upgrade: tcp + ///
+ ///
[STREAM] + ///
``` + ///
+ ///
### Stream format + ///
+ ///
When the TTY setting is disabled in [`POST /containers/create`](#operation/ContainerCreate), + ///
the HTTP Content-Type header is set to application/vnd.docker.multiplexed-stream + ///
and the stream over the hijacked connected is multiplexed to separate out + ///
`stdout` and `stderr`. The stream consists of a series of frames, each + ///
containing a header and a payload. + ///
+ ///
The header contains the information which the stream writes (`stdout` or + ///
`stderr`). It also contains the size of the associated frame encoded in + ///
the last four bytes (`uint32`). + ///
+ ///
It is encoded on the first eight bytes like this: + ///
+ ///
```go + ///
header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4} + ///
``` + ///
+ ///
`STREAM_TYPE` can be: + ///
+ ///
- 0: `stdin` (is written on `stdout`) + ///
- 1: `stdout` + ///
- 2: `stderr` + ///
+ ///
`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size + ///
encoded as big endian. + ///
+ ///
Following the header is the payload, which is the specified number of + ///
bytes of `STREAM_TYPE`. + ///
+ ///
The simplest way to implement this protocol is the following: + ///
+ ///
1. Read 8 bytes. + ///
2. Choose `stdout` or `stderr` depending on the first byte. + ///
3. Extract the frame size from the last four bytes. + ///
4. Read the extracted size and output it on the correct output. + ///
5. Goto 1. + ///
+ ///
### Stream format when using a TTY + ///
+ ///
When the TTY setting is enabled in [`POST /containers/create`](#operation/ContainerCreate), + ///
the stream is not multiplexed. The data exchanged over the hijacked + ///
connection is simply the raw data from the process PTY and client's + ///
`stdin`. + ///
+ /// ID or name of the container + /// Override the key sequence for detaching a container.Format is a single + ///
character `[a-Z]` or `ctrl-<value>` where `<value>` is one of: `a-z`, + ///
`@`, `^`, `[`, `,` or `_`. + /// Replay previous logs from the container. + ///
+ ///
This is useful for attaching to a container that has started and you + ///
want to output everything since the container started. + ///
+ ///
If `stream` is also enabled, once all the previous output has been + ///
returned, it will seamlessly transition into streaming current + ///
output. + /// Stream attached streams from the time the request was made onwards. + /// Attach to `stdin` + /// Attach to `stdout` + /// Attach to `stderr` + /// no error, no upgrade header found + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerAttachAsync(string id, string detachKeys, bool? logs, bool? stream, bool? stdin, bool? stdout, bool? stderr, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/attach?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (detachKeys != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("detachKeys") + "=").Append(System.Uri.EscapeDataString(ConvertToString(detachKeys, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (logs != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("logs") + "=").Append(System.Uri.EscapeDataString(ConvertToString(logs, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stream != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stream") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stream, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stdin != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stdin") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stdin, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stdout != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stdout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stdout, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stderr != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stderr") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stderr, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/vnd.docker.raw-stream"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/vnd.docker.raw-stream")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 101) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("no error, hints proxy about hijacking", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 206) + { + return default(FileResponse); + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Attach to a container via a websocket + /// + /// ID or name of the container + /// Override the key sequence for detaching a container.Format is a single + ///
character `[a-Z]` or `ctrl-<value>` where `<value>` is one of: `a-z`, + ///
`@`, `^`, `[`, `,`, or `_`. + /// Return logs + /// Return stream + /// Attach to `stdin` + /// Attach to `stdout` + /// Attach to `stderr` + /// no error, no upgrade header found + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerAttachWebsocketAsync(string id, string detachKeys, bool? logs, bool? stream, bool? stdin, bool? stdout, bool? stderr) + { + return ContainerAttachWebsocketAsync(id, detachKeys, logs, stream, stdin, stdout, stderr, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Attach to a container via a websocket + /// + /// ID or name of the container + /// Override the key sequence for detaching a container.Format is a single + ///
character `[a-Z]` or `ctrl-<value>` where `<value>` is one of: `a-z`, + ///
`@`, `^`, `[`, `,`, or `_`. + /// Return logs + /// Return stream + /// Attach to `stdin` + /// Attach to `stdout` + /// Attach to `stderr` + /// no error, no upgrade header found + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerAttachWebsocketAsync(string id, string detachKeys, bool? logs, bool? stream, bool? stdin, bool? stdout, bool? stderr, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/attach/ws?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (detachKeys != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("detachKeys") + "=").Append(System.Uri.EscapeDataString(ConvertToString(detachKeys, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (logs != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("logs") + "=").Append(System.Uri.EscapeDataString(ConvertToString(logs, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stream != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stream") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stream, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stdin != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stdin") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stdin, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stdout != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stdout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stdout, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stderr != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stderr") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stderr, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 101) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("no error, hints proxy about hijacking", status_, responseText_, headers_, null); + } + else + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Wait for a container + /// + /// + /// Block until a container stops, then returns the exit code. + /// + /// ID or name of the container + /// Wait until a container state reaches the given condition. + ///
+ ///
Defaults to `not-running` if omitted or empty. + /// The container has exit. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerWaitAsync(string id, Condition? condition) + { + return ContainerWaitAsync(id, condition, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Wait for a container + /// + /// + /// Block until a container stops, then returns the exit code. + /// + /// ID or name of the container + /// Wait until a container state reaches the given condition. + ///
+ ///
Defaults to `not-running` if omitted or empty. + /// The container has exit. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerWaitAsync(string id, Condition? condition, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/wait?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (condition != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("condition") + "=").Append(System.Uri.EscapeDataString(ConvertToString(condition, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Remove a container + /// + /// ID or name of the container + /// Remove anonymous volumes associated with the container. + /// If the container is running, kill it before removing it. + /// Remove the specified link associated with the container. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerDeleteAsync(string id, bool? v, bool? force, bool? link) + { + return ContainerDeleteAsync(id, v, force, link, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Remove a container + /// + /// ID or name of the container + /// Remove anonymous volumes associated with the container. + /// If the container is running, kill it before removing it. + /// Remove the specified link associated with the container. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerDeleteAsync(string id, bool? v, bool? force, bool? link, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (v != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("v") + "=").Append(System.Uri.EscapeDataString(ConvertToString(v, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (force != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (link != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("link") + "=").Append(System.Uri.EscapeDataString(ConvertToString(link, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get information about files in a container + /// + /// + /// A response header `X-Docker-Container-Path-Stat` is returned, containing + ///
a base64 - encoded JSON object with some filesystem header information + ///
about the path. + ///
+ /// ID or name of the container + /// Resource in the container’s filesystem to archive. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerArchiveInfoAsync(string id, string path) + { + return ContainerArchiveInfoAsync(id, path, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get information about files in a container + /// + /// + /// A response header `X-Docker-Container-Path-Stat` is returned, containing + ///
a base64 - encoded JSON object with some filesystem header information + ///
about the path. + ///
+ /// ID or name of the container + /// Resource in the container’s filesystem to archive. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerArchiveInfoAsync(string id, string path, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (path == null) + throw new System.ArgumentNullException("path"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/archive?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("path") + "=").Append(System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("HEAD"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Container or path does not exist", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get an archive of a filesystem resource in a container + /// + /// + /// Get a tar archive of a resource in the filesystem of container id. + /// + /// ID or name of the container + /// Resource in the container’s filesystem to archive. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerArchiveAsync(string id, string path) + { + return ContainerArchiveAsync(id, path, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get an archive of a filesystem resource in a container + /// + /// + /// Get a tar archive of a resource in the filesystem of container id. + /// + /// ID or name of the container + /// Resource in the container’s filesystem to archive. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerArchiveAsync(string id, string path, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (path == null) + throw new System.ArgumentNullException("path"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/archive?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("path") + "=").Append(System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/x-tar")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + return default(FileResponse); + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Container or path does not exist", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Extract an archive of files or folders to a directory in a container + /// + /// + /// Upload a tar archive to be extracted to a path in the filesystem of container id. + ///
`path` parameter is asserted to be a directory. If it exists as a file, 400 error + ///
will be returned with message "not a directory". + ///
+ /// ID or name of the container + /// Path to a directory in the container to extract the archive’s contents into. + /// If `1`, `true`, or `True` then it will be an error if unpacking the + ///
given content would cause an existing directory to be replaced with + ///
a non-directory and vice versa. + /// If `1`, `true`, then it will copy UID/GID maps to the dest file or + ///
dir + /// The input stream must be a tar archive compressed with one of the + ///
following algorithms: `identity` (no compression), `gzip`, `bzip2`, + ///
or `xz`. + /// The content was extracted successfully + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PutContainerArchiveAsync(string id, string path, string noOverwriteDirNonDir, string copyUIDGID, FileParameter inputStream) + { + return PutContainerArchiveAsync(id, path, noOverwriteDirNonDir, copyUIDGID, inputStream, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Extract an archive of files or folders to a directory in a container + /// + /// + /// Upload a tar archive to be extracted to a path in the filesystem of container id. + ///
`path` parameter is asserted to be a directory. If it exists as a file, 400 error + ///
will be returned with message "not a directory". + ///
+ /// ID or name of the container + /// Path to a directory in the container to extract the archive’s contents into. + /// If `1`, `true`, or `True` then it will be an error if unpacking the + ///
given content would cause an existing directory to be replaced with + ///
a non-directory and vice versa. + /// If `1`, `true`, then it will copy UID/GID maps to the dest file or + ///
dir + /// The input stream must be a tar archive compressed with one of the + ///
following algorithms: `identity` (no compression), `gzip`, `bzip2`, + ///
or `xz`. + /// The content was extracted successfully + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PutContainerArchiveAsync(string id, string path, string noOverwriteDirNonDir, string copyUIDGID, FileParameter inputStream, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (path == null) + throw new System.ArgumentNullException("path"); + + if (inputStream == null) + throw new System.ArgumentNullException("inputStream"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/archive?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("path") + "=").Append(System.Uri.EscapeDataString(ConvertToString(path, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + if (noOverwriteDirNonDir != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("noOverwriteDirNonDir") + "=").Append(System.Uri.EscapeDataString(ConvertToString(noOverwriteDirNonDir, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (copyUIDGID != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("copyUIDGID") + "=").Append(System.Uri.EscapeDataString(ConvertToString(copyUIDGID, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StreamContent(inputStream.Data); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse(inputStream.ContentType); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Permission denied, the volume or container rootfs is marked as read-only.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such container or path does not exist inside the container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete stopped containers + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `until=<timestamp>` Prune containers created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune containers with (or without, in case `label!=...` is used) the specified labels. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerPruneAsync(string filters) + { + return ContainerPruneAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete stopped containers + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `until=<timestamp>` Prune containers created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune containers with (or without, in case `label!=...` is used) the specified labels. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerPruneAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/prune?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List Images + /// + /// + /// Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image. + /// + /// Show all images. Only images from a final layer (no children) are shown by default. + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the images list. + ///
+ ///
Available filters: + ///
+ ///
- `before`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) + ///
- `dangling=true` + ///
- `label=key` or `label="key=value"` of an image label + ///
- `reference`=(`<image-name>[:<tag>]`) + ///
- `since`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) + /// Compute and show shared size as a `SharedSize` field on each image. + /// Show digest information as a `RepoDigests` field on each image. + /// Summary image data for the images matching the query + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ImageListAsync(bool? all, string filters, bool? shared_size, bool? digests) + { + return ImageListAsync(all, filters, shared_size, digests, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List Images + /// + /// + /// Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image. + /// + /// Show all images. Only images from a final layer (no children) are shown by default. + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the images list. + ///
+ ///
Available filters: + ///
+ ///
- `before`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) + ///
- `dangling=true` + ///
- `label=key` or `label="key=value"` of an image label + ///
- `reference`=(`<image-name>[:<tag>]`) + ///
- `since`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) + /// Compute and show shared size as a `SharedSize` field on each image. + /// Show digest information as a `RepoDigests` field on each image. + /// Summary image data for the images matching the query + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ImageListAsync(bool? all, string filters, bool? shared_size, bool? digests, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/json?"); + if (all != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("all") + "=").Append(System.Uri.EscapeDataString(ConvertToString(all, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (shared_size != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("shared-size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(shared_size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (digests != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("digests") + "=").Append(System.Uri.EscapeDataString(ConvertToString(digests, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Build an image + /// + /// + /// Build an image from a tar archive with a `Dockerfile` in it. + ///
+ ///
The `Dockerfile` specifies how the image is built from the tar archive. It is typically in the archive's root, but can be at a different path or have a different name by specifying the `dockerfile` parameter. [See the `Dockerfile` reference for more information](https://docs.docker.com/engine/reference/builder/). + ///
+ ///
The Docker daemon performs a preliminary validation of the `Dockerfile` before starting the build, and returns an error if the syntax is incorrect. After that, each instruction is run one-by-one until the ID of the new image is output. + ///
+ ///
The build is canceled if the client drops the connection by quitting or being killed. + ///
+ /// A tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz. + /// Path within the build context to the `Dockerfile`. This is ignored if `remote` is specified and points to an external `Dockerfile`. + /// A name and optional tag to apply to the image in the `name:tag` format. If you omit the tag the default `latest` value is assumed. You can provide several `t` parameters. + /// Extra hosts to add to /etc/hosts + /// A Git repository URI or HTTP/HTTPS context URI. If the URI points to a single text file, the file’s contents are placed into a file called `Dockerfile` and the image is built from that file. If the URI points to a tarball, the file is downloaded by the daemon and the contents therein used as the context for the build. If the URI points to a tarball and the `dockerfile` parameter is also specified, there must be a file with the corresponding path inside the tarball. + /// Suppress verbose build output. + /// Do not use the cache when building the image. + /// JSON array of images used for build cache resolution. + /// Attempt to pull the image even if an older image exists locally. + /// Remove intermediate containers after a successful build. + /// Always remove intermediate containers, even upon failure. + /// Set memory limit for build. + /// Total memory (memory + swap). Set as `-1` to disable swap. + /// CPU shares (relative weight). + /// CPUs in which to allow execution (e.g., `0-3`, `0,1`). + /// The length of a CPU period in microseconds. + /// Microseconds of CPU time that the container can get in a CPU period. + /// JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. + ///
+ ///
For example, the build arg `FOO=bar` would become `{"FOO":"bar"}` in JSON. This would result in the query parameter `buildargs={"FOO":"bar"}`. Note that `{"FOO":"bar"}` should be URI component encoded. + ///
+ ///
[Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg) + /// Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB. + /// Squash the resulting images layers into a single layer. *(Experimental release only.)* + /// Arbitrary key/value labels to set on the image, as a JSON map of string pairs. + /// Sets the networking mode for the run commands during build. Supported + ///
standard values are: `bridge`, `host`, `none`, and `container:<name|id>`. + ///
Any other value is taken as a custom network's name or ID to which this + ///
container should connect to. + /// This is a base64-encoded JSON object with auth configurations for multiple registries that a build may refer to. + ///
+ ///
The key is a registry URL, and the value is an auth configuration object, [as described in the authentication section](#section/Authentication). For example: + ///
+ ///
``` + ///
{ + ///
"docker.example.com": { + ///
"username": "janedoe", + ///
"password": "hunter2" + ///
}, + ///
"https://index.docker.io/v1/": { + ///
"username": "mobydock", + ///
"password": "conta1n3rize14" + ///
} + ///
} + ///
``` + ///
+ ///
Only the registry domain name (and port if not the default 443) are required. However, for legacy reasons, the Docker Hub registry must be specified with both a `https://` prefix and a `/v1/` suffix even though Docker will prefer to use the v2 registry API. + /// Platform in the format os[/arch[/variant]] + /// Target build stage + /// BuildKit output configuration + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageBuildAsync(System.IO.Stream inputStream, string dockerfile, string t, string extrahosts, string remote, bool? q, bool? nocache, string cachefrom, string pull, bool? rm, bool? forcerm, int? memory, int? memswap, int? cpushares, string cpusetcpus, int? cpuperiod, int? cpuquota, string buildargs, int? shmsize, bool? squash, string labels, string networkmode, ContentType? content_type, string x_Registry_Config, string platform, string target, string outputs) + { + return ImageBuildAsync(inputStream, dockerfile, t, extrahosts, remote, q, nocache, cachefrom, pull, rm, forcerm, memory, memswap, cpushares, cpusetcpus, cpuperiod, cpuquota, buildargs, shmsize, squash, labels, networkmode, content_type, x_Registry_Config, platform, target, outputs, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Build an image + /// + /// + /// Build an image from a tar archive with a `Dockerfile` in it. + ///
+ ///
The `Dockerfile` specifies how the image is built from the tar archive. It is typically in the archive's root, but can be at a different path or have a different name by specifying the `dockerfile` parameter. [See the `Dockerfile` reference for more information](https://docs.docker.com/engine/reference/builder/). + ///
+ ///
The Docker daemon performs a preliminary validation of the `Dockerfile` before starting the build, and returns an error if the syntax is incorrect. After that, each instruction is run one-by-one until the ID of the new image is output. + ///
+ ///
The build is canceled if the client drops the connection by quitting or being killed. + ///
+ /// A tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz. + /// Path within the build context to the `Dockerfile`. This is ignored if `remote` is specified and points to an external `Dockerfile`. + /// A name and optional tag to apply to the image in the `name:tag` format. If you omit the tag the default `latest` value is assumed. You can provide several `t` parameters. + /// Extra hosts to add to /etc/hosts + /// A Git repository URI or HTTP/HTTPS context URI. If the URI points to a single text file, the file’s contents are placed into a file called `Dockerfile` and the image is built from that file. If the URI points to a tarball, the file is downloaded by the daemon and the contents therein used as the context for the build. If the URI points to a tarball and the `dockerfile` parameter is also specified, there must be a file with the corresponding path inside the tarball. + /// Suppress verbose build output. + /// Do not use the cache when building the image. + /// JSON array of images used for build cache resolution. + /// Attempt to pull the image even if an older image exists locally. + /// Remove intermediate containers after a successful build. + /// Always remove intermediate containers, even upon failure. + /// Set memory limit for build. + /// Total memory (memory + swap). Set as `-1` to disable swap. + /// CPU shares (relative weight). + /// CPUs in which to allow execution (e.g., `0-3`, `0,1`). + /// The length of a CPU period in microseconds. + /// Microseconds of CPU time that the container can get in a CPU period. + /// JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values. + ///
+ ///
For example, the build arg `FOO=bar` would become `{"FOO":"bar"}` in JSON. This would result in the query parameter `buildargs={"FOO":"bar"}`. Note that `{"FOO":"bar"}` should be URI component encoded. + ///
+ ///
[Read more about the buildargs instruction.](https://docs.docker.com/engine/reference/builder/#arg) + /// Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB. + /// Squash the resulting images layers into a single layer. *(Experimental release only.)* + /// Arbitrary key/value labels to set on the image, as a JSON map of string pairs. + /// Sets the networking mode for the run commands during build. Supported + ///
standard values are: `bridge`, `host`, `none`, and `container:<name|id>`. + ///
Any other value is taken as a custom network's name or ID to which this + ///
container should connect to. + /// This is a base64-encoded JSON object with auth configurations for multiple registries that a build may refer to. + ///
+ ///
The key is a registry URL, and the value is an auth configuration object, [as described in the authentication section](#section/Authentication). For example: + ///
+ ///
``` + ///
{ + ///
"docker.example.com": { + ///
"username": "janedoe", + ///
"password": "hunter2" + ///
}, + ///
"https://index.docker.io/v1/": { + ///
"username": "mobydock", + ///
"password": "conta1n3rize14" + ///
} + ///
} + ///
``` + ///
+ ///
Only the registry domain name (and port if not the default 443) are required. However, for legacy reasons, the Docker Hub registry must be specified with both a `https://` prefix and a `/v1/` suffix even though Docker will prefer to use the v2 registry API. + /// Platform in the format os[/arch[/variant]] + /// Target build stage + /// BuildKit output configuration + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageBuildAsync(System.IO.Stream inputStream, string dockerfile, string t, string extrahosts, string remote, bool? q, bool? nocache, string cachefrom, string pull, bool? rm, bool? forcerm, int? memory, int? memswap, int? cpushares, string cpusetcpus, int? cpuperiod, int? cpuquota, string buildargs, int? shmsize, bool? squash, string labels, string networkmode, ContentType? content_type, string x_Registry_Config, string platform, string target, string outputs, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/build?"); + if (dockerfile != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("dockerfile") + "=").Append(System.Uri.EscapeDataString(ConvertToString(dockerfile, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (t != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("t") + "=").Append(System.Uri.EscapeDataString(ConvertToString(t, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (extrahosts != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("extrahosts") + "=").Append(System.Uri.EscapeDataString(ConvertToString(extrahosts, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (remote != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("remote") + "=").Append(System.Uri.EscapeDataString(ConvertToString(remote, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (q != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("q") + "=").Append(System.Uri.EscapeDataString(ConvertToString(q, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (nocache != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("nocache") + "=").Append(System.Uri.EscapeDataString(ConvertToString(nocache, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (cachefrom != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("cachefrom") + "=").Append(System.Uri.EscapeDataString(ConvertToString(cachefrom, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (pull != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pull") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pull, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (rm != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("rm") + "=").Append(System.Uri.EscapeDataString(ConvertToString(rm, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (forcerm != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("forcerm") + "=").Append(System.Uri.EscapeDataString(ConvertToString(forcerm, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (memory != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("memory") + "=").Append(System.Uri.EscapeDataString(ConvertToString(memory, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (memswap != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("memswap") + "=").Append(System.Uri.EscapeDataString(ConvertToString(memswap, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (cpushares != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("cpushares") + "=").Append(System.Uri.EscapeDataString(ConvertToString(cpushares, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (cpusetcpus != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("cpusetcpus") + "=").Append(System.Uri.EscapeDataString(ConvertToString(cpusetcpus, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (cpuperiod != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("cpuperiod") + "=").Append(System.Uri.EscapeDataString(ConvertToString(cpuperiod, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (cpuquota != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("cpuquota") + "=").Append(System.Uri.EscapeDataString(ConvertToString(cpuquota, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (buildargs != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("buildargs") + "=").Append(System.Uri.EscapeDataString(ConvertToString(buildargs, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (shmsize != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("shmsize") + "=").Append(System.Uri.EscapeDataString(ConvertToString(shmsize, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (squash != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("squash") + "=").Append(System.Uri.EscapeDataString(ConvertToString(squash, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (labels != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("labels") + "=").Append(System.Uri.EscapeDataString(ConvertToString(labels, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (networkmode != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("networkmode") + "=").Append(System.Uri.EscapeDataString(ConvertToString(networkmode, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (platform != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("platform") + "=").Append(System.Uri.EscapeDataString(ConvertToString(platform, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (target != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("target") + "=").Append(System.Uri.EscapeDataString(ConvertToString(target, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (outputs != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("outputs") + "=").Append(System.Uri.EscapeDataString(ConvertToString(outputs, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (content_type != null) + request_.Headers.TryAddWithoutValidation("Content-type", ConvertToString(content_type, System.Globalization.CultureInfo.InvariantCulture)); + + if (x_Registry_Config != null) + request_.Headers.TryAddWithoutValidation("X-Registry-Config", ConvertToString(x_Registry_Config, System.Globalization.CultureInfo.InvariantCulture)); + var content_ = new System.Net.Http.StreamContent(inputStream); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/octet-stream"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete builder cache + /// + /// Amount of disk space in bytes to keep for cache + /// Remove all types of build cache + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the list of build cache objects. + ///
+ ///
Available filters: + ///
+ ///
- `until=<timestamp>` remove cache older than `<timestamp>`. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon's local time. + ///
- `id=<id>` + ///
- `parent=<id>` + ///
- `type=<string>` + ///
- `description=<string>` + ///
- `inuse` + ///
- `shared` + ///
- `private` + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task BuildPruneAsync(long? keep_storage, bool? all, string filters) + { + return BuildPruneAsync(keep_storage, all, filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete builder cache + /// + /// Amount of disk space in bytes to keep for cache + /// Remove all types of build cache + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the list of build cache objects. + ///
+ ///
Available filters: + ///
+ ///
- `until=<timestamp>` remove cache older than `<timestamp>`. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon's local time. + ///
- `id=<id>` + ///
- `parent=<id>` + ///
- `type=<string>` + ///
- `description=<string>` + ///
- `inuse` + ///
- `shared` + ///
- `private` + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task BuildPruneAsync(long? keep_storage, bool? all, string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/build/prune?"); + if (keep_storage != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("keep-storage") + "=").Append(System.Uri.EscapeDataString(ConvertToString(keep_storage, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (all != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("all") + "=").Append(System.Uri.EscapeDataString(ConvertToString(all, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create an image + /// + /// + /// Create an image by either pulling it from a registry or importing it. + /// + /// Name of the image to pull. The name may include a tag or digest. This parameter may only be used when pulling an image. The pull is cancelled if the HTTP connection is closed. + /// Source to import. The value may be a URL from which the image can be retrieved or `-` to read the image from the request body. This parameter may only be used when importing an image. + /// Repository name given to an image when it is imported. The repo may include a tag. This parameter may only be used when importing an image. + /// Tag or digest. If empty when pulling an image, this causes all tags for the given image to be pulled. + /// Set commit message for imported image. + /// Image content if the value `-` has been specified in fromSrc query parameter + /// A base64url-encoded auth configuration. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// Apply `Dockerfile` instructions to the image that is created, + ///
for example: `changes=ENV DEBUG=true`. + ///
Note that `ENV DEBUG=true` should be URI component encoded. + ///
+ ///
Supported `Dockerfile` instructions: + ///
`CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` + /// Platform in the format os[/arch[/variant]]. + ///
+ ///
When used in combination with the `fromImage` option, the daemon checks + ///
if the given image is present in the local image cache with the given + ///
OS and Architecture, and otherwise attempts to pull the image. If the + ///
option is not set, the host's native OS and Architecture are used. + ///
If the given image does not exist in the local image cache, the daemon + ///
attempts to pull the image with the host's native OS and Architecture. + ///
If the given image does exists in the local image cache, but its OS or + ///
architecture does not match, a warning is produced. + ///
+ ///
When used with the `fromSrc` option to import an image from an archive, + ///
this option sets the platform information for the imported image. If + ///
the option is not set, the host's native OS and Architecture are used + ///
for the imported image. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageCreateAsync(string fromImage, string fromSrc, string repo, string tag, string message, string inputImage, string x_Registry_Auth, System.Collections.Generic.IEnumerable changes, string platform) + { + return ImageCreateAsync(fromImage, fromSrc, repo, tag, message, inputImage, x_Registry_Auth, changes, platform, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create an image + /// + /// + /// Create an image by either pulling it from a registry or importing it. + /// + /// Name of the image to pull. The name may include a tag or digest. This parameter may only be used when pulling an image. The pull is cancelled if the HTTP connection is closed. + /// Source to import. The value may be a URL from which the image can be retrieved or `-` to read the image from the request body. This parameter may only be used when importing an image. + /// Repository name given to an image when it is imported. The repo may include a tag. This parameter may only be used when importing an image. + /// Tag or digest. If empty when pulling an image, this causes all tags for the given image to be pulled. + /// Set commit message for imported image. + /// Image content if the value `-` has been specified in fromSrc query parameter + /// A base64url-encoded auth configuration. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// Apply `Dockerfile` instructions to the image that is created, + ///
for example: `changes=ENV DEBUG=true`. + ///
Note that `ENV DEBUG=true` should be URI component encoded. + ///
+ ///
Supported `Dockerfile` instructions: + ///
`CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` + /// Platform in the format os[/arch[/variant]]. + ///
+ ///
When used in combination with the `fromImage` option, the daemon checks + ///
if the given image is present in the local image cache with the given + ///
OS and Architecture, and otherwise attempts to pull the image. If the + ///
option is not set, the host's native OS and Architecture are used. + ///
If the given image does not exist in the local image cache, the daemon + ///
attempts to pull the image with the host's native OS and Architecture. + ///
If the given image does exists in the local image cache, but its OS or + ///
architecture does not match, a warning is produced. + ///
+ ///
When used with the `fromSrc` option to import an image from an archive, + ///
this option sets the platform information for the imported image. If + ///
the option is not set, the host's native OS and Architecture are used + ///
for the imported image. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageCreateAsync(string fromImage, string fromSrc, string repo, string tag, string message, string inputImage, string x_Registry_Auth, System.Collections.Generic.IEnumerable changes, string platform, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/create?"); + if (fromImage != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("fromImage") + "=").Append(System.Uri.EscapeDataString(ConvertToString(fromImage, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (fromSrc != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("fromSrc") + "=").Append(System.Uri.EscapeDataString(ConvertToString(fromSrc, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (repo != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("repo") + "=").Append(System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (tag != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tag") + "=").Append(System.Uri.EscapeDataString(ConvertToString(tag, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (message != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("message") + "=").Append(System.Uri.EscapeDataString(ConvertToString(message, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (changes != null) + { + foreach (var item_ in changes) { urlBuilder_.Append(System.Uri.EscapeDataString("changes") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + } + if (platform != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("platform") + "=").Append(System.Uri.EscapeDataString(ConvertToString(platform, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (x_Registry_Auth != null) + request_.Headers.TryAddWithoutValidation("X-Registry-Auth", ConvertToString(x_Registry_Auth, System.Globalization.CultureInfo.InvariantCulture)); + var content_ = new System.Net.Http.StringContent(inputImage); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("text/plain"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("repository does not exist or no read access", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect an image + /// + /// + /// Return low-level information about an image. + /// + /// Image name or id + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageInspectAsync(string name) + { + return ImageInspectAsync(name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect an image + /// + /// + /// Return low-level information about an image. + /// + /// Image name or id + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageInspectAsync(string name, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/{name}/json"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such image", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get the history of an image + /// + /// + /// Return parent layers of an image. + /// + /// Image name or ID + /// List of image layers + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ImageHistoryAsync(string name) + { + return ImageHistoryAsync(name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the history of an image + /// + /// + /// Return parent layers of an image. + /// + /// Image name or ID + /// List of image layers + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ImageHistoryAsync(string name, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/{name}/history"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such image", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Push an image + /// + /// + /// Push an image to a registry. + ///
+ ///
If you wish to push an image on to a private registry, that image must + ///
already have a tag which references the registry. For example, + ///
`registry.example.com/myimage:latest`. + ///
+ ///
The push is cancelled if the HTTP connection is closed. + ///
+ /// Image name or ID. + /// The tag to associate with the image on the registry. + /// A base64url-encoded auth configuration. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImagePushAsync(string name, string tag, string x_Registry_Auth) + { + return ImagePushAsync(name, tag, x_Registry_Auth, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Push an image + /// + /// + /// Push an image to a registry. + ///
+ ///
If you wish to push an image on to a private registry, that image must + ///
already have a tag which references the registry. For example, + ///
`registry.example.com/myimage:latest`. + ///
+ ///
The push is cancelled if the HTTP connection is closed. + ///
+ /// Image name or ID. + /// The tag to associate with the image on the registry. + /// A base64url-encoded auth configuration. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImagePushAsync(string name, string tag, string x_Registry_Auth, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/{name}/push?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (tag != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tag") + "=").Append(System.Uri.EscapeDataString(ConvertToString(tag, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (x_Registry_Auth == null) + throw new System.ArgumentNullException("x_Registry_Auth"); + request_.Headers.TryAddWithoutValidation("X-Registry-Auth", ConvertToString(x_Registry_Auth, System.Globalization.CultureInfo.InvariantCulture)); + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such image", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Tag an image + /// + /// + /// Tag an image so that it becomes part of a repository. + /// + /// Image name or ID to tag. + /// The repository to tag in. For example, `someuser/someimage`. + /// The name of the new tag. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageTagAsync(string name, string repo, string tag) + { + return ImageTagAsync(name, repo, tag, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Tag an image + /// + /// + /// Tag an image so that it becomes part of a repository. + /// + /// Image name or ID to tag. + /// The repository to tag in. For example, `someuser/someimage`. + /// The name of the new tag. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageTagAsync(string name, string repo, string tag, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/{name}/tag?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (repo != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("repo") + "=").Append(System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (tag != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tag") + "=").Append(System.Uri.EscapeDataString(ConvertToString(tag, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such image", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Remove an image + /// + /// + /// Remove an image, along with any untagged parent images that were + ///
referenced by that image. + ///
+ ///
Images can't be removed if they have descendant images, are being + ///
used by a running container or are being used by a build. + ///
+ /// Image name or ID + /// Remove the image even if it is being used by stopped containers or has other tags + /// Do not delete untagged parent images + /// The image was deleted successfully + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ImageDeleteAsync(string name, bool? force, bool? noprune) + { + return ImageDeleteAsync(name, force, noprune, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Remove an image + /// + /// + /// Remove an image, along with any untagged parent images that were + ///
referenced by that image. + ///
+ ///
Images can't be removed if they have descendant images, are being + ///
used by a running container or are being used by a build. + ///
+ /// Image name or ID + /// Remove the image even if it is being used by stopped containers or has other tags + /// Do not delete untagged parent images + /// The image was deleted successfully + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ImageDeleteAsync(string name, bool? force, bool? noprune, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/{name}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (force != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (noprune != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("noprune") + "=").Append(System.Uri.EscapeDataString(ConvertToString(noprune, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such image", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Conflict", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Search images + /// + /// + /// Search for an image on Docker Hub. + /// + /// Term to search + /// Maximum number of results to return + /// A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: + ///
+ ///
- `is-automated=(true|false)` + ///
- `is-official=(true|false)` + ///
- `stars=<number>` Matches images that has at least 'number' stars. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ImageSearchAsync(string term, int? limit, string filters) + { + return ImageSearchAsync(term, limit, filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Search images + /// + /// + /// Search for an image on Docker Hub. + /// + /// Term to search + /// Maximum number of results to return + /// A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: + ///
+ ///
- `is-automated=(true|false)` + ///
- `is-official=(true|false)` + ///
- `stars=<number>` Matches images that has at least 'number' stars. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ImageSearchAsync(string term, int? limit, string filters, System.Threading.CancellationToken cancellationToken) + { + if (term == null) + throw new System.ArgumentNullException("term"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/search?"); + urlBuilder_.Append(System.Uri.EscapeDataString("term") + "=").Append(System.Uri.EscapeDataString(ConvertToString(term, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + if (limit != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("limit") + "=").Append(System.Uri.EscapeDataString(ConvertToString(limit, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete unused images + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters: + ///
+ ///
- `dangling=<boolean>` When set to `true` (or `1`), prune only + ///
unused *and* untagged images. When set to `false` + ///
(or `0`), all unused images are pruned. + ///
- `until=<string>` Prune images created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune images with (or without, in case `label!=...` is used) the specified labels. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImagePruneAsync(string filters) + { + return ImagePruneAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete unused images + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters: + ///
+ ///
- `dangling=<boolean>` When set to `true` (or `1`), prune only + ///
unused *and* untagged images. When set to `false` + ///
(or `0`), all unused images are pruned. + ///
- `until=<string>` Prune images created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune images with (or without, in case `label!=...` is used) the specified labels. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImagePruneAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/prune?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Check auth configuration + /// + /// + /// Validate credentials for a registry and, if available, get an identity + ///
token for accessing the registry without password. + ///
+ /// Authentication to check + /// An identity token was generated successfully. + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SystemAuthAsync(AuthConfig authConfig) + { + return SystemAuthAsync(authConfig, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Check auth configuration + /// + /// + /// Validate credentials for a registry and, if available, get an identity + ///
token for accessing the registry without password. + ///
+ /// Authentication to check + /// An identity token was generated successfully. + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SystemAuthAsync(AuthConfig authConfig, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/auth"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(authConfig, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 204) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("No error", status_, responseText_, headers_, null); + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Auth error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get system information + /// + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SystemInfoAsync() + { + return SystemInfoAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get system information + /// + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SystemInfoAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/info"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get version + /// + /// + /// Returns the version of Docker that is running and various information about the system that Docker is running on. + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SystemVersionAsync() + { + return SystemVersionAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get version + /// + /// + /// Returns the version of Docker that is running and various information about the system that Docker is running on. + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SystemVersionAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/version"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Ping + /// + /// + /// This is a dummy endpoint you can use to test if the server is accessible. + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SystemPingAsync() + { + return SystemPingAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Ping + /// + /// + /// This is a dummy endpoint you can use to test if the server is accessible. + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SystemPingAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/_ping"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Ping + /// + /// + /// This is a dummy endpoint you can use to test if the server is accessible. + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SystemPingHeadAsync() + { + return SystemPingHeadAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Ping + /// + /// + /// This is a dummy endpoint you can use to test if the server is accessible. + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SystemPingHeadAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/_ping"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("HEAD"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a new image from a container + /// + /// The container configuration + /// The ID or name of the container to commit + /// Repository name for the created image + /// Tag name for the create image + /// Commit message + /// Author of the image (e.g., `John Hannibal Smith <hannibal@a-team.com>`) + /// Whether to pause the container before committing + /// `Dockerfile` instructions to apply while committing + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageCommitAsync(ContainerConfig containerConfig, string container, string repo, string tag, string comment, string author, bool? pause, string changes) + { + return ImageCommitAsync(containerConfig, container, repo, tag, comment, author, pause, changes, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a new image from a container + /// + /// The container configuration + /// The ID or name of the container to commit + /// Repository name for the created image + /// Tag name for the create image + /// Commit message + /// Author of the image (e.g., `John Hannibal Smith <hannibal@a-team.com>`) + /// Whether to pause the container before committing + /// `Dockerfile` instructions to apply while committing + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageCommitAsync(ContainerConfig containerConfig, string container, string repo, string tag, string comment, string author, bool? pause, string changes, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/commit?"); + if (container != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("container") + "=").Append(System.Uri.EscapeDataString(ConvertToString(container, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (repo != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("repo") + "=").Append(System.Uri.EscapeDataString(ConvertToString(repo, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (tag != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tag") + "=").Append(System.Uri.EscapeDataString(ConvertToString(tag, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (comment != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("comment") + "=").Append(System.Uri.EscapeDataString(ConvertToString(comment, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (author != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("author") + "=").Append(System.Uri.EscapeDataString(ConvertToString(author, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (pause != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("pause") + "=").Append(System.Uri.EscapeDataString(ConvertToString(pause, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (changes != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("changes") + "=").Append(System.Uri.EscapeDataString(ConvertToString(changes, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(containerConfig, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Monitor events + /// + /// + /// Stream real-time events from the server. + ///
+ ///
Various objects within Docker report events when something happens to them. + ///
+ ///
Containers report these events: `attach`, `commit`, `copy`, `create`, `destroy`, `detach`, `die`, `exec_create`, `exec_detach`, `exec_start`, `exec_die`, `export`, `health_status`, `kill`, `oom`, `pause`, `rename`, `resize`, `restart`, `start`, `stop`, `top`, `unpause`, `update`, and `prune` + ///
+ ///
Images report these events: `delete`, `import`, `load`, `pull`, `push`, `save`, `tag`, `untag`, and `prune` + ///
+ ///
Volumes report these events: `create`, `mount`, `unmount`, `destroy`, and `prune` + ///
+ ///
Networks report these events: `create`, `connect`, `disconnect`, `destroy`, `update`, `remove`, and `prune` + ///
+ ///
The Docker daemon reports these events: `reload` + ///
+ ///
Services report these events: `create`, `update`, and `remove` + ///
+ ///
Nodes report these events: `create`, `update`, and `remove` + ///
+ ///
Secrets report these events: `create`, `update`, and `remove` + ///
+ ///
Configs report these events: `create`, `update`, and `remove` + ///
+ ///
The Builder reports `prune` events + ///
+ /// Show events created since this timestamp then stream new events. + /// Show events created until this timestamp then stop streaming. + /// A JSON encoded value of filters (a `map[string][]string`) to process on the event list. Available filters: + ///
+ ///
- `config=<string>` config name or ID + ///
- `container=<string>` container name or ID + ///
- `daemon=<string>` daemon name or ID + ///
- `event=<string>` event type + ///
- `image=<string>` image name or ID + ///
- `label=<string>` image or container label + ///
- `network=<string>` network name or ID + ///
- `node=<string>` node ID + ///
- `plugin`=<string> plugin name or ID + ///
- `scope`=<string> local or swarm + ///
- `secret=<string>` secret name or ID + ///
- `service=<string>` service name or ID + ///
- `type=<string>` object to filter by, one of `container`, `image`, `volume`, `network`, `daemon`, `plugin`, `node`, `service`, `secret` or `config` + ///
- `volume=<string>` volume name + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SystemEventsAsync(string since, string until, string filters) + { + return SystemEventsAsync(since, until, filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Monitor events + /// + /// + /// Stream real-time events from the server. + ///
+ ///
Various objects within Docker report events when something happens to them. + ///
+ ///
Containers report these events: `attach`, `commit`, `copy`, `create`, `destroy`, `detach`, `die`, `exec_create`, `exec_detach`, `exec_start`, `exec_die`, `export`, `health_status`, `kill`, `oom`, `pause`, `rename`, `resize`, `restart`, `start`, `stop`, `top`, `unpause`, `update`, and `prune` + ///
+ ///
Images report these events: `delete`, `import`, `load`, `pull`, `push`, `save`, `tag`, `untag`, and `prune` + ///
+ ///
Volumes report these events: `create`, `mount`, `unmount`, `destroy`, and `prune` + ///
+ ///
Networks report these events: `create`, `connect`, `disconnect`, `destroy`, `update`, `remove`, and `prune` + ///
+ ///
The Docker daemon reports these events: `reload` + ///
+ ///
Services report these events: `create`, `update`, and `remove` + ///
+ ///
Nodes report these events: `create`, `update`, and `remove` + ///
+ ///
Secrets report these events: `create`, `update`, and `remove` + ///
+ ///
Configs report these events: `create`, `update`, and `remove` + ///
+ ///
The Builder reports `prune` events + ///
+ /// Show events created since this timestamp then stream new events. + /// Show events created until this timestamp then stop streaming. + /// A JSON encoded value of filters (a `map[string][]string`) to process on the event list. Available filters: + ///
+ ///
- `config=<string>` config name or ID + ///
- `container=<string>` container name or ID + ///
- `daemon=<string>` daemon name or ID + ///
- `event=<string>` event type + ///
- `image=<string>` image name or ID + ///
- `label=<string>` image or container label + ///
- `network=<string>` network name or ID + ///
- `node=<string>` node ID + ///
- `plugin`=<string> plugin name or ID + ///
- `scope`=<string> local or swarm + ///
- `secret=<string>` secret name or ID + ///
- `service=<string>` service name or ID + ///
- `type=<string>` object to filter by, one of `container`, `image`, `volume`, `network`, `daemon`, `plugin`, `node`, `service`, `secret` or `config` + ///
- `volume=<string>` volume name + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SystemEventsAsync(string since, string until, string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/events?"); + if (since != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("since") + "=").Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (until != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("until") + "=").Append(System.Uri.EscapeDataString(ConvertToString(until, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get data usage information + /// + /// Object types, for which to compute and return data. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SystemDataUsageAsync(System.Collections.Generic.IEnumerable type) + { + return SystemDataUsageAsync(type, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get data usage information + /// + /// Object types, for which to compute and return data. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SystemDataUsageAsync(System.Collections.Generic.IEnumerable type, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/system/df?"); + if (type != null) + { + foreach (var item_ in type) { urlBuilder_.Append(System.Uri.EscapeDataString("type") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Export an image + /// + /// + /// Get a tarball containing all images and metadata for a repository. + ///
+ ///
If `name` is a specific name and tag (e.g. `ubuntu:latest`), then only that image (and its parents) are returned. If `name` is an image ID, similarly only that image (and its parents) are returned, but with the exclusion of the `repositories` file in the tarball, as there were no image names referenced. + ///
+ ///
### Image tarball format + ///
+ ///
An image tarball contains one directory per image layer (named using its long ID), each containing these files: + ///
+ ///
- `VERSION`: currently `1.0` - the file format version + ///
- `json`: detailed layer information, similar to `docker inspect layer_id` + ///
- `layer.tar`: A tarfile containing the filesystem changes in this layer + ///
+ ///
The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions. + ///
+ ///
If the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs. + ///
+ ///
```json + ///
{ + ///
"hello-world": { + ///
"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1" + ///
} + ///
} + ///
``` + ///
+ /// Image name or ID + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageGetAsync(string name) + { + return ImageGetAsync(name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Export an image + /// + /// + /// Get a tarball containing all images and metadata for a repository. + ///
+ ///
If `name` is a specific name and tag (e.g. `ubuntu:latest`), then only that image (and its parents) are returned. If `name` is an image ID, similarly only that image (and its parents) are returned, but with the exclusion of the `repositories` file in the tarball, as there were no image names referenced. + ///
+ ///
### Image tarball format + ///
+ ///
An image tarball contains one directory per image layer (named using its long ID), each containing these files: + ///
+ ///
- `VERSION`: currently `1.0` - the file format version + ///
- `json`: detailed layer information, similar to `docker inspect layer_id` + ///
- `layer.tar`: A tarfile containing the filesystem changes in this layer + ///
+ ///
The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories for storing attribute changes and deletions. + ///
+ ///
If the tarball defines a repository, the tarball should also include a `repositories` file at the root that contains a list of repository and tag names mapped to layer IDs. + ///
+ ///
```json + ///
{ + ///
"hello-world": { + ///
"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1" + ///
} + ///
} + ///
``` + ///
+ /// Image name or ID + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageGetAsync(string name, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/{name}/get"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/x-tar")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); + disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse + return fileResponse_; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Export several images + /// + /// + /// Get a tarball containing all images and metadata for several image + ///
repositories. + ///
+ ///
For each value of the `names` parameter: if it is a specific name and + ///
tag (e.g. `ubuntu:latest`), then only that image (and its parents) are + ///
returned; if it is an image ID, similarly only that image (and its parents) + ///
are returned and there would be no names referenced in the 'repositories' + ///
file for this image ID. + ///
+ ///
For details on the format, see the [export image endpoint](#operation/ImageGet). + ///
+ /// Image names to filter by + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageGetAllAsync(System.Collections.Generic.IEnumerable names) + { + return ImageGetAllAsync(names, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Export several images + /// + /// + /// Get a tarball containing all images and metadata for several image + ///
repositories. + ///
+ ///
For each value of the `names` parameter: if it is a specific name and + ///
tag (e.g. `ubuntu:latest`), then only that image (and its parents) are + ///
returned; if it is an image ID, similarly only that image (and its parents) + ///
are returned and there would be no names referenced in the 'repositories' + ///
file for this image ID. + ///
+ ///
For details on the format, see the [export image endpoint](#operation/ImageGet). + ///
+ /// Image names to filter by + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageGetAllAsync(System.Collections.Generic.IEnumerable names, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/get?"); + if (names != null) + { + foreach (var item_ in names) { urlBuilder_.Append(System.Uri.EscapeDataString("names") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/x-tar")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); + disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse + return fileResponse_; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Import images + /// + /// + /// Load a set of images and tags into a repository. + ///
+ ///
For details on the format, see the [export image endpoint](#operation/ImageGet). + ///
+ /// Tar archive containing images + /// Suppress progress details during load. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ImageLoadAsync(System.IO.Stream imagesTarball, bool? quiet) + { + return ImageLoadAsync(imagesTarball, quiet, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Import images + /// + /// + /// Load a set of images and tags into a repository. + ///
+ ///
For details on the format, see the [export image endpoint](#operation/ImageGet). + ///
+ /// Tar archive containing images + /// Suppress progress details during load. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ImageLoadAsync(System.IO.Stream imagesTarball, bool? quiet, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/images/load?"); + if (quiet != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("quiet") + "=").Append(System.Uri.EscapeDataString(ConvertToString(quiet, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StreamContent(imagesTarball); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/x-tar"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create an exec instance + /// + /// + /// Run a command inside a running container. + /// + /// Exec configuration + /// ID or name of container + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ContainerExecAsync(ExecConfig execConfig, string id) + { + return ContainerExecAsync(execConfig, id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create an exec instance + /// + /// + /// Run a command inside a running container. + /// + /// Exec configuration + /// ID or name of container + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ContainerExecAsync(ExecConfig execConfig, string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (execConfig == null) + throw new System.ArgumentNullException("execConfig"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/containers/{id}/exec"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(execConfig, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such container", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("container is paused", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Start an exec instance + /// + /// + /// Starts a previously set up exec instance. If detach is true, this endpoint + ///
returns immediately after starting the command. Otherwise, it sets up an + ///
interactive session with the command. + ///
+ /// Exec instance ID + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ExecStartAsync(ExecStartConfig execStartConfig, string id) + { + return ExecStartAsync(execStartConfig, id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Start an exec instance + /// + /// + /// Starts a previously set up exec instance. If detach is true, this endpoint + ///
returns immediately after starting the command. Otherwise, it sets up an + ///
interactive session with the command. + ///
+ /// Exec instance ID + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExecStartAsync(ExecStartConfig execStartConfig, string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/exec/{id}/start"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(execStartConfig, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/vnd.docker.raw-stream")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + return default(FileResponse); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such exec instance", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Container is stopped or paused", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Resize an exec instance + /// + /// + /// Resize the TTY session used by an exec instance. This endpoint only works + ///
if `tty` was specified as part of creating and starting the exec instance. + ///
+ /// Exec instance ID + /// Height of the TTY session in characters + /// Width of the TTY session in characters + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ExecResizeAsync(string id, int? h, int? w) + { + return ExecResizeAsync(id, h, w, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Resize an exec instance + /// + /// + /// Resize the TTY session used by an exec instance. This endpoint only works + ///
if `tty` was specified as part of creating and starting the exec instance. + ///
+ /// Exec instance ID + /// Height of the TTY session in characters + /// Width of the TTY session in characters + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExecResizeAsync(string id, int? h, int? w, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/exec/{id}/resize?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (h != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("h") + "=").Append(System.Uri.EscapeDataString(ConvertToString(h, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (w != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("w") + "=").Append(System.Uri.EscapeDataString(ConvertToString(w, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such exec instance", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect an exec instance + /// + /// + /// Return low-level information about an exec instance. + /// + /// Exec instance ID + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ExecInspectAsync(string id) + { + return ExecInspectAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect an exec instance + /// + /// + /// Return low-level information about an exec instance. + /// + /// Exec instance ID + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ExecInspectAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/exec/{id}/json"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such exec instance", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List volumes + /// + /// JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the volumes list. Available filters: + ///
+ ///
- `dangling=<boolean>` When set to `true` (or `1`), returns all + ///
volumes that are not in use by a container. When set to `false` + ///
(or `0`), only volumes that are in use by one or more + ///
containers are returned. + ///
- `driver=<volume-driver-name>` Matches volumes based on their driver. + ///
- `label=<key>` or `label=<key>:<value>` Matches volumes based on + ///
the presence of a `label` alone or a `label` and a value. + ///
- `name=<volume-name>` Matches all or part of a volume name. + /// Summary volume data that matches the query + /// A server side error occurred. + public virtual System.Threading.Tasks.Task VolumeListAsync(string filters) + { + return VolumeListAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List volumes + /// + /// JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the volumes list. Available filters: + ///
+ ///
- `dangling=<boolean>` When set to `true` (or `1`), returns all + ///
volumes that are not in use by a container. When set to `false` + ///
(or `0`), only volumes that are in use by one or more + ///
containers are returned. + ///
- `driver=<volume-driver-name>` Matches volumes based on their driver. + ///
- `label=<key>` or `label=<key>:<value>` Matches volumes based on + ///
the presence of a `label` alone or a `label` and a value. + ///
- `name=<volume-name>` Matches all or part of a volume name. + /// Summary volume data that matches the query + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task VolumeListAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/volumes?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a volume + /// + /// Volume configuration + /// The volume was created successfully + /// A server side error occurred. + public virtual System.Threading.Tasks.Task VolumeCreateAsync(VolumeCreateOptions volumeConfig) + { + return VolumeCreateAsync(volumeConfig, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a volume + /// + /// Volume configuration + /// The volume was created successfully + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task VolumeCreateAsync(VolumeCreateOptions volumeConfig, System.Threading.CancellationToken cancellationToken) + { + if (volumeConfig == null) + throw new System.ArgumentNullException("volumeConfig"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/volumes/create"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(volumeConfig, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a volume + /// + /// Volume name or ID + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task VolumeInspectAsync(string name) + { + return VolumeInspectAsync(name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a volume + /// + /// Volume name or ID + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task VolumeInspectAsync(string name, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/volumes/{name}"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such volume", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// "Update a volume. Valid only for Swarm cluster volumes" + /// + /// The name or ID of the volume + /// The spec of the volume to update. Currently, only Availability may + ///
change. All other fields must remain unchanged. + /// The version number of the volume being updated. This is required to + ///
avoid conflicting writes. Found in the volume's `ClusterVolume` + ///
field. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task VolumeUpdateAsync(string name, Body2 body, long version) + { + return VolumeUpdateAsync(name, body, version, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// "Update a volume. Valid only for Swarm cluster volumes" + /// + /// The name or ID of the volume + /// The spec of the volume to update. Currently, only Availability may + ///
change. All other fields must remain unchanged. + /// The version number of the volume being updated. This is required to + ///
avoid conflicting writes. Found in the volume's `ClusterVolume` + ///
field. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task VolumeUpdateAsync(string name, Body2 body, long version, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + if (version == null) + throw new System.ArgumentNullException("version"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/volumes/{name}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("PUT"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such volume", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Remove a volume + /// + /// + /// Instruct the driver to remove the volume. + /// + /// Volume name or ID + /// Force the removal of the volume + /// The volume was removed + /// A server side error occurred. + public virtual System.Threading.Tasks.Task VolumeDeleteAsync(string name, bool? force) + { + return VolumeDeleteAsync(name, force, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Remove a volume + /// + /// + /// Instruct the driver to remove the volume. + /// + /// Volume name or ID + /// Force the removal of the volume + /// The volume was removed + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task VolumeDeleteAsync(string name, bool? force, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/volumes/{name}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (force != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("No such volume or volume driver", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Volume is in use and cannot be removed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete unused volumes + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune volumes with (or without, in case `label!=...` is used) the specified labels. + ///
- `all` (`all=true`) - Consider all (local) volumes for pruning and not just anonymous volumes. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task VolumePruneAsync(string filters) + { + return VolumePruneAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete unused volumes + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune volumes with (or without, in case `label!=...` is used) the specified labels. + ///
- `all` (`all=true`) - Consider all (local) volumes for pruning and not just anonymous volumes. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task VolumePruneAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/volumes/prune?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List networks + /// + /// + /// Returns a list of networks. For details on the format, see the + ///
[network inspect endpoint](#operation/NetworkInspect). + ///
+ ///
Note that it uses a different, smaller representation of a network than + ///
inspecting a single network. For example, the list of containers attached + ///
to the network is not propagated in API versions 1.28 and up. + ///
+ /// JSON encoded value of the filters (a `map[string][]string`) to process + ///
on the networks list. + ///
+ ///
Available filters: + ///
+ ///
- `dangling=<boolean>` When set to `true` (or `1`), returns all + ///
networks that are not in use by a container. When set to `false` + ///
(or `0`), only networks that are in use by one or more + ///
containers are returned. + ///
- `driver=<driver-name>` Matches a network's driver. + ///
- `id=<network-id>` Matches all or part of a network ID. + ///
- `label=<key>` or `label=<key>=<value>` of a network label. + ///
- `name=<network-name>` Matches all or part of a network name. + ///
- `scope=["swarm"|"global"|"local"]` Filters networks by scope (`swarm`, `global`, or `local`). + ///
- `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> NetworkListAsync(string filters) + { + return NetworkListAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List networks + /// + /// + /// Returns a list of networks. For details on the format, see the + ///
[network inspect endpoint](#operation/NetworkInspect). + ///
+ ///
Note that it uses a different, smaller representation of a network than + ///
inspecting a single network. For example, the list of containers attached + ///
to the network is not propagated in API versions 1.28 and up. + ///
+ /// JSON encoded value of the filters (a `map[string][]string`) to process + ///
on the networks list. + ///
+ ///
Available filters: + ///
+ ///
- `dangling=<boolean>` When set to `true` (or `1`), returns all + ///
networks that are not in use by a container. When set to `false` + ///
(or `0`), only networks that are in use by one or more + ///
containers are returned. + ///
- `driver=<driver-name>` Matches a network's driver. + ///
- `id=<network-id>` Matches all or part of a network ID. + ///
- `label=<key>` or `label=<key>=<value>` of a network label. + ///
- `name=<network-name>` Matches all or part of a network name. + ///
- `scope=["swarm"|"global"|"local"]` Filters networks by scope (`swarm`, `global`, or `local`). + ///
- `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> NetworkListAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/networks?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a network + /// + /// Network ID or name + /// Detailed inspect output for troubleshooting + /// Filter the network by scope (swarm, global, or local) + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NetworkInspectAsync(string id, bool? verbose, string scope) + { + return NetworkInspectAsync(id, verbose, scope, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a network + /// + /// Network ID or name + /// Detailed inspect output for troubleshooting + /// Filter the network by scope (swarm, global, or local) + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NetworkInspectAsync(string id, bool? verbose, string scope, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/networks/{id}?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (verbose != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("verbose") + "=").Append(System.Uri.EscapeDataString(ConvertToString(verbose, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (scope != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("scope") + "=").Append(System.Uri.EscapeDataString(ConvertToString(scope, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Network not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Remove a network + /// + /// Network ID or name + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NetworkDeleteAsync(string id) + { + return NetworkDeleteAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Remove a network + /// + /// Network ID or name + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NetworkDeleteAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/networks/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("operation not supported for pre-defined networks", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such network", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a network + /// + /// Network configuration + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NetworkCreateAsync(NetworkCreateRequest networkConfig) + { + return NetworkCreateAsync(networkConfig, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a network + /// + /// Network configuration + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NetworkCreateAsync(NetworkCreateRequest networkConfig, System.Threading.CancellationToken cancellationToken) + { + if (networkConfig == null) + throw new System.ArgumentNullException("networkConfig"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/networks/create"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(networkConfig, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("operation not supported for pre-defined networks", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("plugin not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Connect a container to a network + /// + /// Network ID or name + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NetworkConnectAsync(string id, NetworkConnectRequest container) + { + return NetworkConnectAsync(id, container, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Connect a container to a network + /// + /// Network ID or name + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NetworkConnectAsync(string id, NetworkConnectRequest container, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (container == null) + throw new System.ArgumentNullException("container"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/networks/{id}/connect"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(container, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Operation not supported for swarm scoped networks", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Network or container not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Disconnect a container from a network + /// + /// Network ID or name + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NetworkDisconnectAsync(string id, NetworkDisconnectRequest container) + { + return NetworkDisconnectAsync(id, container, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Disconnect a container from a network + /// + /// Network ID or name + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NetworkDisconnectAsync(string id, NetworkDisconnectRequest container, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (container == null) + throw new System.ArgumentNullException("container"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/networks/{id}/disconnect"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(container, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Operation not supported for swarm scoped networks", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Network or container not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete unused networks + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `until=<timestamp>` Prune networks created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune networks with (or without, in case `label!=...` is used) the specified labels. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NetworkPruneAsync(string filters) + { + return NetworkPruneAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete unused networks + /// + /// Filters to process on the prune list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `until=<timestamp>` Prune networks created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. + ///
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune networks with (or without, in case `label!=...` is used) the specified labels. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NetworkPruneAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/networks/prune?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List plugins + /// + /// + /// Returns information about installed plugins. + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the plugin list. + ///
+ ///
Available filters: + ///
+ ///
- `capability=<capability name>` + ///
- `enable=<true>|<false>` + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> PluginListAsync(string filters) + { + return PluginListAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List plugins + /// + /// + /// Returns information about installed plugins. + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the plugin list. + ///
+ ///
Available filters: + ///
+ ///
- `capability=<capability name>` + ///
- `enable=<true>|<false>` + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> PluginListAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get plugin privileges + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> GetPluginPrivilegesAsync(string remote) + { + return GetPluginPrivilegesAsync(remote, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get plugin privileges + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> GetPluginPrivilegesAsync(string remote, System.Threading.CancellationToken cancellationToken) + { + if (remote == null) + throw new System.ArgumentNullException("remote"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/privileges?"); + urlBuilder_.Append(System.Uri.EscapeDataString("remote") + "=").Append(System.Uri.EscapeDataString(ConvertToString(remote, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Install a plugin + /// + /// + /// Pulls and installs a plugin. After the plugin is installed, it can be + ///
enabled using the [`POST /plugins/{name}/enable` endpoint](#operation/PostPluginsEnable). + ///
+ /// Remote reference for plugin to install. + ///
+ ///
The `:latest` tag is optional, and is used as the default if omitted. + /// Local name for the pulled plugin. + ///
+ ///
The `:latest` tag is optional, and is used as the default if omitted. + /// A base64url-encoded auth configuration to use when pulling a plugin + ///
from a registry. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginPullAsync(string remote, string name, string x_Registry_Auth, System.Collections.Generic.IEnumerable body) + { + return PluginPullAsync(remote, name, x_Registry_Auth, body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Install a plugin + /// + /// + /// Pulls and installs a plugin. After the plugin is installed, it can be + ///
enabled using the [`POST /plugins/{name}/enable` endpoint](#operation/PostPluginsEnable). + ///
+ /// Remote reference for plugin to install. + ///
+ ///
The `:latest` tag is optional, and is used as the default if omitted. + /// Local name for the pulled plugin. + ///
+ ///
The `:latest` tag is optional, and is used as the default if omitted. + /// A base64url-encoded auth configuration to use when pulling a plugin + ///
from a registry. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginPullAsync(string remote, string name, string x_Registry_Auth, System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken) + { + if (remote == null) + throw new System.ArgumentNullException("remote"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/pull?"); + urlBuilder_.Append(System.Uri.EscapeDataString("remote") + "=").Append(System.Uri.EscapeDataString(ConvertToString(remote, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + if (name != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("name") + "=").Append(System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (x_Registry_Auth != null) + request_.Headers.TryAddWithoutValidation("X-Registry-Auth", ConvertToString(x_Registry_Auth, System.Globalization.CultureInfo.InvariantCulture)); + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginInspectAsync(string name) + { + return PluginInspectAsync(name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginInspectAsync(string name, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/{name}/json"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("plugin is not installed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Remove a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Disable the plugin before removing. This may result in issues if the + ///
plugin is in use by a container. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginDeleteAsync(string name, bool? force) + { + return PluginDeleteAsync(name, force, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Remove a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Disable the plugin before removing. This may result in issues if the + ///
plugin is in use by a container. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginDeleteAsync(string name, bool? force, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/{name}?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (force != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("plugin is not installed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Enable a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Set the HTTP client timeout (in seconds) + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginEnableAsync(string name, int? timeout) + { + return PluginEnableAsync(name, timeout, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Enable a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Set the HTTP client timeout (in seconds) + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginEnableAsync(string name, int? timeout, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/{name}/enable?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (timeout != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("timeout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(timeout, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("plugin is not installed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Disable a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Force disable a plugin even if still in use. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginDisableAsync(string name, bool? force) + { + return PluginDisableAsync(name, force, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Disable a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Force disable a plugin even if still in use. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginDisableAsync(string name, bool? force, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/{name}/disable?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + if (force != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("plugin is not installed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Upgrade a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Remote reference to upgrade to. + ///
+ ///
The `:latest` tag is optional, and is used as the default if omitted. + /// A base64url-encoded auth configuration to use when pulling a plugin + ///
from a registry. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginUpgradeAsync(string name, string remote, string x_Registry_Auth, System.Collections.Generic.IEnumerable body) + { + return PluginUpgradeAsync(name, remote, x_Registry_Auth, body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Upgrade a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Remote reference to upgrade to. + ///
+ ///
The `:latest` tag is optional, and is used as the default if omitted. + /// A base64url-encoded auth configuration to use when pulling a plugin + ///
from a registry. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginUpgradeAsync(string name, string remote, string x_Registry_Auth, System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + if (remote == null) + throw new System.ArgumentNullException("remote"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/{name}/upgrade?"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("remote") + "=").Append(System.Uri.EscapeDataString(ConvertToString(remote, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (x_Registry_Auth != null) + request_.Headers.TryAddWithoutValidation("X-Registry-Auth", ConvertToString(x_Registry_Auth, System.Globalization.CultureInfo.InvariantCulture)); + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("plugin not installed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Path to tar containing plugin rootfs and manifest + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginCreateAsync(string name, System.IO.Stream tarContext) + { + return PluginCreateAsync(name, tarContext, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// Path to tar containing plugin rootfs and manifest + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginCreateAsync(string name, System.IO.Stream tarContext, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/create?"); + urlBuilder_.Append(System.Uri.EscapeDataString("name") + "=").Append(System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StreamContent(tarContext); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/x-tar"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Push a plugin + /// + /// + /// Push a plugin to the registry. + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginPushAsync(string name) + { + return PluginPushAsync(name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Push a plugin + /// + /// + /// Push a plugin to the registry. + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginPushAsync(string name, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/{name}/push"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("plugin not installed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Configure a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// No error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PluginSetAsync(string name, System.Collections.Generic.IEnumerable body) + { + return PluginSetAsync(name, body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Configure a plugin + /// + /// The name of the plugin. The `:latest` tag is optional, and is the + ///
default if omitted. + /// No error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PluginSetAsync(string name, System.Collections.Generic.IEnumerable body, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/plugins/{name}/set"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Plugin not installed", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List nodes + /// + /// Filters to process on the nodes list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `id=<node id>` + ///
- `label=<engine label>` + ///
- `membership=`(`accepted`|`pending`)` + ///
- `name=<node name>` + ///
- `node.label=<node label>` + ///
- `role=`(`manager`|`worker`)` + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> NodeListAsync(string filters) + { + return NodeListAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List nodes + /// + /// Filters to process on the nodes list, encoded as JSON (a `map[string][]string`). + ///
+ ///
Available filters: + ///
- `id=<node id>` + ///
- `label=<engine label>` + ///
- `membership=`(`accepted`|`pending`)` + ///
- `name=<node name>` + ///
- `node.label=<node label>` + ///
- `role=`(`manager`|`worker`)` + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> NodeListAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/nodes?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a node + /// + /// The ID or name of the node + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NodeInspectAsync(string id) + { + return NodeInspectAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a node + /// + /// The ID or name of the node + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NodeInspectAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/nodes/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such node", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete a node + /// + /// The ID or name of the node + /// Force remove a node from the swarm + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NodeDeleteAsync(string id, bool? force) + { + return NodeDeleteAsync(id, force, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete a node + /// + /// The ID or name of the node + /// Force remove a node from the swarm + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NodeDeleteAsync(string id, bool? force, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/nodes/{id}?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (force != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such node", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Update a node + /// + /// The ID of the node + /// The version number of the node object being updated. This is required + ///
to avoid conflicting writes. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NodeUpdateAsync(string id, NodeSpec body, long version) + { + return NodeUpdateAsync(id, body, version, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update a node + /// + /// The ID of the node + /// The version number of the node object being updated. This is required + ///
to avoid conflicting writes. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task NodeUpdateAsync(string id, NodeSpec body, long version, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (version == null) + throw new System.ArgumentNullException("version"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/nodes/{id}/update?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such node", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect swarm + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SwarmInspectAsync() + { + return SwarmInspectAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect swarm + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SwarmInspectAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/swarm"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Initialize a new swarm + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SwarmInitAsync(SwarmInitRequest body) + { + return SwarmInitAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Initialize a new swarm + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SwarmInitAsync(SwarmInitRequest body, System.Threading.CancellationToken cancellationToken) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/swarm/init"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is already part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Join an existing swarm + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SwarmJoinAsync(SwarmJoinRequest body) + { + return SwarmJoinAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Join an existing swarm + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SwarmJoinAsync(SwarmJoinRequest body, System.Threading.CancellationToken cancellationToken) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/swarm/join"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is already part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Leave a swarm + /// + /// Force leave swarm, even if this is the last manager or that it will + ///
break the cluster. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SwarmLeaveAsync(bool? force) + { + return SwarmLeaveAsync(force, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Leave a swarm + /// + /// Force leave swarm, even if this is the last manager or that it will + ///
break the cluster. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SwarmLeaveAsync(bool? force, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/swarm/leave?"); + if (force != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Update a swarm + /// + /// The version number of the swarm object being updated. This is + ///
required to avoid conflicting writes. + /// Rotate the worker join token. + /// Rotate the manager join token. + /// Rotate the manager unlock key. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SwarmUpdateAsync(SwarmSpec body, long version, bool? rotateWorkerToken, bool? rotateManagerToken, bool? rotateManagerUnlockKey) + { + return SwarmUpdateAsync(body, version, rotateWorkerToken, rotateManagerToken, rotateManagerUnlockKey, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update a swarm + /// + /// The version number of the swarm object being updated. This is + ///
required to avoid conflicting writes. + /// Rotate the worker join token. + /// Rotate the manager join token. + /// Rotate the manager unlock key. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SwarmUpdateAsync(SwarmSpec body, long version, bool? rotateWorkerToken, bool? rotateManagerToken, bool? rotateManagerUnlockKey, System.Threading.CancellationToken cancellationToken) + { + if (version == null) + throw new System.ArgumentNullException("version"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/swarm/update?"); + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + if (rotateWorkerToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("rotateWorkerToken") + "=").Append(System.Uri.EscapeDataString(ConvertToString(rotateWorkerToken, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (rotateManagerToken != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("rotateManagerToken") + "=").Append(System.Uri.EscapeDataString(ConvertToString(rotateManagerToken, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (rotateManagerUnlockKey != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("rotateManagerUnlockKey") + "=").Append(System.Uri.EscapeDataString(ConvertToString(rotateManagerUnlockKey, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get the unlock key + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SwarmUnlockkeyAsync() + { + return SwarmUnlockkeyAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get the unlock key + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SwarmUnlockkeyAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/swarm/unlockkey"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Unlock a locked manager + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SwarmUnlockAsync(SwarmUnlockRequest body) + { + return SwarmUnlockAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Unlock a locked manager + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SwarmUnlockAsync(SwarmUnlockRequest body, System.Threading.CancellationToken cancellationToken) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/swarm/unlock"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List services + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the services list. + ///
+ ///
Available filters: + ///
+ ///
- `id=<service id>` + ///
- `label=<service label>` + ///
- `mode=["replicated"|"global"]` + ///
- `name=<service name>` + /// Include service status, with count of running and desired tasks. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ServiceListAsync(string filters, bool? status) + { + return ServiceListAsync(filters, status, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List services + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the services list. + ///
+ ///
Available filters: + ///
+ ///
- `id=<service id>` + ///
- `label=<service label>` + ///
- `mode=["replicated"|"global"]` + ///
- `name=<service name>` + /// Include service status, with count of running and desired tasks. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ServiceListAsync(string filters, bool? status, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/services?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (status != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("status") + "=").Append(System.Uri.EscapeDataString(ConvertToString(status, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a service + /// + /// A base64url-encoded auth configuration for pulling from private + ///
registries. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ServiceCreateAsync(Body3 body, string x_Registry_Auth) + { + return ServiceCreateAsync(body, x_Registry_Auth, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a service + /// + /// A base64url-encoded auth configuration for pulling from private + ///
registries. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ServiceCreateAsync(Body3 body, string x_Registry_Auth, System.Threading.CancellationToken cancellationToken) + { + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/services/create"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (x_Registry_Auth != null) + request_.Headers.TryAddWithoutValidation("X-Registry-Auth", ConvertToString(x_Registry_Auth, System.Globalization.CultureInfo.InvariantCulture)); + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 403) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("network is not eligible for services", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("name conflicts with an existing service", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a service + /// + /// ID or name of service. + /// Fill empty fields with default values. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ServiceInspectAsync(string id, bool? insertDefaults) + { + return ServiceInspectAsync(id, insertDefaults, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a service + /// + /// ID or name of service. + /// Fill empty fields with default values. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ServiceInspectAsync(string id, bool? insertDefaults, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/services/{id}?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (insertDefaults != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("insertDefaults") + "=").Append(System.Uri.EscapeDataString(ConvertToString(insertDefaults, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such service", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete a service + /// + /// ID or name of service. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ServiceDeleteAsync(string id) + { + return ServiceDeleteAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete a service + /// + /// ID or name of service. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ServiceDeleteAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/services/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such service", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Update a service + /// + /// ID or name of service. + /// The version number of the service object being updated. This is + ///
required to avoid conflicting writes. + ///
This version number should be the value as currently set on the + ///
service *before* the update. You can find the current version by + ///
calling `GET /services/{id}` + /// If the `X-Registry-Auth` header is not specified, this parameter + ///
indicates where to find registry authorization credentials. + /// Set to this parameter to `previous` to cause a server-side rollback + ///
to the previous service spec. The supplied spec will be ignored in + ///
this case. + /// A base64url-encoded auth configuration for pulling from private + ///
registries. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ServiceUpdateAsync(string id, Body4 body, int version, RegistryAuthFrom? registryAuthFrom, string rollback, string x_Registry_Auth) + { + return ServiceUpdateAsync(id, body, version, registryAuthFrom, rollback, x_Registry_Auth, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update a service + /// + /// ID or name of service. + /// The version number of the service object being updated. This is + ///
required to avoid conflicting writes. + ///
This version number should be the value as currently set on the + ///
service *before* the update. You can find the current version by + ///
calling `GET /services/{id}` + /// If the `X-Registry-Auth` header is not specified, this parameter + ///
indicates where to find registry authorization credentials. + /// Set to this parameter to `previous` to cause a server-side rollback + ///
to the previous service spec. The supplied spec will be ignored in + ///
this case. + /// A base64url-encoded auth configuration for pulling from private + ///
registries. + ///
+ ///
Refer to the [authentication section](#section/Authentication) for + ///
details. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ServiceUpdateAsync(string id, Body4 body, int version, RegistryAuthFrom? registryAuthFrom, string rollback, string x_Registry_Auth, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (version == null) + throw new System.ArgumentNullException("version"); + + if (body == null) + throw new System.ArgumentNullException("body"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/services/{id}/update?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + if (registryAuthFrom != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("registryAuthFrom") + "=").Append(System.Uri.EscapeDataString(ConvertToString(registryAuthFrom, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (rollback != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("rollback") + "=").Append(System.Uri.EscapeDataString(ConvertToString(rollback, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + + if (x_Registry_Auth != null) + request_.Headers.TryAddWithoutValidation("X-Registry-Auth", ConvertToString(x_Registry_Auth, System.Globalization.CultureInfo.InvariantCulture)); + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such service", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get service logs + /// + /// + /// Get `stdout` and `stderr` logs from a service. See also + ///
[`/containers/{id}/logs`](#operation/ContainerLogs). + ///
+ ///
**Note**: This endpoint works only for services with the `local`, + ///
`json-file` or `journald` logging drivers. + ///
+ /// ID or name of the service + /// Show service context and extra details provided to logs. + /// Keep connection after returning logs. + /// Return logs from `stdout` + /// Return logs from `stderr` + /// Only return logs since this time, as a UNIX timestamp + /// Add timestamps to every log line + /// Only return this number of log lines from the end of the logs. + ///
Specify as an integer or `all` to output all log lines. + /// logs returned as a stream in response body + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ServiceLogsAsync(string id, bool? details, bool? follow, bool? stdout, bool? stderr, int? since, bool? timestamps, string tail) + { + return ServiceLogsAsync(id, details, follow, stdout, stderr, since, timestamps, tail, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get service logs + /// + /// + /// Get `stdout` and `stderr` logs from a service. See also + ///
[`/containers/{id}/logs`](#operation/ContainerLogs). + ///
+ ///
**Note**: This endpoint works only for services with the `local`, + ///
`json-file` or `journald` logging drivers. + ///
+ /// ID or name of the service + /// Show service context and extra details provided to logs. + /// Keep connection after returning logs. + /// Return logs from `stdout` + /// Return logs from `stderr` + /// Only return logs since this time, as a UNIX timestamp + /// Add timestamps to every log line + /// Only return this number of log lines from the end of the logs. + ///
Specify as an integer or `all` to output all log lines. + /// logs returned as a stream in response body + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ServiceLogsAsync(string id, bool? details, bool? follow, bool? stdout, bool? stderr, int? since, bool? timestamps, string tail, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/services/{id}/logs?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (details != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("details") + "=").Append(System.Uri.EscapeDataString(ConvertToString(details, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (follow != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("follow") + "=").Append(System.Uri.EscapeDataString(ConvertToString(follow, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stdout != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stdout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stdout, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stderr != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stderr") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stderr, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (since != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("since") + "=").Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (timestamps != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("timestamps") + "=").Append(System.Uri.EscapeDataString(ConvertToString(timestamps, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (tail != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tail") + "=").Append(System.Uri.EscapeDataString(ConvertToString(tail, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/vnd.docker.raw-stream")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); + disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse + return fileResponse_; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such service", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List tasks + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the tasks list. + ///
+ ///
Available filters: + ///
+ ///
- `desired-state=(running | shutdown | accepted)` + ///
- `id=<task id>` + ///
- `label=key` or `label="key=value"` + ///
- `name=<task name>` + ///
- `node=<node id or name>` + ///
- `service=<service name>` + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> TaskListAsync(string filters) + { + return TaskListAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List tasks + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the tasks list. + ///
+ ///
Available filters: + ///
+ ///
- `desired-state=(running | shutdown | accepted)` + ///
- `id=<task id>` + ///
- `label=key` or `label="key=value"` + ///
- `name=<task name>` + ///
- `node=<node id or name>` + ///
- `service=<service name>` + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> TaskListAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/tasks?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a task + /// + /// ID of the task + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task TaskInspectAsync(string id) + { + return TaskInspectAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a task + /// + /// ID of the task + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TaskInspectAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/tasks/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such task", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get task logs + /// + /// + /// Get `stdout` and `stderr` logs from a task. + ///
See also [`/containers/{id}/logs`](#operation/ContainerLogs). + ///
+ ///
**Note**: This endpoint works only for services with the `local`, + ///
`json-file` or `journald` logging drivers. + ///
+ /// ID of the task + /// Show task context and extra details provided to logs. + /// Keep connection after returning logs. + /// Return logs from `stdout` + /// Return logs from `stderr` + /// Only return logs since this time, as a UNIX timestamp + /// Add timestamps to every log line + /// Only return this number of log lines from the end of the logs. + ///
Specify as an integer or `all` to output all log lines. + /// logs returned as a stream in response body + /// A server side error occurred. + public virtual System.Threading.Tasks.Task TaskLogsAsync(string id, bool? details, bool? follow, bool? stdout, bool? stderr, int? since, bool? timestamps, string tail) + { + return TaskLogsAsync(id, details, follow, stdout, stderr, since, timestamps, tail, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get task logs + /// + /// + /// Get `stdout` and `stderr` logs from a task. + ///
See also [`/containers/{id}/logs`](#operation/ContainerLogs). + ///
+ ///
**Note**: This endpoint works only for services with the `local`, + ///
`json-file` or `journald` logging drivers. + ///
+ /// ID of the task + /// Show task context and extra details provided to logs. + /// Keep connection after returning logs. + /// Return logs from `stdout` + /// Return logs from `stderr` + /// Only return logs since this time, as a UNIX timestamp + /// Add timestamps to every log line + /// Only return this number of log lines from the end of the logs. + ///
Specify as an integer or `all` to output all log lines. + /// logs returned as a stream in response body + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task TaskLogsAsync(string id, bool? details, bool? follow, bool? stdout, bool? stderr, int? since, bool? timestamps, string tail, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/tasks/{id}/logs?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + if (details != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("details") + "=").Append(System.Uri.EscapeDataString(ConvertToString(details, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (follow != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("follow") + "=").Append(System.Uri.EscapeDataString(ConvertToString(follow, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stdout != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stdout") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stdout, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (stderr != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("stderr") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stderr, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (since != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("since") + "=").Append(System.Uri.EscapeDataString(ConvertToString(since, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (timestamps != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("timestamps") + "=").Append(System.Uri.EscapeDataString(ConvertToString(timestamps, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + if (tail != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("tail") + "=").Append(System.Uri.EscapeDataString(ConvertToString(tail, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/vnd.docker.raw-stream")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) + { + var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); + disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse + return fileResponse_; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such task", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List secrets + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the secrets list. + ///
+ ///
Available filters: + ///
+ ///
- `id=<secret id>` + ///
- `label=<key> or label=<key>=value` + ///
- `name=<secret name>` + ///
- `names=<secret name>` + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> SecretListAsync(string filters) + { + return SecretListAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List secrets + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the secrets list. + ///
+ ///
Available filters: + ///
+ ///
- `id=<secret id>` + ///
- `label=<key> or label=<key>=value` + ///
- `name=<secret name>` + ///
- `names=<secret name>` + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> SecretListAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/secrets?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a secret + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SecretCreateAsync(Body5 body) + { + return SecretCreateAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a secret + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SecretCreateAsync(Body5 body, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/secrets/create"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("name conflicts with an existing object", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a secret + /// + /// ID of the secret + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SecretInspectAsync(string id) + { + return SecretInspectAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a secret + /// + /// ID of the secret + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SecretInspectAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/secrets/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("secret not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete a secret + /// + /// ID of the secret + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SecretDeleteAsync(string id) + { + return SecretDeleteAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete a secret + /// + /// ID of the secret + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SecretDeleteAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/secrets/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("secret not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Update a Secret + /// + /// The ID or name of the secret + /// The spec of the secret to update. Currently, only the Labels field + ///
can be updated. All other fields must remain unchanged from the + ///
[SecretInspect endpoint](#operation/SecretInspect) response values. + /// The version number of the secret object being updated. This is + ///
required to avoid conflicting writes. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task SecretUpdateAsync(string id, SecretSpec body, long version) + { + return SecretUpdateAsync(id, body, version, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update a Secret + /// + /// The ID or name of the secret + /// The spec of the secret to update. Currently, only the Labels field + ///
can be updated. All other fields must remain unchanged from the + ///
[SecretInspect endpoint](#operation/SecretInspect) response values. + /// The version number of the secret object being updated. This is + ///
required to avoid conflicting writes. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SecretUpdateAsync(string id, SecretSpec body, long version, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (version == null) + throw new System.ArgumentNullException("version"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/secrets/{id}/update?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such secret", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// List configs + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the configs list. + ///
+ ///
Available filters: + ///
+ ///
- `id=<config id>` + ///
- `label=<key> or label=<key>=value` + ///
- `name=<config name>` + ///
- `names=<config name>` + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task> ConfigListAsync(string filters) + { + return ConfigListAsync(filters, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// List configs + /// + /// A JSON encoded value of the filters (a `map[string][]string`) to + ///
process on the configs list. + ///
+ ///
Available filters: + ///
+ ///
- `id=<config id>` + ///
- `label=<key> or label=<key>=value` + ///
- `name=<config name>` + ///
- `names=<config name>` + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task> ConfigListAsync(string filters, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/configs?"); + if (filters != null) + { + urlBuilder_.Append(System.Uri.EscapeDataString("filters") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filters, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + } + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Create a config + /// + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ConfigCreateAsync(Body6 body) + { + return ConfigCreateAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Create a config + /// + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ConfigCreateAsync(Body6 body, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/configs/create"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 201) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 409) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("name conflicts with an existing object", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Inspect a config + /// + /// ID of the config + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ConfigInspectAsync(string id) + { + return ConfigInspectAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Inspect a config + /// + /// ID of the config + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ConfigInspectAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/configs/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("config not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Delete a config + /// + /// ID of the config + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ConfigDeleteAsync(string id) + { + return ConfigDeleteAsync(id, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Delete a config + /// + /// ID of the config + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ConfigDeleteAsync(string id, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/configs/{id}"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("DELETE"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 204) + { + return; + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("config not found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Update a Config + /// + /// The ID or name of the config + /// The spec of the config to update. Currently, only the Labels field + ///
can be updated. All other fields must remain unchanged from the + ///
[ConfigInspect endpoint](#operation/ConfigInspect) response values. + /// The version number of the config object being updated. This is + ///
required to avoid conflicting writes. + /// no error + /// A server side error occurred. + public virtual System.Threading.Tasks.Task ConfigUpdateAsync(string id, ConfigSpec body, long version) + { + return ConfigUpdateAsync(id, body, version, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Update a Config + /// + /// The ID or name of the config + /// The spec of the config to update. Currently, only the Labels field + ///
can be updated. All other fields must remain unchanged from the + ///
[ConfigInspect endpoint](#operation/ConfigInspect) response values. + /// The version number of the config object being updated. This is + ///
required to avoid conflicting writes. + /// no error + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task ConfigUpdateAsync(string id, ConfigSpec body, long version, System.Threading.CancellationToken cancellationToken) + { + if (id == null) + throw new System.ArgumentNullException("id"); + + if (version == null) + throw new System.ArgumentNullException("version"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/configs/{id}/update?"); + urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); + urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); + urlBuilder_.Length--; + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = System.Text.Json.JsonSerializer.Serialize(body, _settings.Value); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + return; + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("no such config", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 503) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("node is not part of a swarm", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Get image information from the registry + /// + /// + /// Return image digest and platform information by contacting the registry. + /// + /// Image name or id + /// descriptor and platform information + /// A server side error occurred. + public virtual System.Threading.Tasks.Task DistributionInspectAsync(string name) + { + return DistributionInspectAsync(name, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Get image information from the registry + /// + /// + /// Return image digest and platform information by contacting the registry. + /// + /// Image name or id + /// descriptor and platform information + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task DistributionInspectAsync(string name, System.Threading.CancellationToken cancellationToken) + { + if (name == null) + throw new System.ArgumentNullException("name"); + + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/distribution/{name}/json"); + urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Method = new System.Net.Http.HttpMethod("GET"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 200) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return objectResponse_.Object; + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Failed authentication or no image found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("Server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + /// + /// Initialize interactive session + /// + /// + /// Start a new interactive session with a server. Session allows server to + ///
call back to the client for advanced capabilities. + ///
+ ///
### Hijacking + ///
+ ///
This endpoint hijacks the HTTP connection to HTTP2 transport that allows + ///
the client to expose gPRC services on that connection. + ///
+ ///
For example, the client sends this request to upgrade the connection: + ///
+ ///
``` + ///
POST /session HTTP/1.1 + ///
Upgrade: h2c + ///
Connection: Upgrade + ///
``` + ///
+ ///
The Docker daemon responds with a `101 UPGRADED` response follow with + ///
the raw stream: + ///
+ ///
``` + ///
HTTP/1.1 101 UPGRADED + ///
Connection: Upgrade + ///
Upgrade: h2c + ///
``` + ///
+ /// A server side error occurred. + public virtual System.Threading.Tasks.Task SessionAsync() + { + return SessionAsync(System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// + /// Initialize interactive session + /// + /// + /// Start a new interactive session with a server. Session allows server to + ///
call back to the client for advanced capabilities. + ///
+ ///
### Hijacking + ///
+ ///
This endpoint hijacks the HTTP connection to HTTP2 transport that allows + ///
the client to expose gPRC services on that connection. + ///
+ ///
For example, the client sends this request to upgrade the connection: + ///
+ ///
``` + ///
POST /session HTTP/1.1 + ///
Upgrade: h2c + ///
Connection: Upgrade + ///
``` + ///
+ ///
The Docker daemon responds with a `101 UPGRADED` response follow with + ///
the raw stream: + ///
+ ///
``` + ///
HTTP/1.1 101 UPGRADED + ///
Connection: Upgrade + ///
Upgrade: h2c + ///
``` + ///
+ /// A server side error occurred. + public virtual async System.Threading.Tasks.Task SessionAsync(System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/session"); + + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/vnd.docker.raw-stream"); + request_.Method = new System.Net.Http.HttpMethod("POST"); + + PrepareRequest(client_, request_, urlBuilder_); + + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + var disposeResponse_ = true; + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = (int)response_.StatusCode; + if (status_ == 101) + { + string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("no error, hijacking successful", status_, responseText_, headers_, null); + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("bad parameter", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new ApiException("server error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + + if (status_ == 200 || status_ == 204) + { + + return; + } + else + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); + } + } + finally + { + if (disposeResponse_) + response_.Dispose(); + } + } + } + finally + { + if (disposeClient_) + client_.Dispose(); + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Threading.CancellationToken cancellationToken) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + { + var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (System.Text.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value == null) + { + return ""; + } + + if (value is System.Enum) + { + var name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + + var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); + return converted == null ? string.Empty : converted; + } + } + else if (value is bool) + { + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + var result = System.Convert.ToString(value, cultureInfo); + return result == null ? "" : result; + } + } + + /// + /// An open port on a container + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Port + { + /// + /// Host IP address that the container's port is mapped to + /// + + [System.Text.Json.Serialization.JsonPropertyName("IP")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IP { get; set; } + + /// + /// Port on the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("PrivatePort")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public int PrivatePort { get; set; } + + /// + /// Port exposed on the host + /// + + [System.Text.Json.Serialization.JsonPropertyName("PublicPort")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? PublicPort { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public PortType Type { get; set; } + + } + + /// + /// MountPoint represents a mount point configuration inside the container. + ///
This is used for reporting the mountpoints in use by a container. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class MountPoint + { + /// + /// The mount type: + ///
+ ///
- `bind` a mount of a file or directory from the host into the container. + ///
- `volume` a docker volume with the given `Name`. + ///
- `tmpfs` a `tmpfs`. + ///
- `npipe` a named pipe from the host into the container. + ///
- `cluster` a Swarm cluster volume + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public MountPointType? Type { get; set; } + + /// + /// Name is the name reference to the underlying data defined by `Source` + ///
e.g., the volume name. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// Source location of the mount. + ///
+ ///
For volumes, this contains the storage location of the volume (within + ///
`/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains + ///
the source (host) part of the bind-mount. For `tmpfs` mount points, this + ///
field is empty. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Source")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Source { get; set; } + + /// + /// Destination is the path relative to the container root (`/`) where + ///
the `Source` is mounted inside the container. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Destination")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Destination { get; set; } + + /// + /// Driver is the volume driver used to create the volume (if it is a volume). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } + + /// + /// Mode is a comma separated list of options supplied by the user when + ///
creating the bind/volume mount. + ///
+ ///
The default is platform-specific (`"z"` on Linux, empty on Windows). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Mode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Mode { get; set; } + + /// + /// Whether the mount is mounted writable (read-write). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RW")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? RW { get; set; } + + /// + /// Propagation describes how mounts are propagated from the host into the + ///
mount point, and vice-versa. Refer to the [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + ///
for details. This field is not used on Windows. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Propagation")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Propagation { get; set; } + + } + + /// + /// A device mapping between the host and container + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DeviceMapping + { + + [System.Text.Json.Serialization.JsonPropertyName("PathOnHost")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string PathOnHost { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("PathInContainer")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string PathInContainer { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CgroupPermissions")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CgroupPermissions { get; set; } + + } + + /// + /// A request for devices to be sent to device drivers + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DeviceRequest + { + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Count")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Count { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("DeviceIDs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DeviceIDs { get; set; } + + /// + /// A list of capabilities; an OR list of AND lists of capabilities. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Capabilities")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection> Capabilities { get; set; } + + /// + /// Driver-specific options, specified as a key/value pairs. These options + ///
are passed directly to the driver. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ThrottleDevice + { + /// + /// Device path + /// + + [System.Text.Json.Serialization.JsonPropertyName("Path")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Path { get; set; } + + /// + /// Rate + /// + + [System.Text.Json.Serialization.JsonPropertyName("Rate")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] + public long? Rate { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Mount + { + /// + /// Container path. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Target")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Target { get; set; } + + /// + /// Mount source (e.g. a volume name, a host path). + /// + + [System.Text.Json.Serialization.JsonPropertyName("Source")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Source { get; set; } + + /// + /// The mount type. Available types: + ///
+ ///
- `bind` Mounts a file or directory from the host into the container. Must exist prior to creating the container. + ///
- `volume` Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed. + ///
- `tmpfs` Create a tmpfs with the given options. The mount source cannot be specified for tmpfs. + ///
- `npipe` Mounts a named pipe from the host into the container. Must exist prior to creating the container. + ///
- `cluster` a Swarm cluster volume + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public MountType? Type { get; set; } + + /// + /// Whether the mount should be read-only. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ReadOnly")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? ReadOnly { get; set; } + + /// + /// The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Consistency")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Consistency { get; set; } + + /// + /// Optional configuration for the `bind` type. + /// + + [System.Text.Json.Serialization.JsonPropertyName("BindOptions")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public BindOptions BindOptions { get; set; } + + /// + /// Optional configuration for the `volume` type. + /// + + [System.Text.Json.Serialization.JsonPropertyName("VolumeOptions")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public VolumeOptions VolumeOptions { get; set; } + + /// + /// Optional configuration for the `tmpfs` type. + /// + + [System.Text.Json.Serialization.JsonPropertyName("TmpfsOptions")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public TmpfsOptions TmpfsOptions { get; set; } + + } + + /// + /// The behavior to apply when the container exits. The default is not to + ///
restart. + ///
+ ///
An ever increasing delay (double the previous delay, starting at 100ms) is + ///
added before each restart to prevent flooding the server. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RestartPolicy + { + /// + /// - Empty string means not to restart + ///
- `no` Do not automatically restart + ///
- `always` Always restart + ///
- `unless-stopped` Restart always except when the user has manually stopped the container + ///
- `on-failure` Restart only when the container exit code is non-zero + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RestartPolicyName? Name { get; set; } + + /// + /// If `on-failure` is used, the number of times to retry before giving up. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MaximumRetryCount")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? MaximumRetryCount { get; set; } + + } + + /// + /// A container's resources (cgroups config, ulimits, etc) + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Resources + { + /// + /// An integer value representing this container's relative CPU weight + ///
versus other containers. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuShares")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? CpuShares { get; set; } + + /// + /// Memory limit in bytes. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Memory")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Memory { get; set; } = 0L; + + /// + /// Path to `cgroups` under which the container's `cgroup` is created. If + ///
the path is not absolute, the path is considered to be relative to the + ///
`cgroups` path of the init process. Cgroups are created if they do not + ///
already exist. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CgroupParent")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CgroupParent { get; set; } + + /// + /// Block IO weight (relative weight). + /// + + [System.Text.Json.Serialization.JsonPropertyName("BlkioWeight")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.Range(0, 1000)] + public int? BlkioWeight { get; set; } + + /// + /// Block IO weight (relative device weight) in the form: + ///
+ ///
``` + ///
[{"Path": "device_path", "Weight": weight}] + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("BlkioWeightDevice")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection BlkioWeightDevice { get; set; } + + /// + /// Limit read rate (bytes per second) from a device, in the form: + ///
+ ///
``` + ///
[{"Path": "device_path", "Rate": rate}] + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("BlkioDeviceReadBps")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection BlkioDeviceReadBps { get; set; } + + /// + /// Limit write rate (bytes per second) to a device, in the form: + ///
+ ///
``` + ///
[{"Path": "device_path", "Rate": rate}] + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("BlkioDeviceWriteBps")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection BlkioDeviceWriteBps { get; set; } + + /// + /// Limit read rate (IO per second) from a device, in the form: + ///
+ ///
``` + ///
[{"Path": "device_path", "Rate": rate}] + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("BlkioDeviceReadIOps")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection BlkioDeviceReadIOps { get; set; } + + /// + /// Limit write rate (IO per second) to a device, in the form: + ///
+ ///
``` + ///
[{"Path": "device_path", "Rate": rate}] + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("BlkioDeviceWriteIOps")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection BlkioDeviceWriteIOps { get; set; } + + /// + /// The length of a CPU period in microseconds. + /// + + [System.Text.Json.Serialization.JsonPropertyName("CpuPeriod")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? CpuPeriod { get; set; } + + /// + /// Microseconds of CPU time that the container can get in a CPU period. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuQuota")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? CpuQuota { get; set; } + + /// + /// The length of a CPU real-time period in microseconds. Set to 0 to + ///
allocate no time allocated to real-time tasks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuRealtimePeriod")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? CpuRealtimePeriod { get; set; } + + /// + /// The length of a CPU real-time runtime in microseconds. Set to 0 to + ///
allocate no time allocated to real-time tasks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuRealtimeRuntime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? CpuRealtimeRuntime { get; set; } + + /// + /// CPUs in which to allow execution (e.g., `0-3`, `0,1`). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpusetCpus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CpusetCpus { get; set; } + + /// + /// Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only + ///
effective on NUMA systems. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpusetMems")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CpusetMems { get; set; } + + /// + /// A list of devices to add to the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Devices")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Devices { get; set; } + + /// + /// a list of cgroup rules to apply to the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("DeviceCgroupRules")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DeviceCgroupRules { get; set; } + + /// + /// A list of requests for devices to be sent to device drivers. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DeviceRequests")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DeviceRequests { get; set; } + + /// + /// Hard limit for kernel TCP buffer memory (in bytes). Depending on the + ///
OCI runtime in use, this option may be ignored. It is no longer supported + ///
by the default (runc) runtime. + ///
+ ///
This field is omitted when empty. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("KernelMemoryTCP")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? KernelMemoryTCP { get; set; } + + /// + /// Memory soft limit in bytes. + /// + + [System.Text.Json.Serialization.JsonPropertyName("MemoryReservation")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MemoryReservation { get; set; } + + /// + /// Total memory limit (memory + swap). Set as `-1` to enable unlimited + ///
swap. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MemorySwap")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MemorySwap { get; set; } + + /// + /// Tune a container's memory swappiness behavior. Accepts an integer + ///
between 0 and 100. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MemorySwappiness")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.Range(0D, 100D)] + public long? MemorySwappiness { get; set; } + + /// + /// CPU quota in units of 10<sup>-9</sup> CPUs. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NanoCpus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? NanoCpus { get; set; } + + /// + /// Disable OOM Killer for the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("OomKillDisable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OomKillDisable { get; set; } + + /// + /// Run an init inside the container that forwards signals and reaps + ///
processes. This field is omitted if empty, and the default (as + ///
configured on the daemon) is used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Init")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Init { get; set; } + + /// + /// Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` + ///
to not change. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("PidsLimit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? PidsLimit { get; set; } + + /// + /// A list of resource limits to set in the container. For example: + ///
+ ///
``` + ///
{"Name": "nofile", "Soft": 1024, "Hard": 2048} + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Ulimits")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Ulimits { get; set; } + + /// + /// The number of usable CPUs (Windows only). + ///
+ ///
On Windows Server containers, the processor resource controls are + ///
mutually exclusive. The order of precedence is `CPUCount` first, then + ///
`CPUShares`, and `CPUPercent` last. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuCount")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? CpuCount { get; set; } + + /// + /// The usable percentage of the available CPUs (Windows only). + ///
+ ///
On Windows Server containers, the processor resource controls are + ///
mutually exclusive. The order of precedence is `CPUCount` first, then + ///
`CPUShares`, and `CPUPercent` last. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuPercent")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? CpuPercent { get; set; } + + /// + /// Maximum IOps for the container system drive (Windows only) + /// + + [System.Text.Json.Serialization.JsonPropertyName("IOMaximumIOps")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? IOMaximumIOps { get; set; } + + /// + /// Maximum IO in bytes per second for the container system drive + ///
(Windows only). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IOMaximumBandwidth")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? IOMaximumBandwidth { get; set; } + + } + + /// + /// An object describing a limit on resources which can be requested by a task. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Limit + { + + [System.Text.Json.Serialization.JsonPropertyName("NanoCPUs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? NanoCPUs { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("MemoryBytes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MemoryBytes { get; set; } + + /// + /// Limits the maximum number of PIDs in the container. Set `0` for unlimited. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Pids")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Pids { get; set; } = 0L; + + } + + /// + /// An object describing the resources which can be advertised by a node and + ///
requested by a task. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ResourceObject + { + + [System.Text.Json.Serialization.JsonPropertyName("NanoCPUs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? NanoCPUs { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("MemoryBytes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MemoryBytes { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("GenericResources")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public GenericResources GenericResources { get; set; } + + } + + /// + /// User-defined resources can be either Integer resources (e.g, `SSD=3`) or + ///
String resources (e.g, `GPU=UUID1`). + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class GenericResources : System.Collections.ObjectModel.Collection + { + + } + + /// + /// A test to perform to check that the container is healthy. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class HealthConfig + { + /// + /// The test to perform. Possible values are: + ///
+ ///
- `[]` inherit healthcheck from image or parent image + ///
- `["NONE"]` disable healthcheck + ///
- `["CMD", args...]` exec arguments directly + ///
- `["CMD-SHELL", command]` run command with system's default shell + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Test")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Test { get; set; } + + /// + /// The time to wait between checks in nanoseconds. It should be 0 or at + ///
least 1000000 (1 ms). 0 means inherit. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Interval")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Interval { get; set; } + + /// + /// The time to wait before considering the check to have hung. It should + ///
be 0 or at least 1000000 (1 ms). 0 means inherit. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Timeout")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Timeout { get; set; } + + /// + /// The number of consecutive failures needed to consider a container as + ///
unhealthy. 0 means inherit. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Retries")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Retries { get; set; } + + /// + /// Start period for the container to initialize before starting + ///
health-retries countdown in nanoseconds. It should be 0 or at least + ///
1000000 (1 ms). 0 means inherit. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("StartPeriod")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? StartPeriod { get; set; } + + } + + /// + /// Health stores information about the container's healthcheck results. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Health + { + /// + /// Status is one of `none`, `starting`, `healthy` or `unhealthy` + ///
+ ///
- "none" Indicates there is no healthcheck + ///
- "starting" Starting indicates that the container is not yet ready + ///
- "healthy" Healthy indicates that the container is running correctly + ///
- "unhealthy" Unhealthy indicates that the container has a problem + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public HealthStatus? Status { get; set; } + + /// + /// FailingStreak is the number of consecutive failures + /// + + [System.Text.Json.Serialization.JsonPropertyName("FailingStreak")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? FailingStreak { get; set; } + + /// + /// Log contains the last few results (oldest first) + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Log")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Log { get; set; } + + } + + /// + /// HealthcheckResult stores information about a single run of a healthcheck probe + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class HealthcheckResult + { + /// + /// Date and time at which this check started in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Start")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.DateTimeOffset? Start { get; set; } + + /// + /// Date and time at which this check ended in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("End")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string End { get; set; } + + /// + /// ExitCode meanings: + ///
+ ///
- `0` healthy + ///
- `1` unhealthy + ///
- `2` reserved (considered unhealthy) + ///
- other values: error running probe + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ExitCode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ExitCode { get; set; } + + /// + /// Output from last check + /// + + [System.Text.Json.Serialization.JsonPropertyName("Output")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Output { get; set; } + + } + + /// + /// Container configuration that depends on the host we are running on + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class HostConfig : Resources + { + /// + /// A list of volume bindings for this container. Each volume binding + ///
is a string in one of these forms: + ///
+ ///
- `host-src:container-dest[:options]` to bind-mount a host path + ///
into the container. Both `host-src`, and `container-dest` must + ///
be an _absolute_ path. + ///
- `volume-name:container-dest[:options]` to bind-mount a volume + ///
managed by a volume driver into the container. `container-dest` + ///
must be an _absolute_ path. + ///
+ ///
`options` is an optional, comma-delimited list of: + ///
+ ///
- `nocopy` disables automatic copying of data from the container + ///
path to the volume. The `nocopy` flag only applies to named volumes. + ///
- `[ro|rw]` mounts a volume read-only or read-write, respectively. + ///
If omitted or set to `rw`, volumes are mounted read-write. + ///
- `[z|Z]` applies SELinux labels to allow or deny multiple containers + ///
to read and write to the same volume. + ///
- `z`: a _shared_ content label is applied to the content. This + ///
label indicates that multiple containers can share the volume + ///
content, for both reading and writing. + ///
- `Z`: a _private unshared_ label is applied to the content. + ///
This label indicates that only the current container can use + ///
a private volume. Labeling systems such as SELinux require + ///
proper labels to be placed on volume content that is mounted + ///
into a container. Without a label, the security system can + ///
prevent a container's processes from using the content. By + ///
default, the labels set by the host operating system are not + ///
modified. + ///
- `[[r]shared|[r]slave|[r]private]` specifies mount + ///
[propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + ///
This only applies to bind-mounted volumes, not internal volumes + ///
or named volumes. Mount propagation requires the source mount + ///
point (the location where the source directory is mounted in the + ///
host operating system) to have the correct propagation properties. + ///
For shared volumes, the source mount point must be set to `shared`. + ///
For slave volumes, the mount must be set to either `shared` or + ///
`slave`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Binds")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Binds { get; set; } + + /// + /// Path to a file where the container ID is written + /// + + [System.Text.Json.Serialization.JsonPropertyName("ContainerIDFile")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ContainerIDFile { get; set; } + + /// + /// The logging configuration for this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("LogConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public LogConfig LogConfig { get; set; } + + /// + /// Network mode to use for this container. Supported standard values + ///
are: `bridge`, `host`, `none`, and `container:<name|id>`. Any + ///
other value is taken as a custom network's name to which this + ///
container should connect to. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NetworkMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NetworkMode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("PortBindings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public PortMap PortBindings { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("RestartPolicy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public RestartPolicy RestartPolicy { get; set; } + + /// + /// Automatically remove the container when the container's process + ///
exits. This has no effect if `RestartPolicy` is set. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AutoRemove")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AutoRemove { get; set; } + + /// + /// Driver that this container uses to mount volumes. + /// + + [System.Text.Json.Serialization.JsonPropertyName("VolumeDriver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string VolumeDriver { get; set; } + + /// + /// A list of volumes to inherit from another container, specified in + ///
the form `<container name>[:<ro|rw>]`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("VolumesFrom")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection VolumesFrom { get; set; } + + /// + /// Specification for mounts to be added to the container. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Mounts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Mounts { get; set; } + + /// + /// Initial console size, as an `[height, width]` array. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ConsoleSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.MinLength(2)] + [System.ComponentModel.DataAnnotations.MaxLength(2)] + public System.Collections.Generic.ICollection ConsoleSize { get; set; } + + /// + /// Arbitrary non-identifying metadata attached to container and + ///
provided to the runtime when the container is started. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Annotations")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Annotations { get; set; } + + /// + /// A list of kernel capabilities to add to the container. Conflicts + ///
with option 'Capabilities'. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CapAdd")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection CapAdd { get; set; } + + /// + /// A list of kernel capabilities to drop from the container. Conflicts + ///
with option 'Capabilities'. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CapDrop")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection CapDrop { get; set; } + + /// + /// cgroup namespace mode for the container. Possible values are: + ///
+ ///
- `"private"`: the container runs in its own private cgroup namespace + ///
- `"host"`: use the host system's cgroup namespace + ///
+ ///
If not specified, the daemon default is used, which can either be `"private"` + ///
or `"host"`, depending on daemon version, kernel support and configuration. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CgroupnsMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public HostConfigCgroupnsMode? CgroupnsMode { get; set; } + + /// + /// A list of DNS servers for the container to use. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Dns")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Dns { get; set; } + + /// + /// A list of DNS options. + /// + + [System.Text.Json.Serialization.JsonPropertyName("DnsOptions")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DnsOptions { get; set; } + + /// + /// A list of DNS search domains. + /// + + [System.Text.Json.Serialization.JsonPropertyName("DnsSearch")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DnsSearch { get; set; } + + /// + /// A list of hostnames/IP mappings to add to the container's `/etc/hosts` + ///
file. Specified in the form `["hostname:IP"]`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ExtraHosts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection ExtraHosts { get; set; } + + /// + /// A list of additional groups that the container process will run as. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GroupAdd")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection GroupAdd { get; set; } + + /// + /// IPC sharing mode for the container. Possible values are: + ///
+ ///
- `"none"`: own private IPC namespace, with /dev/shm not mounted + ///
- `"private"`: own private IPC namespace + ///
- `"shareable"`: own private IPC namespace, with a possibility to share it with other containers + ///
- `"container:<name|id>"`: join another (shareable) container's IPC namespace + ///
- `"host"`: use the host system's IPC namespace + ///
+ ///
If not specified, daemon default is used, which can either be `"private"` + ///
or `"shareable"`, depending on daemon version and configuration. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IpcMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IpcMode { get; set; } + + /// + /// Cgroup to use for the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Cgroup")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Cgroup { get; set; } + + /// + /// A list of links for the container in the form `container_name:alias`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Links")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Links { get; set; } + + /// + /// An integer value containing the score given to the container in + ///
order to tune OOM killer preferences. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OomScoreAdj")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? OomScoreAdj { get; set; } + + /// + /// Set the PID (Process) Namespace mode for the container. It can be + ///
either: + ///
+ ///
- `"container:<name|id>"`: joins another container's PID namespace + ///
- `"host"`: use the host's PID namespace inside the container + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("PidMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string PidMode { get; set; } + + /// + /// Gives the container full access to the host. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Privileged")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Privileged { get; set; } + + /// + /// Allocates an ephemeral host port for all of a container's + ///
exposed ports. + ///
+ ///
Ports are de-allocated when the container stops and allocated when + ///
the container starts. The allocated port might be changed when + ///
restarting the container. + ///
+ ///
The port is selected from the ephemeral port range that depends on + ///
the kernel. For example, on Linux the range is defined by + ///
`/proc/sys/net/ipv4/ip_local_port_range`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("PublishAllPorts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? PublishAllPorts { get; set; } + + /// + /// Mount the container's root filesystem as read only. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ReadonlyRootfs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? ReadonlyRootfs { get; set; } + + /// + /// A list of string values to customize labels for MLS systems, such + ///
as SELinux. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SecurityOpt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection SecurityOpt { get; set; } + + /// + /// Storage driver options for this container, in the form `{"size": "120G"}`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("StorageOpt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary StorageOpt { get; set; } + + /// + /// A map of container directories which should be replaced by tmpfs + ///
mounts, and their corresponding mount options. For example: + ///
+ ///
``` + ///
{ "/run": "rw,noexec,nosuid,size=65536k" } + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Tmpfs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Tmpfs { get; set; } + + /// + /// UTS namespace to use for the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("UTSMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UTSMode { get; set; } + + /// + /// Sets the usernamespace mode for the container when usernamespace + ///
remapping option is enabled. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("UsernsMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UsernsMode { get; set; } + + /// + /// Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ShmSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] + public long? ShmSize { get; set; } + + /// + /// A list of kernel parameters (sysctls) to set in the container. + ///
For example: + ///
+ ///
``` + ///
{"net.ipv4.ip_forward": "1"} + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Sysctls")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Sysctls { get; set; } + + /// + /// Runtime to use with this container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Runtime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Runtime { get; set; } + + /// + /// Isolation technology of the container. (Windows only) + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Isolation")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public HostConfigIsolation? Isolation { get; set; } + + /// + /// The list of paths to be masked inside the container (this overrides + ///
the default set of paths). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MaskedPaths")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection MaskedPaths { get; set; } + + /// + /// The list of paths to be set as read-only inside the container + ///
(this overrides the default set of paths). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ReadonlyPaths")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection ReadonlyPaths { get; set; } + + } + + /// + /// Configuration for a container that is portable between hosts. + ///
+ ///
When used as `ContainerConfig` field in an image, `ContainerConfig` is an + ///
optional field containing the configuration of the container that was last + ///
committed when creating the image. + ///
+ ///
Previous versions of Docker builder used this field to store build cache, + ///
and it is not in active use anymore. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerConfig + { + /// + /// The hostname to use for the container, as a valid RFC 1123 hostname. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Hostname")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Hostname { get; set; } + + /// + /// The domain name to use for the container. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Domainname")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Domainname { get; set; } + + /// + /// The user that commands are run as inside the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("User")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string User { get; set; } + + /// + /// Whether to attach to `stdin`. + /// + + [System.Text.Json.Serialization.JsonPropertyName("AttachStdin")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AttachStdin { get; set; } = false; + + /// + /// Whether to attach to `stdout`. + /// + + [System.Text.Json.Serialization.JsonPropertyName("AttachStdout")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AttachStdout { get; set; } = true; + + /// + /// Whether to attach to `stderr`. + /// + + [System.Text.Json.Serialization.JsonPropertyName("AttachStderr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AttachStderr { get; set; } = true; + + /// + /// An object mapping ports to an empty object in the form: + ///
+ ///
`{"<port>/<tcp|udp|sctp>": {}}` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ExposedPorts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary ExposedPorts { get; set; } + + /// + /// Attach standard streams to a TTY, including `stdin` if it is not closed. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Tty")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Tty { get; set; } = false; + + /// + /// Open `stdin` + /// + + [System.Text.Json.Serialization.JsonPropertyName("OpenStdin")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OpenStdin { get; set; } = false; + + /// + /// Close `stdin` after one attached client disconnects + /// + + [System.Text.Json.Serialization.JsonPropertyName("StdinOnce")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? StdinOnce { get; set; } = false; + + /// + /// A list of environment variables to set inside the container in the + ///
form `["VAR=value", ...]`. A variable without `=` is removed from the + ///
environment, rather than to have an empty value. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Env")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Env { get; set; } + + /// + /// Command to run specified as a string or an array of strings. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Cmd")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Cmd { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Healthcheck")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public HealthConfig Healthcheck { get; set; } + + /// + /// Command is already escaped (Windows only) + /// + + [System.Text.Json.Serialization.JsonPropertyName("ArgsEscaped")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? ArgsEscaped { get; set; } = false; + + /// + /// The name (or reference) of the image to use when creating the container, + ///
or which was used when the container was created. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Image")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Image { get; set; } + + /// + /// An object mapping mount point paths inside the container to empty + ///
objects. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Volumes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Volumes { get; set; } + + /// + /// The working directory for commands to run in. + /// + + [System.Text.Json.Serialization.JsonPropertyName("WorkingDir")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string WorkingDir { get; set; } + + /// + /// The entry point for the container as a string or an array of strings. + ///
+ ///
If the array consists of exactly one empty string (`[""]`) then the + ///
entry point is reset to system default (i.e., the entry point used by + ///
docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Entrypoint")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Entrypoint { get; set; } + + /// + /// Disable networking for the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NetworkDisabled")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? NetworkDisabled { get; set; } + + /// + /// MAC address of the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("MacAddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string MacAddress { get; set; } + + /// + /// `ONBUILD` metadata that were defined in the image's `Dockerfile`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OnBuild")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection OnBuild { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// Signal to stop a container as a string or unsigned integer. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("StopSignal")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string StopSignal { get; set; } + + /// + /// Timeout to stop a container in seconds. + /// + + [System.Text.Json.Serialization.JsonPropertyName("StopTimeout")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? StopTimeout { get; set; } = 10; + + /// + /// Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Shell")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Shell { get; set; } + + } + + /// + /// NetworkingConfig represents the container's networking configuration for + ///
each of its interfaces. + ///
It is used for the networking configs specified in the `docker create` + ///
and `docker network connect` commands. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkingConfig + { + /// + /// A mapping of network name to endpoint configuration for that network. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("EndpointsConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary EndpointsConfig { get; set; } + + } + + /// + /// NetworkSettings exposes the network settings in the API + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkSettings + { + /// + /// Name of the network's bridge (for example, `docker0`). + /// + + [System.Text.Json.Serialization.JsonPropertyName("Bridge")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Bridge { get; set; } + + /// + /// SandboxID uniquely represents a container's network stack. + /// + + [System.Text.Json.Serialization.JsonPropertyName("SandboxID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SandboxID { get; set; } + + /// + /// Indicates if hairpin NAT should be enabled on the virtual interface. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("HairpinMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? HairpinMode { get; set; } + + /// + /// IPv6 unicast address using the link-local prefix. + /// + + [System.Text.Json.Serialization.JsonPropertyName("LinkLocalIPv6Address")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string LinkLocalIPv6Address { get; set; } + + /// + /// Prefix length of the IPv6 unicast address. + /// + + [System.Text.Json.Serialization.JsonPropertyName("LinkLocalIPv6PrefixLen")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? LinkLocalIPv6PrefixLen { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Ports")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public PortMap Ports { get; set; } + + /// + /// SandboxKey identifies the sandbox + /// + + [System.Text.Json.Serialization.JsonPropertyName("SandboxKey")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SandboxKey { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("SecondaryIPAddresses")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection
SecondaryIPAddresses { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("SecondaryIPv6Addresses")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection
SecondaryIPv6Addresses { get; set; } + + /// + /// EndpointID uniquely represents a service endpoint in a Sandbox. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("EndpointID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string EndpointID { get; set; } + + /// + /// Gateway address for the default "bridge" network. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Gateway")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Gateway { get; set; } + + /// + /// Global IPv6 address for the default "bridge" network. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GlobalIPv6Address")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string GlobalIPv6Address { get; set; } + + /// + /// Mask length of the global IPv6 address. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GlobalIPv6PrefixLen")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? GlobalIPv6PrefixLen { get; set; } + + /// + /// IPv4 address for the default "bridge" network. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IPAddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPAddress { get; set; } + + /// + /// Mask length of the IPv4 address. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IPPrefixLen")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? IPPrefixLen { get; set; } + + /// + /// IPv6 gateway address for this network. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IPv6Gateway")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPv6Gateway { get; set; } + + /// + /// MAC address for the container on the default "bridge" network. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Deprecated**: This field is only propagated when attached to the + ///
> default "bridge" network. Use the information from the "bridge" + ///
> network inside the `Networks` map instead, which contains the same + ///
> information. This field was deprecated in Docker 1.9 and is scheduled + ///
> to be removed in Docker 17.12.0 + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MacAddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string MacAddress { get; set; } + + /// + /// Information about all networks that the container is connected to. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Networks")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Networks { get; set; } + + } + + /// + /// Address represents an IPv4 or IPv6 IP address. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Address + { + /// + /// IP address. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Addr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Addr { get; set; } + + /// + /// Mask length of the IP address. + /// + + [System.Text.Json.Serialization.JsonPropertyName("PrefixLen")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? PrefixLen { get; set; } + + } + + /// + /// PortMap describes the mapping of container ports to host ports, using the + ///
container's port-number and protocol as key in the format `<port>/<protocol>`, + ///
for example, `80/udp`. + ///
+ ///
If a container's port is mapped for multiple protocols, separate entries + ///
are added to the mapping table. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PortMap : System.Collections.Generic.Dictionary> + { + + } + + /// + /// PortBinding represents a binding between a host IP address and a host + ///
port. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PortBinding + { + /// + /// Host IP address that the container's port is mapped to. + /// + + [System.Text.Json.Serialization.JsonPropertyName("HostIp")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string HostIp { get; set; } + + /// + /// Host port number that the container's port is mapped to. + /// + + [System.Text.Json.Serialization.JsonPropertyName("HostPort")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string HostPort { get; set; } + + } + + /// + /// Information about the storage driver used to store the container's and + ///
image's filesystem. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class GraphDriverData + { + /// + /// Name of the storage driver. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// Low-level storage metadata, provided as key/value pairs. + ///
+ ///
This information is driver-specific, and depends on the storage-driver + ///
in use, and should be used for informational purposes only. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Data")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.IDictionary Data { get; } = new System.Collections.Generic.Dictionary(); + + } + + /// + /// Change in the container's filesystem. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FilesystemChange + { + /// + /// Path to file or directory that has changed. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Path")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Path { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Kind")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public ChangeType Kind { get; set; } + + } + + /// + /// Kind of change + ///
+ ///
Can be one of: + ///
+ ///
- `0`: Modified ("C") + ///
- `1`: Added ("A") + ///
- `2`: Deleted ("D") + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ChangeType + { + + _0 = 0, + + _1 = 1, + + _2 = 2, + + } + + /// + /// Information about an image in the local image cache. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ImageInspect + { + /// + /// ID is the content-addressable ID of an image. + ///
+ ///
This identifier is a content-addressable digest calculated from the + ///
image's configuration (which includes the digests of layers used by + ///
the image). + ///
+ ///
Note that this digest differs from the `RepoDigests` below, which + ///
holds digests of image manifests that reference the image. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + /// + /// List of image names/tags in the local image cache that reference this + ///
image. + ///
+ ///
Multiple image tags can refer to the same image, and this list may be + ///
empty if no tags reference the image, in which case the image is + ///
"untagged", in which case it can still be referenced by its ID. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RepoTags")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection RepoTags { get; set; } + + /// + /// List of content-addressable digests of locally available image manifests + ///
that the image is referenced from. Multiple manifests can refer to the + ///
same image. + ///
+ ///
These digests are usually only available if the image was either pulled + ///
from a registry, or if the image was pushed to a registry, which is when + ///
the manifest is generated and its digest calculated. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RepoDigests")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection RepoDigests { get; set; } + + /// + /// ID of the parent image. + ///
+ ///
Depending on how the image was created, this field may be empty and + ///
is only set for images that were built/created locally. This field + ///
is empty if the image was pulled from an image registry. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Parent")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Parent { get; set; } + + /// + /// Optional message that was set when committing or importing the image. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Comment")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Comment { get; set; } + + /// + /// Date and time at which the image was created, formatted in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Created")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Created { get; set; } + + /// + /// The ID of the container that was used to create the image. + ///
+ ///
Depending on how the image was created, this field may be empty. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Container")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Container { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ContainerConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ContainerConfig ContainerConfig { get; set; } + + /// + /// The version of Docker that was used to build the image. + ///
+ ///
Depending on how the image was created, this field may be empty. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DockerVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DockerVersion { get; set; } + + /// + /// Name of the author that was specified when committing the image, or as + ///
specified through MAINTAINER (deprecated) in the Dockerfile. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Author")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Author { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Config")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ContainerConfig Config { get; set; } + + /// + /// Hardware CPU architecture that the image runs on. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Architecture")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Architecture { get; set; } + + /// + /// CPU architecture variant (presently ARM-only). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Variant")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Variant { get; set; } + + /// + /// Operating System the image is built to run on. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Os")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Os { get; set; } + + /// + /// Operating System version the image is built to run on (especially + ///
for Windows). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OsVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string OsVersion { get; set; } + + /// + /// Total size of the image including all layers it is composed of. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Size")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Size { get; set; } + + /// + /// Total size of the image including all layers it is composed of. + ///
+ ///
In versions of Docker before v1.10, this field was calculated from + ///
the image itself and all of its parent images. Images are now stored + ///
self-contained, and no longer use a parent-chain, making this field + ///
an equivalent of the Size field. + ///
+ ///
> **Deprecated**: this field is kept for backward compatibility, but + ///
> will be removed in API v1.44. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("VirtualSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? VirtualSize { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("GraphDriver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public GraphDriverData GraphDriver { get; set; } + + /// + /// Information about the image's RootFS, including the layer IDs. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RootFS")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public RootFS RootFS { get; set; } + + /// + /// Additional metadata of the image in the local cache. This information + ///
is local to the daemon, and not part of the image itself. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Metadata")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Metadata Metadata { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ImageSummary + { + /// + /// ID is the content-addressable ID of an image. + ///
+ ///
This identifier is a content-addressable digest calculated from the + ///
image's configuration (which includes the digests of layers used by + ///
the image). + ///
+ ///
Note that this digest differs from the `RepoDigests` below, which + ///
holds digests of image manifests that reference the image. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + /// + /// ID of the parent image. + ///
+ ///
Depending on how the image was created, this field may be empty and + ///
is only set for images that were built/created locally. This field + ///
is empty if the image was pulled from an image registry. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ParentId")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string ParentId { get; set; } + + /// + /// List of image names/tags in the local image cache that reference this + ///
image. + ///
+ ///
Multiple image tags can refer to the same image, and this list may be + ///
empty if no tags reference the image, in which case the image is + ///
"untagged", in which case it can still be referenced by its ID. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RepoTags")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection RepoTags { get; } = new System.Collections.ObjectModel.Collection(); + + /// + /// List of content-addressable digests of locally available image manifests + ///
that the image is referenced from. Multiple manifests can refer to the + ///
same image. + ///
+ ///
These digests are usually only available if the image was either pulled + ///
from a registry, or if the image was pushed to a registry, which is when + ///
the manifest is generated and its digest calculated. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RepoDigests")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection RepoDigests { get; } = new System.Collections.ObjectModel.Collection(); + + /// + /// Date and time at which the image was created as a Unix timestamp + ///
(number of seconds sinds EPOCH). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Created")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public int Created { get; set; } + + /// + /// Total size of the image including all layers it is composed of. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Size")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public long Size { get; set; } + + /// + /// Total size of image layers that are shared between this image and other + ///
images. + ///
+ ///
This size is not calculated by default. `-1` indicates that the value + ///
has not been set / calculated. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SharedSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public long SharedSize { get; set; } + + /// + /// Total size of the image including all layers it is composed of. + ///
+ ///
In versions of Docker before v1.10, this field was calculated from + ///
the image itself and all of its parent images. Images are now stored + ///
self-contained, and no longer use a parent-chain, making this field + ///
an equivalent of the Size field. + ///
+ ///
Deprecated: this field is kept for backward compatibility, and will be removed in API v1.44. + ///
+ + [System.Text.Json.Serialization.JsonPropertyName("VirtualSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? VirtualSize { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.IDictionary Labels { get; } = new System.Collections.Generic.Dictionary(); + + /// + /// Number of containers using this image. Includes both stopped and running + ///
containers. + ///
+ ///
This size is not calculated by default, and depends on which API endpoint + ///
is used. `-1` indicates that the value has not been set / calculated. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Containers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public int Containers { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AuthConfig + { + + [System.Text.Json.Serialization.JsonPropertyName("username")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Username { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("password")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Password { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("email")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Email { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("serveraddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Serveraddress { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ProcessConfig + { + + [System.Text.Json.Serialization.JsonPropertyName("privileged")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Privileged { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("user")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string User { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("tty")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Tty { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("entrypoint")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Entrypoint { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("arguments")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Arguments { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Volume + { + /// + /// Name of the volume. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// Name of the volume driver used by the volume. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Driver { get; set; } + + /// + /// Mount path of the volume on the host. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Mountpoint")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Mountpoint { get; set; } + + /// + /// Date/Time the volume was created. + /// + + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + /// + /// Low-level details about the volume, provided by the volume driver. + ///
Details are returned as a map with key/value pairs: + ///
`{"key":"value","key2":"value2"}`. + ///
+ ///
The `Status` field is optional, and is omitted if the volume driver + ///
does not support this feature. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Status { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.IDictionary Labels { get; } = new System.Collections.Generic.Dictionary(); + + /// + /// The level at which the volume exists. Either `global` for cluster-wide, + ///
or `local` for machine level. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Scope")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public VolumeScope Scope { get; set; } = DockerEngine.VolumeScope.Local; + + [System.Text.Json.Serialization.JsonPropertyName("ClusterVolume")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ClusterVolume ClusterVolume { get; set; } + + /// + /// The driver specific options used when creating the volume. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.IDictionary Options { get; } = new System.Collections.Generic.Dictionary(); + + /// + /// Usage details about the volume. This information is used by the + ///
`GET /system/df` endpoint, and omitted in other endpoints. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("UsageData")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public UsageData UsageData { get; set; } + + } + + /// + /// Volume configuration + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class VolumeCreateOptions + { + /// + /// The new volume's name. If not specified, Docker generates a name. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// Name of the volume driver to use. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } = "local"; + + /// + /// A mapping of driver options and values. These options are + ///
passed directly to the driver and are driver specific. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DriverOpts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary DriverOpts { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ClusterVolumeSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ClusterVolumeSpec ClusterVolumeSpec { get; set; } + + } + + /// + /// Volume list response + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class VolumeListResponse + { + /// + /// List of volumes + /// + + [System.Text.Json.Serialization.JsonPropertyName("Volumes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Volumes { get; set; } + + /// + /// Warnings that occurred when fetching the list of volumes. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Warnings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Warnings { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Network + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Created")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Created { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Scope")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Scope { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("EnableIPv6")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? EnableIPv6 { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("IPAM")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public IPAM IPAM { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Internal")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Internal { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Attachable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Attachable { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Ingress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Ingress { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Containers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Containers { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class IPAM + { + /// + /// Name of the IPAM driver to use. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } = "default"; + + /// + /// List of IPAM configuration options, specified as a map: + ///
+ ///
``` + ///
{"Subnet": <CIDR>, "IPRange": <CIDR>, "Gateway": <IP address>, "AuxAddress": <device_name:IP address>} + ///
``` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Config")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Config { get; set; } + + /// + /// Driver-specific options, specified as a map. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class IPAMConfig + { + + [System.Text.Json.Serialization.JsonPropertyName("Subnet")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Subnet { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("IPRange")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPRange { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Gateway")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Gateway { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("AuxiliaryAddresses")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary AuxiliaryAddresses { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkContainer + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("EndpointID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string EndpointID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("MacAddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string MacAddress { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("IPv4Address")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPv4Address { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("IPv6Address")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPv6Address { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class BuildInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("stream")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Stream { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("error")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Error { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("errorDetail")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ErrorDetail ErrorDetail { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("progress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Progress { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("progressDetail")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ProgressDetail ProgressDetail { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("aux")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ImageID Aux { get; set; } + + } + + /// + /// BuildCache contains information about a build cache record. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class BuildCache + { + /// + /// Unique ID of the build cache record. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + /// + /// ID of the parent build cache record. + ///
+ ///
> **Deprecated**: This field is deprecated, and omitted if empty. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Parent")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Parent { get; set; } + + /// + /// List of parent build cache record IDs. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Parents")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Parents { get; set; } + + /// + /// Cache record type. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public BuildCacheType? Type { get; set; } + + /// + /// Description of the build-step that produced the build cache. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Description { get; set; } + + /// + /// Indicates if the build cache is in use. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("InUse")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? InUse { get; set; } + + /// + /// Indicates if the build cache is shared. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Shared")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Shared { get; set; } + + /// + /// Amount of disk space used by the build cache (in bytes). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Size")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Size { get; set; } + + /// + /// Date and time at which the build cache was created in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + /// + /// Date and time at which the build cache was last used in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LastUsedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string LastUsedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("UsageCount")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? UsageCount { get; set; } + + } + + /// + /// Image ID or Digest + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ImageID + { + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CreateImageInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("error")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Error { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("errorDetail")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ErrorDetail ErrorDetail { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("progress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Progress { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("progressDetail")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ProgressDetail ProgressDetail { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PushImageInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("error")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Error { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("progress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Progress { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("progressDetail")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ProgressDetail ProgressDetail { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ErrorDetail + { + + [System.Text.Json.Serialization.JsonPropertyName("code")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Code { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("message")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Message { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ProgressDetail + { + + [System.Text.Json.Serialization.JsonPropertyName("current")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Current { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("total")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Total { get; set; } + + } + + /// + /// Represents an error. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ErrorResponse + { + /// + /// The error message. + /// + + [System.Text.Json.Serialization.JsonPropertyName("message")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Message { get; set; } + + } + + /// + /// Response to an API call that returns just an Id + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class IdResponse + { + /// + /// The id of the newly created object. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + } + + /// + /// Configuration for a network endpoint. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EndpointSettings + { + + [System.Text.Json.Serialization.JsonPropertyName("IPAMConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public EndpointIPAMConfig IPAMConfig { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Links")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Links { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Aliases")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Aliases { get; set; } + + /// + /// Unique ID of the network. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NetworkID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NetworkID { get; set; } + + /// + /// Unique ID for the service endpoint in a Sandbox. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("EndpointID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string EndpointID { get; set; } + + /// + /// Gateway address for this network. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Gateway")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Gateway { get; set; } + + /// + /// IPv4 address. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IPAddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPAddress { get; set; } + + /// + /// Mask length of the IPv4 address. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IPPrefixLen")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? IPPrefixLen { get; set; } + + /// + /// IPv6 gateway address. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IPv6Gateway")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPv6Gateway { get; set; } + + /// + /// Global IPv6 address. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GlobalIPv6Address")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string GlobalIPv6Address { get; set; } + + /// + /// Mask length of the global IPv6 address. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GlobalIPv6PrefixLen")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? GlobalIPv6PrefixLen { get; set; } + + /// + /// MAC address for the endpoint on this network. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MacAddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string MacAddress { get; set; } + + /// + /// DriverOpts is a mapping of driver options and values. These options + ///
are passed directly to the driver and are driver specific. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DriverOpts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary DriverOpts { get; set; } + + } + + /// + /// EndpointIPAMConfig represents an endpoint's IPAM configuration. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EndpointIPAMConfig + { + + [System.Text.Json.Serialization.JsonPropertyName("IPv4Address")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPv4Address { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("IPv6Address")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IPv6Address { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("LinkLocalIPs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection LinkLocalIPs { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PluginMount + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Settable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Settable { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Source")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Source { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Destination")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Destination { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Options { get; } = new System.Collections.ObjectModel.Collection(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PluginDevice + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Settable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Settable { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Path")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Path { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PluginEnv + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Settable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Settable { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Value")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Value { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PluginInterfaceType + { + + [System.Text.Json.Serialization.JsonPropertyName("Prefix")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Prefix { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Capability")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Capability { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Version { get; set; } + + } + + /// + /// Describes a permission the user has to accept upon installing + ///
the plugin. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PluginPrivilege + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Value")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Value { get; set; } + + } + + /// + /// A plugin for the Engine API + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Plugin + { + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// True if the plugin is running. False if the plugin is not running, only installed. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Enabled")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public bool Enabled { get; set; } + + /// + /// Settings that can be modified by users. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Settings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public Settings Settings { get; set; } = new Settings(); + + /// + /// plugin remote reference used to push/pull the plugin + /// + + [System.Text.Json.Serialization.JsonPropertyName("PluginReference")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string PluginReference { get; set; } + + /// + /// The config of a plugin. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Config")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public Config2 Config { get; set; } = new Config2(); + + } + + /// + /// The version number of the object such as node, service, etc. This is needed + ///
to avoid conflicting writes. The client must send the version number along + ///
with the modified specification when updating these objects. + ///
+ ///
This approach ensures safe concurrency and determinism in that the change + ///
on the object may not be applied if the version number has changed from the + ///
last read. In other words, if two update requests specify the same base + ///
version, only one of the requests can succeed. As a result, two separate + ///
update requests that happen at the same time will not unintentionally + ///
overwrite each other. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ObjectVersion + { + + [System.Text.Json.Serialization.JsonPropertyName("Index")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Index { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NodeSpec + { + /// + /// Name for the node. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// Role of the node. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Role")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public NodeSpecRole? Role { get; set; } + + /// + /// Availability of the node. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Availability")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public NodeSpecAvailability? Availability { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Node + { + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion Version { get; set; } + + /// + /// Date and time at which the node was added to the swarm in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + /// + /// Date and time at which the node was last updated in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("UpdatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NodeSpec Spec { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NodeDescription Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NodeStatus Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ManagerStatus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ManagerStatus ManagerStatus { get; set; } + + } + + /// + /// NodeDescription encapsulates the properties of the Node as reported by the + ///
agent. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NodeDescription + { + + [System.Text.Json.Serialization.JsonPropertyName("Hostname")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Hostname { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Platform")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Platform Platform { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Resources")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ResourceObject Resources { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Engine")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public EngineDescription Engine { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("TLSInfo")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public TLSInfo TLSInfo { get; set; } + + } + + /// + /// Platform represents the platform (Arch/OS). + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Platform + { + /// + /// Architecture represents the hardware architecture (for example, + ///
`x86_64`). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Architecture")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Architecture { get; set; } + + /// + /// OS represents the Operating System (for example, `linux` or `windows`). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OS")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string OS { get; set; } + + } + + /// + /// EngineDescription provides information about an engine. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EngineDescription + { + + [System.Text.Json.Serialization.JsonPropertyName("EngineVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string EngineVersion { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Plugins")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Plugins { get; set; } + + } + + /// + /// Information about the issuer of leaf TLS certificates and the trusted root + ///
CA certificate. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TLSInfo + { + /// + /// The root CA certificate(s) that are used to validate leaf TLS + ///
certificates. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("TrustRoot")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string TrustRoot { get; set; } + + /// + /// The base64-url-safe-encoded raw subject bytes of the issuer. + /// + + [System.Text.Json.Serialization.JsonPropertyName("CertIssuerSubject")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CertIssuerSubject { get; set; } + + /// + /// The base64-url-safe-encoded raw public key bytes of the issuer. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CertIssuerPublicKey")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CertIssuerPublicKey { get; set; } + + } + + /// + /// NodeStatus represents the status of a node. + ///
+ ///
It provides the current status of the node, as seen by the manager. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NodeStatus + { + + [System.Text.Json.Serialization.JsonPropertyName("State")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public NodeState? State { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Message")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Message { get; set; } + + /// + /// IP address of the node. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Addr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Addr { get; set; } + + } + + /// + /// NodeState represents the state of a node. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum NodeState + { + + [System.Runtime.Serialization.EnumMember(Value = @"unknown")] + Unknown = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"down")] + Down = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"ready")] + Ready = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"disconnected")] + Disconnected = 3, + + } + + /// + /// ManagerStatus represents the status of a manager. + ///
+ ///
It provides the current status of a node's manager component, if the node + ///
is a manager. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ManagerStatus + { + + [System.Text.Json.Serialization.JsonPropertyName("Leader")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Leader { get; set; } = false; + + [System.Text.Json.Serialization.JsonPropertyName("Reachability")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public Reachability? Reachability { get; set; } + + /// + /// The IP address and port at which the manager is reachable. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Addr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Addr { get; set; } + + } + + /// + /// Reachability represents the reachability of a node. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Reachability + { + + [System.Runtime.Serialization.EnumMember(Value = @"unknown")] + Unknown = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"unreachable")] + Unreachable = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"reachable")] + Reachable = 2, + + } + + /// + /// User modifiable swarm configuration. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SwarmSpec + { + /// + /// Name of the swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// Orchestration configuration. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Orchestration")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Orchestration Orchestration { get; set; } + + /// + /// Raft configuration. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Raft")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Raft Raft { get; set; } + + /// + /// Dispatcher configuration. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Dispatcher")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Dispatcher Dispatcher { get; set; } + + /// + /// CA configuration. + /// + + [System.Text.Json.Serialization.JsonPropertyName("CAConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public CAConfig CAConfig { get; set; } + + /// + /// Parameters related to encryption-at-rest. + /// + + [System.Text.Json.Serialization.JsonPropertyName("EncryptionConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public EncryptionConfig EncryptionConfig { get; set; } + + /// + /// Defaults for creating tasks in this cluster. + /// + + [System.Text.Json.Serialization.JsonPropertyName("TaskDefaults")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public TaskDefaults TaskDefaults { get; set; } + + } + + /// + /// ClusterInfo represents information about the swarm as is returned by the + ///
"/info" endpoint. Join-tokens are not included. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ClusterInfo + { + /// + /// The ID of the swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion Version { get; set; } + + /// + /// Date and time at which the swarm was initialised in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + /// + /// Date and time at which the swarm was last updated in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("UpdatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public SwarmSpec Spec { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("TLSInfo")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public TLSInfo TLSInfo { get; set; } + + /// + /// Whether there is currently a root CA rotation in progress for the swarm + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RootRotationInProgress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? RootRotationInProgress { get; set; } + + /// + /// DataPathPort specifies the data path port number for data traffic. + ///
Acceptable port range is 1024 to 49151. + ///
If no port is set or is set to 0, the default port (4789) is used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DataPathPort")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? DataPathPort { get; set; } = 4789; + + /// + /// Default Address Pool specifies default subnet pools for global scope + ///
networks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DefaultAddrPool")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DefaultAddrPool { get; set; } + + /// + /// SubnetSize specifies the subnet size of the networks created from the + ///
default subnet pool. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SubnetSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.Range(double.MinValue, 29D)] + public int? SubnetSize { get; set; } = 24; + + } + + /// + /// JoinTokens contains the tokens workers and managers need to join the swarm. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class JoinTokens + { + /// + /// The token workers can use to join the swarm. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Worker")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Worker { get; set; } + + /// + /// The token managers can use to join the swarm. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Manager")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Manager { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Swarm : ClusterInfo + { + + [System.Text.Json.Serialization.JsonPropertyName("JoinTokens")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public JoinTokens JoinTokens { get; set; } + + } + + /// + /// User modifiable task configuration. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskSpec + { + /// + /// Plugin spec for the service. *(Experimental release only.)* + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + ///
> mutually exclusive. PluginSpec is only used when the Runtime field + ///
> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + ///
> field is set to `attachment`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("PluginSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public PluginSpec PluginSpec { get; set; } + + /// + /// Container spec for the service. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + ///
> mutually exclusive. PluginSpec is only used when the Runtime field + ///
> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + ///
> field is set to `attachment`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ContainerSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ContainerSpec ContainerSpec { get; set; } + + /// + /// Read-only spec type for non-swarm containers attached to swarm overlay + ///
networks. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are + ///
> mutually exclusive. PluginSpec is only used when the Runtime field + ///
> is set to `plugin`. NetworkAttachmentSpec is used when the Runtime + ///
> field is set to `attachment`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NetworkAttachmentSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NetworkAttachmentSpec NetworkAttachmentSpec { get; set; } + + /// + /// Resource requirements which apply to each individual container created + ///
as part of the service. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Resources")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Resources2 Resources { get; set; } + + /// + /// Specification for the restart policy which applies to containers + ///
created as part of this service. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RestartPolicy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public RestartPolicy2 RestartPolicy { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Placement")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Placement Placement { get; set; } + + /// + /// A counter that triggers an update even if no relevant parameters have + ///
been changed. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ForceUpdate")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ForceUpdate { get; set; } + + /// + /// Runtime is the type of runtime specified for the task executor. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Runtime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Runtime { get; set; } + + /// + /// Specifies which networks the service should attach to. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Networks")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Networks { get; set; } + + /// + /// Specifies the log driver to use for tasks created from this spec. If + ///
not present, the default one for the swarm will be used, finally + ///
falling back to the engine default if not specified. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LogDriver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public LogDriver LogDriver { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum TaskState + { + + [System.Runtime.Serialization.EnumMember(Value = @"new")] + New = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"allocated")] + Allocated = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"pending")] + Pending = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"assigned")] + Assigned = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"accepted")] + Accepted = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"preparing")] + Preparing = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"ready")] + Ready = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"starting")] + Starting = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"running")] + Running = 8, + + [System.Runtime.Serialization.EnumMember(Value = @"complete")] + Complete = 9, + + [System.Runtime.Serialization.EnumMember(Value = @"shutdown")] + Shutdown = 10, + + [System.Runtime.Serialization.EnumMember(Value = @"failed")] + Failed = 11, + + [System.Runtime.Serialization.EnumMember(Value = @"rejected")] + Rejected = 12, + + [System.Runtime.Serialization.EnumMember(Value = @"remove")] + Remove = 13, + + [System.Runtime.Serialization.EnumMember(Value = @"orphaned")] + Orphaned = 14, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Task + { + /// + /// The ID of the task. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion Version { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("UpdatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UpdatedAt { get; set; } + + /// + /// Name of the task. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public TaskSpec Spec { get; set; } + + /// + /// The ID of the service this task is part of. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ServiceID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ServiceID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Slot")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Slot { get; set; } + + /// + /// The ID of the node that this task is on. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NodeID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NodeID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("AssignedGenericResources")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public GenericResources AssignedGenericResources { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Status Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("DesiredState")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public TaskState? DesiredState { get; set; } + + /// + /// If the Service this Task belongs to is a job-mode service, contains + ///
the JobIteration of the Service this Task was created for. Absent if + ///
the Task was created for a Replicated or Global Service. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("JobIteration")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion JobIteration { get; set; } + + } + + /// + /// User modifiable configuration for a service. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ServiceSpec + { + /// + /// Name of the service. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("TaskTemplate")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public TaskSpec TaskTemplate { get; set; } + + /// + /// Scheduling mode for the service. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Mode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Mode Mode { get; set; } + + /// + /// Specification for the update strategy of the service. + /// + + [System.Text.Json.Serialization.JsonPropertyName("UpdateConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public UpdateConfig UpdateConfig { get; set; } + + /// + /// Specification for the rollback strategy of the service. + /// + + [System.Text.Json.Serialization.JsonPropertyName("RollbackConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public RollbackConfig RollbackConfig { get; set; } + + /// + /// Specifies which networks the service should attach to. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Networks")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Networks { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("EndpointSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public EndpointSpec EndpointSpec { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EndpointPortConfig + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Protocol")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EndpointPortConfigProtocol? Protocol { get; set; } + + /// + /// The port inside the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("TargetPort")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? TargetPort { get; set; } + + /// + /// The port on the swarm hosts. + /// + + [System.Text.Json.Serialization.JsonPropertyName("PublishedPort")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? PublishedPort { get; set; } + + /// + /// The mode in which port is published. + ///
+ ///
<p><br /></p> + ///
+ ///
- "ingress" makes the target port accessible on every node, + ///
regardless of whether there is a task for the service running on + ///
that node or not. + ///
- "host" bypasses the routing mesh and publish the port directly on + ///
the swarm node where that service is running. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("PublishMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EndpointPortConfigPublishMode? PublishMode { get; set; } = DockerEngine.EndpointPortConfigPublishMode.Ingress; + + } + + /// + /// Properties that can be configured to access and load balance a service. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EndpointSpec + { + /// + /// The mode of resolution to use for internal load balancing between tasks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Mode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EndpointSpecMode? Mode { get; set; } = DockerEngine.EndpointSpecMode.Vip; + + /// + /// List of exposed ports that this service is accessible on from the + ///
outside. Ports can only be provided if `vip` resolution mode is used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Ports")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Ports { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Service + { + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion Version { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("UpdatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ServiceSpec Spec { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Endpoint")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Endpoint Endpoint { get; set; } + + /// + /// The status of a service update. + /// + + [System.Text.Json.Serialization.JsonPropertyName("UpdateStatus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public UpdateStatus UpdateStatus { get; set; } + + /// + /// The status of the service's tasks. Provided only when requested as + ///
part of a ServiceList operation. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ServiceStatus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ServiceStatus ServiceStatus { get; set; } + + /// + /// The status of the service when it is in one of ReplicatedJob or + ///
GlobalJob modes. Absent on Replicated and Global mode services. The + ///
JobIteration is an ObjectVersion, but unlike the Service's version, + ///
does not need to be sent with an update request. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("JobStatus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public JobStatus JobStatus { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ImageDeleteResponseItem + { + /// + /// The image ID of an image that was untagged + /// + + [System.Text.Json.Serialization.JsonPropertyName("Untagged")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Untagged { get; set; } + + /// + /// The image ID of an image that was deleted + /// + + [System.Text.Json.Serialization.JsonPropertyName("Deleted")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Deleted { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ServiceUpdateResponse + { + /// + /// Optional warning messages + /// + + [System.Text.Json.Serialization.JsonPropertyName("Warnings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Warnings { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerSummary + { + /// + /// The ID of this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + /// + /// The names that this container has been given + /// + + [System.Text.Json.Serialization.JsonPropertyName("Names")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Names { get; set; } + + /// + /// The name of the image used when creating this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Image")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Image { get; set; } + + /// + /// The ID of the image that this container was created from + /// + + [System.Text.Json.Serialization.JsonPropertyName("ImageID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ImageID { get; set; } + + /// + /// Command to run when starting the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Command")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Command { get; set; } + + /// + /// When the container was created + /// + + [System.Text.Json.Serialization.JsonPropertyName("Created")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Created { get; set; } + + /// + /// The ports exposed by this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Ports")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Ports { get; set; } + + /// + /// The size of files that have been created or changed by this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("SizeRw")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SizeRw { get; set; } + + /// + /// The total size of all the files in this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("SizeRootFs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SizeRootFs { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// The state of this container (e.g. `Exited`) + /// + + [System.Text.Json.Serialization.JsonPropertyName("State")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string State { get; set; } + + /// + /// Additional human-readable status of this container (e.g. `Exit 0`) + /// + + [System.Text.Json.Serialization.JsonPropertyName("Status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Status { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("HostConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public HostConfig2 HostConfig { get; set; } + + /// + /// A summary of the container's network settings + /// + + [System.Text.Json.Serialization.JsonPropertyName("NetworkSettings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NetworkSettings2 NetworkSettings { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Mounts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Mounts { get; set; } + + } + + /// + /// Driver represents a driver (network, logging, secrets). + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Driver + { + /// + /// Name of the driver. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// Key/value map of driver-specific options. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SecretSpec + { + /// + /// User-defined name of the secret. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) + ///
data to store as secret. + ///
+ ///
This field is only used to _create_ a secret, and is not returned by + ///
other endpoints. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Data")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Data { get; set; } + + /// + /// Name of the secrets driver used to fetch the secret's value from an + ///
external secret store. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Driver Driver { get; set; } + + /// + /// Templating driver, if applicable + ///
+ ///
Templating controls whether and how to evaluate the config payload as + ///
a template. If no driver is set, no templating is used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Templating")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Driver Templating { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Secret + { + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion Version { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("UpdatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public SecretSpec Spec { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ConfigSpec + { + /// + /// User-defined name of the config. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// Base64-url-safe-encoded ([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) + ///
config data. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Data")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Data { get; set; } + + /// + /// Templating driver, if applicable + ///
+ ///
Templating controls whether and how to evaluate the config payload as + ///
a template. If no driver is set, no templating is used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Templating")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Driver Templating { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Config + { + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion Version { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("UpdatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ConfigSpec Spec { get; set; } + + } + + /// + /// ContainerState stores container's running state. It's part of ContainerJSONBase + ///
and will be returned by the "inspect" command. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerState + { + /// + /// String representation of the container state. Can be one of "created", + ///
"running", "paused", "restarting", "removing", "exited", or "dead". + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ContainerStateStatus? Status { get; set; } + + /// + /// Whether this container is running. + ///
+ ///
Note that a running container can be _paused_. The `Running` and `Paused` + ///
booleans are not mutually exclusive: + ///
+ ///
When pausing a container (on Linux), the freezer cgroup is used to suspend + ///
all processes in the container. Freezing the process requires the process to + ///
be running. As a result, paused containers are both `Running` _and_ `Paused`. + ///
+ ///
Use the `Status` field instead to determine if a container's state is "running". + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Running")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Running { get; set; } + + /// + /// Whether this container is paused. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Paused")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Paused { get; set; } + + /// + /// Whether this container is restarting. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Restarting")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Restarting { get; set; } + + /// + /// Whether a process within this container has been killed because it ran + ///
out of memory since the container was last started. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OOMKilled")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OOMKilled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Dead")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Dead { get; set; } + + /// + /// The process ID of this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Pid")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Pid { get; set; } + + /// + /// The last exit code of this container + /// + + [System.Text.Json.Serialization.JsonPropertyName("ExitCode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ExitCode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Error")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Error { get; set; } + + /// + /// The time when this container was last started. + /// + + [System.Text.Json.Serialization.JsonPropertyName("StartedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string StartedAt { get; set; } + + /// + /// The time when this container last exited. + /// + + [System.Text.Json.Serialization.JsonPropertyName("FinishedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string FinishedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Health")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Health Health { get; set; } + + } + + /// + /// OK response to ContainerCreate operation + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerCreateResponse + { + /// + /// The ID of the created container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + /// + /// Warnings encountered when creating the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Warnings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Warnings { get; } = new System.Collections.ObjectModel.Collection(); + + } + + /// + /// OK response to ContainerWait operation + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerWaitResponse + { + /// + /// Exit code of the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("StatusCode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public long StatusCode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Error")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ContainerWaitExitError Error { get; set; } + + } + + /// + /// container waiting error, if any + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerWaitExitError + { + /// + /// Details of an error + /// + + [System.Text.Json.Serialization.JsonPropertyName("Message")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Message { get; set; } + + } + + /// + /// Response of Engine API: GET "/version" + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SystemVersion + { + + [System.Text.Json.Serialization.JsonPropertyName("Platform")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Platform2 Platform { get; set; } + + /// + /// Information about system components + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Components")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Components { get; set; } + + /// + /// The version of the daemon + /// + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Version { get; set; } + + /// + /// The default (and highest) API version that is supported by the daemon + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ApiVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ApiVersion { get; set; } + + /// + /// The minimum API version that is supported by the daemon + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MinAPIVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string MinAPIVersion { get; set; } + + /// + /// The Git commit of the source code that was used to build the daemon + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GitCommit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string GitCommit { get; set; } + + /// + /// The version Go used to compile the daemon, and the version of the Go + ///
runtime in use. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GoVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string GoVersion { get; set; } + + /// + /// The operating system that the daemon is running on ("linux" or "windows") + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Os")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Os { get; set; } + + /// + /// The architecture that the daemon is running on + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Arch")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Arch { get; set; } + + /// + /// The kernel version (`uname -r`) that the daemon is running on. + ///
+ ///
This field is omitted when empty. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("KernelVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string KernelVersion { get; set; } + + /// + /// Indicates if the daemon is started with experimental features enabled. + ///
+ ///
This field is omitted when empty / false. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Experimental")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Experimental { get; set; } + + /// + /// The date and time that the daemon was compiled. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("BuildTime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string BuildTime { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SystemInfo + { + /// + /// Unique identifier of the daemon. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: The format of the ID itself is not part of the API, and + ///
> should not be considered stable. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + /// + /// Total number of containers on the host. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Containers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Containers { get; set; } + + /// + /// Number of containers with status `"running"`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ContainersRunning")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ContainersRunning { get; set; } + + /// + /// Number of containers with status `"paused"`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ContainersPaused")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ContainersPaused { get; set; } + + /// + /// Number of containers with status `"stopped"`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ContainersStopped")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ContainersStopped { get; set; } + + /// + /// Total number of images on the host. + ///
+ ///
Both _tagged_ and _untagged_ (dangling) images are counted. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Images")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Images { get; set; } + + /// + /// Name of the storage driver in use. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } + + /// + /// Information specific to the storage driver, provided as + ///
"label" / "value" pairs. + ///
+ ///
This information is provided by the storage driver, and formatted + ///
in a way consistent with the output of `docker info` on the command + ///
line. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: The information returned in this field, including the + ///
> formatting of values and labels, should not be considered stable, + ///
> and may change without notice. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DriverStatus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection> DriverStatus { get; set; } + + /// + /// Root directory of persistent Docker state. + ///
+ ///
Defaults to `/var/lib/docker` on Linux, and `C:\ProgramData\docker` + ///
on Windows. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DockerRootDir")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DockerRootDir { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Plugins")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public PluginsInfo Plugins { get; set; } + + /// + /// Indicates if the host has memory limit support enabled. + /// + + [System.Text.Json.Serialization.JsonPropertyName("MemoryLimit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? MemoryLimit { get; set; } + + /// + /// Indicates if the host has memory swap limit support enabled. + /// + + [System.Text.Json.Serialization.JsonPropertyName("SwapLimit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? SwapLimit { get; set; } + + /// + /// Indicates if the host has kernel memory TCP limit support enabled. This + ///
field is omitted if not supported. + ///
+ ///
Kernel memory TCP limits are not supported when using cgroups v2, which + ///
does not support the corresponding `memory.kmem.tcp.limit_in_bytes` cgroup. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("KernelMemoryTCP")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? KernelMemoryTCP { get; set; } + + /// + /// Indicates if CPU CFS(Completely Fair Scheduler) period is supported by + ///
the host. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuCfsPeriod")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? CpuCfsPeriod { get; set; } + + /// + /// Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by + ///
the host. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CpuCfsQuota")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? CpuCfsQuota { get; set; } + + /// + /// Indicates if CPU Shares limiting is supported by the host. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CPUShares")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? CPUShares { get; set; } + + /// + /// Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + ///
+ ///
See [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CPUSet")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? CPUSet { get; set; } + + /// + /// Indicates if the host kernel has PID limit support enabled. + /// + + [System.Text.Json.Serialization.JsonPropertyName("PidsLimit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? PidsLimit { get; set; } + + /// + /// Indicates if OOM killer disable is supported on the host. + /// + + [System.Text.Json.Serialization.JsonPropertyName("OomKillDisable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OomKillDisable { get; set; } + + /// + /// Indicates IPv4 forwarding is enabled. + /// + + [System.Text.Json.Serialization.JsonPropertyName("IPv4Forwarding")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? IPv4Forwarding { get; set; } + + /// + /// Indicates if `bridge-nf-call-iptables` is available on the host. + /// + + [System.Text.Json.Serialization.JsonPropertyName("BridgeNfIptables")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? BridgeNfIptables { get; set; } + + /// + /// Indicates if `bridge-nf-call-ip6tables` is available on the host. + /// + + [System.Text.Json.Serialization.JsonPropertyName("BridgeNfIp6tables")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? BridgeNfIp6tables { get; set; } + + /// + /// Indicates if the daemon is running in debug-mode / with debug-level + ///
logging enabled. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Debug")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Debug { get; set; } + + /// + /// The total number of file Descriptors in use by the daemon process. + ///
+ ///
This information is only returned if debug-mode is enabled. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NFd")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? NFd { get; set; } + + /// + /// The number of goroutines that currently exist. + ///
+ ///
This information is only returned if debug-mode is enabled. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NGoroutines")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? NGoroutines { get; set; } + + /// + /// Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) + ///
format with nano-seconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SystemTime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SystemTime { get; set; } + + /// + /// The logging driver to use as a default for new containers. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LoggingDriver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string LoggingDriver { get; set; } + + /// + /// The driver to use for managing cgroups. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CgroupDriver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public SystemInfoCgroupDriver? CgroupDriver { get; set; } = DockerEngine.SystemInfoCgroupDriver.Cgroupfs; + + /// + /// The version of the cgroup. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CgroupVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public SystemInfoCgroupVersion? CgroupVersion { get; set; } = DockerEngine.SystemInfoCgroupVersion._1; + + /// + /// Number of event listeners subscribed. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NEventsListener")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? NEventsListener { get; set; } + + /// + /// Kernel version of the host. + ///
+ ///
On Linux, this information obtained from `uname`. On Windows this + ///
information is queried from the <kbd>HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\</kbd> + ///
registry value, for example _"10.0 14393 (14393.1198.amd64fre.rs1_release_sec.170427-1353)"_. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("KernelVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string KernelVersion { get; set; } + + /// + /// Name of the host's operating system, for example: "Ubuntu 16.04.2 LTS" + ///
or "Windows Server 2016 Datacenter" + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OperatingSystem")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string OperatingSystem { get; set; } + + /// + /// Version of the host's operating system + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: The information returned in this field, including its + ///
> very existence, and the formatting of values, should not be considered + ///
> stable, and may change without notice. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OSVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string OSVersion { get; set; } + + /// + /// Generic type of the operating system of the host, as returned by the + ///
Go runtime (`GOOS`). + ///
+ ///
Currently returned values are "linux" and "windows". A full list of + ///
possible values can be found in the [Go documentation](https://golang.org/doc/install/source#environment). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("OSType")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string OSType { get; set; } + + /// + /// Hardware architecture of the host, as returned by the Go runtime + ///
(`GOARCH`). + ///
+ ///
A full list of possible values can be found in the [Go documentation](https://golang.org/doc/install/source#environment). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Architecture")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Architecture { get; set; } + + /// + /// The number of logical CPUs usable by the daemon. + ///
+ ///
The number of available CPUs is checked by querying the operating + ///
system when the daemon starts. Changes to operating system CPU + ///
allocation after the daemon is started are not reflected. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NCPU")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? NCPU { get; set; } + + /// + /// Total amount of physical memory available on the host, in bytes. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MemTotal")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MemTotal { get; set; } + + /// + /// Address / URL of the index server that is used for image search, + ///
and as a default for user authentication for Docker Hub and Docker Cloud. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("IndexServerAddress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IndexServerAddress { get; set; } = "https://index.docker.io/v1/"; + + [System.Text.Json.Serialization.JsonPropertyName("RegistryConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public RegistryServiceConfig RegistryConfig { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("GenericResources")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public GenericResources GenericResources { get; set; } + + /// + /// HTTP-proxy configured for the daemon. This value is obtained from the + ///
[`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable. + ///
Credentials ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy URL + ///
are masked in the API response. + ///
+ ///
Containers do not automatically inherit this configuration. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("HttpProxy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string HttpProxy { get; set; } + + /// + /// HTTPS-proxy configured for the daemon. This value is obtained from the + ///
[`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) environment variable. + ///
Credentials ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in the proxy URL + ///
are masked in the API response. + ///
+ ///
Containers do not automatically inherit this configuration. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("HttpsProxy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string HttpsProxy { get; set; } + + /// + /// Comma-separated list of domain extensions for which no proxy should be + ///
used. This value is obtained from the [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + ///
environment variable. + ///
+ ///
Containers do not automatically inherit this configuration. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NoProxy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NoProxy { get; set; } + + /// + /// Hostname of the host. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// User-defined labels (key/value metadata) as set on the daemon. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: When part of a Swarm, nodes can both have _daemon_ labels, + ///
> set through the daemon configuration, and _node_ labels, set from a + ///
> manager node in the Swarm. Node labels are not included in this + ///
> field. Node labels can be retrieved using the `/nodes/(id)` endpoint + ///
> on a manager node in the Swarm. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Labels { get; set; } + + /// + /// Indicates if experimental features are enabled on the daemon. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ExperimentalBuild")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? ExperimentalBuild { get; set; } + + /// + /// Version string of the daemon. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ServerVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ServerVersion { get; set; } + + /// + /// List of [OCI compliant](https://github.com/opencontainers/runtime-spec) + ///
runtimes configured on the daemon. Keys hold the "name" used to + ///
reference the runtime. + ///
+ ///
The Docker daemon relies on an OCI compliant runtime (invoked via the + ///
`containerd` daemon) as its interface to the Linux kernel namespaces, + ///
cgroups, and SELinux. + ///
+ ///
The default runtime is `runc`, and automatically configured. Additional + ///
runtimes can be configured by the user and will be listed here. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Runtimes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Runtimes { get; set; } + + /// + /// Name of the default OCI runtime that is used when starting containers. + ///
+ ///
The default can be overridden per-container at create time. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DefaultRuntime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DefaultRuntime { get; set; } = "runc"; + + [System.Text.Json.Serialization.JsonPropertyName("Swarm")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public SwarmInfo Swarm { get; set; } + + /// + /// Indicates if live restore is enabled. + ///
+ ///
If enabled, containers are kept running when the daemon is shutdown + ///
or upon daemon start if running containers are detected. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LiveRestoreEnabled")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? LiveRestoreEnabled { get; set; } = false; + + /// + /// Represents the isolation technology to use as a default for containers. + ///
The supported values are platform-specific. + ///
+ ///
If no isolation value is specified on daemon start, on Windows client, + ///
the default is `hyperv`, and on Windows server, the default is `process`. + ///
+ ///
This option is currently not used on other platforms. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Isolation")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public SystemInfoIsolation? Isolation { get; set; } = DockerEngine.SystemInfoIsolation.Default; + + /// + /// Name and, optional, path of the `docker-init` binary. + ///
+ ///
If the path is omitted, the daemon searches the host's `$PATH` for the + ///
binary and uses the first result. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("InitBinary")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string InitBinary { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ContainerdCommit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Commit ContainerdCommit { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("RuncCommit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Commit RuncCommit { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("InitCommit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Commit InitCommit { get; set; } + + /// + /// List of security features that are enabled on the daemon, such as + ///
apparmor, seccomp, SELinux, user-namespaces (userns), rootless and + ///
no-new-privileges. + ///
+ ///
Additional configuration options for each security feature may + ///
be present, and are included as a comma-separated list of key/value + ///
pairs. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SecurityOptions")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection SecurityOptions { get; set; } + + /// + /// Reports a summary of the product license on the daemon. + ///
+ ///
If a commercial license has been applied to the daemon, information + ///
such as number of nodes, and expiration are included. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ProductLicense")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ProductLicense { get; set; } + + /// + /// List of custom default address pools for local networks, which can be + ///
specified in the daemon.json file or dockerd option. + ///
+ ///
Example: a Base "10.10.0.0/16" with Size 24 will define the set of 256 + ///
10.10.[0-255].0/24 address pools. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DefaultAddressPools")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DefaultAddressPools { get; set; } + + /// + /// List of warnings / informational messages about missing features, or + ///
issues related to the daemon configuration. + ///
+ ///
These messages can be printed by the client as information to the user. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Warnings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Warnings { get; set; } + + } + + /// + /// Available plugins per type. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: Only unmanaged (V1) plugins are included in this list. + ///
> V1 plugins are "lazily" loaded, and are not returned in this list + ///
> if there is no resource using the plugin. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PluginsInfo + { + /// + /// Names of available volume-drivers, and network-driver plugins. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Volume")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Volume { get; set; } + + /// + /// Names of available network-drivers, and network-driver plugins. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Network")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Network { get; set; } + + /// + /// Names of available authorization plugins. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Authorization")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Authorization { get; set; } + + /// + /// Names of available logging-drivers, and logging-driver plugins. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Log")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Log { get; set; } + + } + + /// + /// RegistryServiceConfig stores daemon registry services configuration. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RegistryServiceConfig + { + /// + /// List of IP ranges to which nondistributable artifacts can be pushed, + ///
using the CIDR syntax [RFC 4632](https://tools.ietf.org/html/4632). + ///
+ ///
Some images (for example, Windows base images) contain artifacts + ///
whose distribution is restricted by license. When these images are + ///
pushed to a registry, restricted artifacts are not included. + ///
+ ///
This configuration override this behavior, and enables the daemon to + ///
push nondistributable artifacts to all registries whose resolved IP + ///
address is within the subnet described by the CIDR syntax. + ///
+ ///
This option is useful when pushing images containing + ///
nondistributable artifacts to a registry on an air-gapped network so + ///
hosts on that network can pull the images without connecting to + ///
another server. + ///
+ ///
> **Warning**: Nondistributable artifacts typically have restrictions + ///
> on how and where they can be distributed and shared. Only use this + ///
> feature to push artifacts to private registries and ensure that you + ///
> are in compliance with any terms that cover redistributing + ///
> nondistributable artifacts. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AllowNondistributableArtifactsCIDRs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection AllowNondistributableArtifactsCIDRs { get; set; } + + /// + /// List of registry hostnames to which nondistributable artifacts can be + ///
pushed, using the format `<hostname>[:<port>]` or `<IP address>[:<port>]`. + ///
+ ///
Some images (for example, Windows base images) contain artifacts + ///
whose distribution is restricted by license. When these images are + ///
pushed to a registry, restricted artifacts are not included. + ///
+ ///
This configuration override this behavior for the specified + ///
registries. + ///
+ ///
This option is useful when pushing images containing + ///
nondistributable artifacts to a registry on an air-gapped network so + ///
hosts on that network can pull the images without connecting to + ///
another server. + ///
+ ///
> **Warning**: Nondistributable artifacts typically have restrictions + ///
> on how and where they can be distributed and shared. Only use this + ///
> feature to push artifacts to private registries and ensure that you + ///
> are in compliance with any terms that cover redistributing + ///
> nondistributable artifacts. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AllowNondistributableArtifactsHostnames")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection AllowNondistributableArtifactsHostnames { get; set; } + + /// + /// List of IP ranges of insecure registries, using the CIDR syntax + ///
([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries + ///
accept un-encrypted (HTTP) and/or untrusted (HTTPS with certificates + ///
from unknown CAs) communication. + ///
+ ///
By default, local registries (`127.0.0.0/8`) are configured as + ///
insecure. All other registries are secure. Communicating with an + ///
insecure registry is not possible if the daemon assumes that registry + ///
is secure. + ///
+ ///
This configuration override this behavior, insecure communication with + ///
registries whose resolved IP address is within the subnet described by + ///
the CIDR syntax. + ///
+ ///
Registries can also be marked insecure by hostname. Those registries + ///
are listed under `IndexConfigs` and have their `Secure` field set to + ///
`false`. + ///
+ ///
> **Warning**: Using this option can be useful when running a local + ///
> registry, but introduces security vulnerabilities. This option + ///
> should therefore ONLY be used for testing purposes. For increased + ///
> security, users should add their CA to their system's list of trusted + ///
> CAs instead of enabling this option. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("InsecureRegistryCIDRs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection InsecureRegistryCIDRs { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("IndexConfigs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary IndexConfigs { get; set; } + + /// + /// List of registry URLs that act as a mirror for the official + ///
(`docker.io`) registry. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Mirrors")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Mirrors { get; set; } + + } + + /// + /// IndexInfo contains information about a registry. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class IndexInfo + { + /// + /// Name of the registry, such as "docker.io". + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// List of mirrors, expressed as URIs. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Mirrors")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Mirrors { get; set; } + + /// + /// Indicates if the registry is part of the list of insecure + ///
registries. + ///
+ ///
If `false`, the registry is insecure. Insecure registries accept + ///
un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from + ///
unknown CAs) communication. + ///
+ ///
> **Warning**: Insecure registries can be useful when running a local + ///
> registry. However, because its use creates security vulnerabilities + ///
> it should ONLY be enabled for testing purposes. For increased + ///
> security, users should add their CA to their system's list of + ///
> trusted CAs instead of enabling this option. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Secure")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Secure { get; set; } + + /// + /// Indicates whether this is an official registry (i.e., Docker Hub / docker.io) + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Official")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Official { get; set; } + + } + + /// + /// Runtime describes an [OCI compliant](https://github.com/opencontainers/runtime-spec) + ///
runtime. + ///
+ ///
The runtime is invoked by the daemon via the `containerd` daemon. OCI + ///
runtimes act as an interface to the Linux kernel namespaces, cgroups, + ///
and SELinux. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Runtime + { + /// + /// Name and, optional, path, of the OCI executable binary. + ///
+ ///
If the path is omitted, the daemon searches the host's `$PATH` for the + ///
binary and uses the first result. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("path")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Path { get; set; } + + /// + /// List of command-line arguments to pass to the runtime when invoked. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("runtimeArgs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection RuntimeArgs { get; set; } + + } + + /// + /// Commit holds the Git-commit (SHA1) that a binary was built from, as + ///
reported in the version-string of external tools, such as `containerd`, + ///
or `runC`. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Commit + { + /// + /// Actual commit ID of external tool. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + /// + /// Commit ID of external tool expected by dockerd as set at build time. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Expected")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Expected { get; set; } + + } + + /// + /// Represents generic information about swarm. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SwarmInfo + { + /// + /// Unique identifier of for this node in the swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NodeID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NodeID { get; set; } = ""; + + /// + /// IP address at which this node can be reached by other nodes in the + ///
swarm. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NodeAddr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NodeAddr { get; set; } = ""; + + [System.Text.Json.Serialization.JsonPropertyName("LocalNodeState")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public LocalNodeState? LocalNodeState { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ControlAvailable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? ControlAvailable { get; set; } = false; + + [System.Text.Json.Serialization.JsonPropertyName("Error")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Error { get; set; } = ""; + + /// + /// List of ID's and addresses of other managers in the swarm. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RemoteManagers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection RemoteManagers { get; set; } + + /// + /// Total number of nodes in the swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Nodes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Nodes { get; set; } + + /// + /// Total number of managers in the swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Managers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Managers { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Cluster")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ClusterInfo Cluster { get; set; } + + } + + /// + /// Current local status of this node. + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum LocalNodeState + { + + [System.Runtime.Serialization.EnumMember(Value = @"")] + Empty = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"inactive")] + Inactive = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"pending")] + Pending = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"active")] + Active = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"error")] + Error = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"locked")] + Locked = 5, + + } + + /// + /// Represents a peer-node in the swarm + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PeerNode + { + /// + /// Unique identifier of for this node in the swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NodeID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NodeID { get; set; } + + /// + /// IP address and ports at which this node can be reached. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Addr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Addr { get; set; } + + } + + /// + /// Specifies how a service should be attached to a particular network. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkAttachmentConfig + { + /// + /// The target network for attachment. Must be a network name or ID. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Target")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Target { get; set; } + + /// + /// Discoverable alternate names for the service on this network. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Aliases")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Aliases { get; set; } + + /// + /// Driver attachment options for the network target. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DriverOpts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary DriverOpts { get; set; } + + } + + /// + /// Actor describes something that generates events, like a container, network, + ///
or a volume. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EventActor + { + /// + /// The ID of the object emitting the event + /// + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + /// + /// Various key/value attributes of the object, depending on its type. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Attributes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Attributes { get; set; } + + } + + /// + /// EventMessage represents the information an event contains. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EventMessage + { + /// + /// The type of object emitting the event + /// + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EventMessageType? Type { get; set; } + + /// + /// The type of event + /// + + [System.Text.Json.Serialization.JsonPropertyName("Action")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Action { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Actor")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public EventActor Actor { get; set; } + + /// + /// Scope of the event. Engine events are `local` scope. Cluster (Swarm) + ///
events are `swarm` scope. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("scope")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public EventMessageScope? Scope { get; set; } + + /// + /// Timestamp of event + /// + + [System.Text.Json.Serialization.JsonPropertyName("time")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Time { get; set; } + + /// + /// Timestamp of event, with nanosecond accuracy + /// + + [System.Text.Json.Serialization.JsonPropertyName("timeNano")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? TimeNano { get; set; } + + } + + /// + /// A descriptor struct containing digest, media type, and size, as defined in + ///
the [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class OCIDescriptor + { + /// + /// The media type of the object this schema refers to. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("mediaType")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string MediaType { get; set; } + + /// + /// The digest of the targeted content. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("digest")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Digest { get; set; } + + /// + /// The size in bytes of the blob. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("size")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Size { get; set; } + + } + + /// + /// Describes the platform which the image in the manifest runs on, as defined + ///
in the [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class OCIPlatform + { + /// + /// The CPU architecture, for example `amd64` or `ppc64`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("architecture")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Architecture { get; set; } + + /// + /// The operating system, for example `linux` or `windows`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("os")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Os { get; set; } + + /// + /// Optional field specifying the operating system version, for example on + ///
Windows `10.0.19041.1165`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("os.version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string OsVersion { get; set; } + + /// + /// Optional field specifying an array of strings, each listing a required + ///
OS feature (for example on Windows `win32k`). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("os.features")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection OsFeatures { get; set; } + + /// + /// Optional field specifying a variant of the CPU, for example `v7` to + ///
specify ARMv7 when architecture is `arm`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("variant")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Variant { get; set; } + + } + + /// + /// Describes the result obtained from contacting the registry to retrieve + ///
image metadata. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DistributionInspect + { + + [System.Text.Json.Serialization.JsonPropertyName("Descriptor")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public OCIDescriptor Descriptor { get; set; } = new OCIDescriptor(); + + /// + /// An array containing all platforms supported by the image. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Platforms")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Platforms { get; } = new System.Collections.ObjectModel.Collection(); + + } + + /// + /// Options and information specific to, and only present on, Swarm CSI + ///
cluster volumes. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ClusterVolume + { + /// + /// The Swarm ID of this volume. Because cluster volumes are Swarm + ///
objects, they have an ID, unlike non-cluster volumes. This ID can + ///
be used to refer to the Volume instead of the name. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion Version { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CreatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CreatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("UpdatedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UpdatedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ClusterVolumeSpec Spec { get; set; } + + /// + /// Information about the global status of the volume. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Info")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Info Info { get; set; } + + /// + /// The status of the volume as it pertains to its publishing and use on + ///
specific nodes + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("PublishStatus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection PublishStatus { get; set; } + + } + + /// + /// Cluster-specific options used to create the volume. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ClusterVolumeSpec + { + /// + /// Group defines the volume group of this volume. Volumes belonging to + ///
the same group can be referred to by group name when creating + ///
Services. Referring to a volume by group instructs Swarm to treat + ///
volumes in that group interchangeably for the purpose of scheduling. + ///
Volumes with an empty string for a group technically all belong to + ///
the same, emptystring group. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Group")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Group { get; set; } + + /// + /// Defines how the volume is used by tasks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AccessMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public AccessMode AccessMode { get; set; } + + } + + /// + /// A map of topological domains to topological segments. For in depth + ///
details, see documentation for the Topology object in the CSI + ///
specification. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Topology : System.Collections.Generic.Dictionary + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body : ContainerConfig + { + + [System.Text.Json.Serialization.JsonPropertyName("HostConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public HostConfig HostConfig { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("NetworkingConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NetworkingConfig NetworkingConfig { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Update : Resources + { + + [System.Text.Json.Serialization.JsonPropertyName("RestartPolicy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public RestartPolicy RestartPolicy { get; set; } + + } + + /// + /// Wait until a container state reaches the given condition. + ///
+ ///
Defaults to `not-running` if omitted or empty. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Condition + { + + [System.Runtime.Serialization.EnumMember(Value = @"not-running")] + NotRunning = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"next-exit")] + NextExit = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"removed")] + Removed = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ContentType + { + + [System.Runtime.Serialization.EnumMember(Value = @"application/x-tar")] + Application_xTar = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Anonymous + { + + [System.Runtime.Serialization.EnumMember(Value = @"container")] + Container = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"image")] + Image = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"volume")] + Volume = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"build-cache")] + BuildCache = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExecConfig + { + /// + /// Attach to `stdin` of the exec command. + /// + + [System.Text.Json.Serialization.JsonPropertyName("AttachStdin")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AttachStdin { get; set; } + + /// + /// Attach to `stdout` of the exec command. + /// + + [System.Text.Json.Serialization.JsonPropertyName("AttachStdout")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AttachStdout { get; set; } + + /// + /// Attach to `stderr` of the exec command. + /// + + [System.Text.Json.Serialization.JsonPropertyName("AttachStderr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AttachStderr { get; set; } + + /// + /// Initial console size, as an `[height, width]` array. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ConsoleSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.MinLength(2)] + [System.ComponentModel.DataAnnotations.MaxLength(2)] + public System.Collections.Generic.ICollection ConsoleSize { get; set; } + + /// + /// Override the key sequence for detaching a container. Format is + ///
a single character `[a-Z]` or `ctrl-<value>` where `<value>` + ///
is one of: `a-z`, `@`, `^`, `[`, `,` or `_`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DetachKeys")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DetachKeys { get; set; } + + /// + /// Allocate a pseudo-TTY. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Tty")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Tty { get; set; } + + /// + /// A list of environment variables in the form `["VAR=value", ...]`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Env")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Env { get; set; } + + /// + /// Command to run, as a string or array of strings. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Cmd")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Cmd { get; set; } + + /// + /// Runs the exec process with extended privileges. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Privileged")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Privileged { get; set; } = false; + + /// + /// The user, and optionally, group to run the exec process inside + ///
the container. Format is one of: `user`, `user:group`, `uid`, + ///
or `uid:gid`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("User")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string User { get; set; } + + /// + /// The working directory for the exec process inside the container. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("WorkingDir")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string WorkingDir { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExecStartConfig + { + /// + /// Detach from the command. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Detach")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Detach { get; set; } + + /// + /// Allocate a pseudo-TTY. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Tty")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Tty { get; set; } + + /// + /// Initial console size, as an `[height, width]` array. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ConsoleSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.MinLength(2)] + [System.ComponentModel.DataAnnotations.MaxLength(2)] + public System.Collections.Generic.ICollection ConsoleSize { get; set; } + + } + + /// + /// Volume configuration + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body2 + { + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ClusterVolumeSpec Spec { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkCreateRequest + { + /// + /// The network's name. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// Check for networks with duplicate names. Since Network is + ///
primarily keyed based on a random ID and not on the name, and + ///
network name is strictly a user-friendly alias to the network + ///
which is uniquely identified using ID, there is no guaranteed + ///
way to check for duplicates. CheckDuplicate is there to provide + ///
a best effort checking of any networks which has the same name + ///
but it is not guaranteed to catch all name collisions. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CheckDuplicate")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? CheckDuplicate { get; set; } + + /// + /// Name of the network driver plugin to use. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } = "bridge"; + + /// + /// Restrict external access to the network. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Internal")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Internal { get; set; } + + /// + /// Globally scoped network is manually attachable by regular + ///
containers from workers in swarm mode. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Attachable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Attachable { get; set; } + + /// + /// Ingress network is the network which provides the routing-mesh + ///
in swarm mode. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Ingress")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Ingress { get; set; } + + /// + /// Optional custom IP scheme for the network. + /// + + [System.Text.Json.Serialization.JsonPropertyName("IPAM")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public IPAM IPAM { get; set; } + + /// + /// Enable IPv6 on the network. + /// + + [System.Text.Json.Serialization.JsonPropertyName("EnableIPv6")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? EnableIPv6 { get; set; } + + /// + /// Network specific options to be used by the drivers. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkConnectRequest + { + /// + /// The ID or name of the container to connect to the network. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Container")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Container { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("EndpointConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public EndpointSettings EndpointConfig { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkDisconnectRequest + { + /// + /// The ID or name of the container to disconnect from the network. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Container")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Container { get; set; } + + /// + /// Force the container to disconnect from the network. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Force")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Force { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SwarmInitRequest + { + /// + /// Listen address used for inter-manager communication, as well + ///
as determining the networking interface used for the VXLAN + ///
Tunnel Endpoint (VTEP). This can either be an address/port + ///
combination in the form `192.168.1.1:4567`, or an interface + ///
followed by a port number, like `eth0:4567`. If the port number + ///
is omitted, the default swarm listening port is used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ListenAddr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ListenAddr { get; set; } + + /// + /// Externally reachable address advertised to other nodes. This + ///
can either be an address/port combination in the form + ///
`192.168.1.1:4567`, or an interface followed by a port number, + ///
like `eth0:4567`. If the port number is omitted, the port + ///
number from the listen address is used. If `AdvertiseAddr` is + ///
not specified, it will be automatically detected when possible. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AdvertiseAddr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string AdvertiseAddr { get; set; } + + /// + /// Address or interface to use for data path traffic (format: + ///
`<ip|interface>`), for example, `192.168.1.1`, or an interface, + ///
like `eth0`. If `DataPathAddr` is unspecified, the same address + ///
as `AdvertiseAddr` is used. + ///
+ ///
The `DataPathAddr` specifies the address that global scope + ///
network drivers will publish towards other nodes in order to + ///
reach the containers running on this node. Using this parameter + ///
it is possible to separate the container data traffic from the + ///
management traffic of the cluster. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DataPathAddr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DataPathAddr { get; set; } + + /// + /// DataPathPort specifies the data path port number for data traffic. + ///
Acceptable port range is 1024 to 49151. + ///
if no port is set or is set to 0, default port 4789 will be used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DataPathPort")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? DataPathPort { get; set; } + + /// + /// Default Address Pool specifies default subnet pools for global + ///
scope networks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DefaultAddrPool")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection DefaultAddrPool { get; set; } + + /// + /// Force creation of a new swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ForceNewCluster")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? ForceNewCluster { get; set; } + + /// + /// SubnetSize specifies the subnet size of the networks created + ///
from the default subnet pool. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SubnetSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? SubnetSize { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public SwarmSpec Spec { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SwarmJoinRequest + { + /// + /// Listen address used for inter-manager communication if the node + ///
gets promoted to manager, as well as determining the networking + ///
interface used for the VXLAN Tunnel Endpoint (VTEP). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ListenAddr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ListenAddr { get; set; } + + /// + /// Externally reachable address advertised to other nodes. This + ///
can either be an address/port combination in the form + ///
`192.168.1.1:4567`, or an interface followed by a port number, + ///
like `eth0:4567`. If the port number is omitted, the port + ///
number from the listen address is used. If `AdvertiseAddr` is + ///
not specified, it will be automatically detected when possible. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AdvertiseAddr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string AdvertiseAddr { get; set; } + + /// + /// Address or interface to use for data path traffic (format: + ///
`<ip|interface>`), for example, `192.168.1.1`, or an interface, + ///
like `eth0`. If `DataPathAddr` is unspecified, the same address + ///
as `AdvertiseAddr` is used. + ///
+ ///
The `DataPathAddr` specifies the address that global scope + ///
network drivers will publish towards other nodes in order to + ///
reach the containers running on this node. Using this parameter + ///
it is possible to separate the container data traffic from the + ///
management traffic of the cluster. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DataPathAddr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DataPathAddr { get; set; } + + /// + /// Addresses of manager nodes already participating in the swarm. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RemoteAddrs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection RemoteAddrs { get; set; } + + /// + /// Secret token for joining this swarm. + /// + + [System.Text.Json.Serialization.JsonPropertyName("JoinToken")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string JoinToken { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SwarmUnlockRequest + { + /// + /// The swarm's unlock key. + /// + + [System.Text.Json.Serialization.JsonPropertyName("UnlockKey")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UnlockKey { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body3 : ServiceSpec + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body4 : ServiceSpec + { + + } + + /// + /// If the `X-Registry-Auth` header is not specified, this parameter + ///
indicates where to find registry authorization credentials. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RegistryAuthFrom + { + + [System.Runtime.Serialization.EnumMember(Value = @"spec")] + Spec = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"previous-spec")] + PreviousSpec = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body5 : SecretSpec + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Body6 : ConfigSpec + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerInspectResponse + { + /// + /// The ID of the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + /// + /// The time the container was created + /// + + [System.Text.Json.Serialization.JsonPropertyName("Created")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Created { get; set; } + + /// + /// The path to the command being run + /// + + [System.Text.Json.Serialization.JsonPropertyName("Path")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Path { get; set; } + + /// + /// The arguments to the command being run + /// + + [System.Text.Json.Serialization.JsonPropertyName("Args")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Args { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("State")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ContainerState State { get; set; } + + /// + /// The container's image ID + /// + + [System.Text.Json.Serialization.JsonPropertyName("Image")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Image { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ResolvConfPath")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ResolvConfPath { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("HostnamePath")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string HostnamePath { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("HostsPath")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string HostsPath { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("LogPath")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string LogPath { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("RestartCount")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? RestartCount { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Driver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Driver { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Platform")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Platform { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("MountLabel")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string MountLabel { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ProcessLabel")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ProcessLabel { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("AppArmorProfile")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string AppArmorProfile { get; set; } + + /// + /// IDs of exec instances that are running in the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ExecIDs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection ExecIDs { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("HostConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public HostConfig HostConfig { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("GraphDriver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public GraphDriverData GraphDriver { get; set; } + + /// + /// The size of files that have been created or changed by this + ///
container. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SizeRw")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SizeRw { get; set; } + + /// + /// The total size of all the files in this container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("SizeRootFs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SizeRootFs { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Mounts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Mounts { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Config")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ContainerConfig Config { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("NetworkSettings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NetworkSettings NetworkSettings { get; set; } + + } + + /// + /// OK response to ContainerTop operation + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerTopResponse + { + /// + /// The ps column titles + /// + + [System.Text.Json.Serialization.JsonPropertyName("Titles")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Titles { get; set; } + + /// + /// Each process running in the container, where each is process + ///
is an array of values corresponding to the titles. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Processes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection> Processes { get; set; } + + } + + /// + /// OK response to ContainerUpdate operation + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerUpdateResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("Warnings")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Warnings { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerPruneResponse + { + /// + /// Container IDs that were deleted + /// + + [System.Text.Json.Serialization.JsonPropertyName("ContainersDeleted")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection ContainersDeleted { get; set; } + + /// + /// Disk space reclaimed in bytes + /// + + [System.Text.Json.Serialization.JsonPropertyName("SpaceReclaimed")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SpaceReclaimed { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class BuildPruneResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("CachesDeleted")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection CachesDeleted { get; set; } + + /// + /// Disk space reclaimed in bytes + /// + + [System.Text.Json.Serialization.JsonPropertyName("SpaceReclaimed")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SpaceReclaimed { get; set; } + + } + + /// + /// individual image layer information in response to ImageHistory operation + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class HistoryResponseItem + { + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Created")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public long Created { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CreatedBy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string CreatedBy { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Tags")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Tags { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Size")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public long Size { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Comment")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Comment { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ImageSearchResponseItem + { + + [System.Text.Json.Serialization.JsonPropertyName("description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("is_official")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Is_official { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("is_automated")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Is_automated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("star_count")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Star_count { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ImagePruneResponse + { + /// + /// Images that were deleted + /// + + [System.Text.Json.Serialization.JsonPropertyName("ImagesDeleted")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection ImagesDeleted { get; set; } + + /// + /// Disk space reclaimed in bytes + /// + + [System.Text.Json.Serialization.JsonPropertyName("SpaceReclaimed")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SpaceReclaimed { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Response + { + /// + /// The status of the authentication + /// + + [System.Text.Json.Serialization.JsonPropertyName("Status")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Status { get; set; } + + /// + /// An opaque token used to authenticate a user after a successful login + /// + + [System.Text.Json.Serialization.JsonPropertyName("IdentityToken")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string IdentityToken { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SystemDataUsageResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("LayersSize")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? LayersSize { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Images")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Images { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Containers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Containers { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Volumes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Volumes { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("BuildCache")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection BuildCache { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExecInspectResponse + { + + [System.Text.Json.Serialization.JsonPropertyName("CanRemove")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? CanRemove { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("DetachKeys")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DetachKeys { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Running")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Running { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ExitCode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ExitCode { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ProcessConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ProcessConfig ProcessConfig { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("OpenStdin")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OpenStdin { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("OpenStderr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OpenStderr { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("OpenStdout")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OpenStdout { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ContainerID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ContainerID { get; set; } + + /// + /// The system process ID for the exec process. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Pid")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Pid { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class VolumePruneResponse + { + /// + /// Volumes that were deleted + /// + + [System.Text.Json.Serialization.JsonPropertyName("VolumesDeleted")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection VolumesDeleted { get; set; } + + /// + /// Disk space reclaimed in bytes + /// + + [System.Text.Json.Serialization.JsonPropertyName("SpaceReclaimed")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SpaceReclaimed { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkCreateResponse + { + /// + /// The ID of the created network. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Id")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Id { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Warning")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Warning { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkPruneResponse + { + /// + /// Networks that were deleted + /// + + [System.Text.Json.Serialization.JsonPropertyName("NetworksDeleted")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection NetworksDeleted { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UnlockKeyResponse + { + /// + /// The swarm's unlock key. + /// + + [System.Text.Json.Serialization.JsonPropertyName("UnlockKey")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UnlockKey { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ServiceCreateResponse + { + /// + /// The ID of the created service. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ID { get; set; } + + /// + /// Optional warning message + /// + + [System.Text.Json.Serialization.JsonPropertyName("Warning")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Warning { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum PortType + { + + [System.Runtime.Serialization.EnumMember(Value = @"tcp")] + Tcp = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"udp")] + Udp = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"sctp")] + Sctp = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum MountPointType + { + + [System.Runtime.Serialization.EnumMember(Value = @"bind")] + Bind = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"volume")] + Volume = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"tmpfs")] + Tmpfs = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"npipe")] + Npipe = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"cluster")] + Cluster = 4, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum MountType + { + + [System.Runtime.Serialization.EnumMember(Value = @"bind")] + Bind = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"volume")] + Volume = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"tmpfs")] + Tmpfs = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"npipe")] + Npipe = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"cluster")] + Cluster = 4, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class BindOptions + { + /// + /// A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Propagation")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public BindOptionsPropagation? Propagation { get; set; } + + /// + /// Disable recursive bind mount. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NonRecursive")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? NonRecursive { get; set; } = false; + + /// + /// Create mount point on host if missing + /// + + [System.Text.Json.Serialization.JsonPropertyName("CreateMountpoint")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? CreateMountpoint { get; set; } = false; + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class VolumeOptions + { + /// + /// Populate volume with data from the target. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NoCopy")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? NoCopy { get; set; } = false; + + /// + /// User-defined key/value metadata. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// Map of driver specific options + /// + + [System.Text.Json.Serialization.JsonPropertyName("DriverConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public DriverConfig DriverConfig { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TmpfsOptions + { + /// + /// The size for the tmpfs mount in bytes. + /// + + [System.Text.Json.Serialization.JsonPropertyName("SizeBytes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? SizeBytes { get; set; } + + /// + /// The permission mode for the tmpfs mount in an integer. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Mode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Mode { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RestartPolicyName + { + + [System.Runtime.Serialization.EnumMember(Value = @"")] + Empty = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"no")] + No = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"always")] + Always = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"unless-stopped")] + UnlessStopped = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"on-failure")] + OnFailure = 4, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class BlkioWeightDevice + { + + [System.Text.Json.Serialization.JsonPropertyName("Path")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Path { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Weight")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] + public int? Weight { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Ulimits + { + /// + /// Name of ulimit + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// Soft limit + /// + + [System.Text.Json.Serialization.JsonPropertyName("Soft")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Soft { get; set; } + + /// + /// Hard limit + /// + + [System.Text.Json.Serialization.JsonPropertyName("Hard")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Hard { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Anonymous2 + { + + [System.Text.Json.Serialization.JsonPropertyName("NamedResourceSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public NamedResourceSpec NamedResourceSpec { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("DiscreteResourceSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public DiscreteResourceSpec DiscreteResourceSpec { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum HealthStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"none")] + None = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"starting")] + Starting = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"healthy")] + Healthy = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"unhealthy")] + Unhealthy = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LogConfig + { + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public LogConfigType? Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Config")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Config { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum HostConfigCgroupnsMode + { + + [System.Runtime.Serialization.EnumMember(Value = @"private")] + Private = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"host")] + Host = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum HostConfigIsolation + { + + [System.Runtime.Serialization.EnumMember(Value = @"default")] + Default = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"process")] + Process = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"hyperv")] + Hyperv = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Anonymous3 + { + + [System.Runtime.Serialization.EnumMember(Value = @"{}")] + __ = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum Anonymous4 + { + + [System.Runtime.Serialization.EnumMember(Value = @"{}")] + __ = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RootFS + { + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Layers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Layers { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Metadata + { + /// + /// Date and time at which the image was last tagged in + ///
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + ///
+ ///
This information is only available if the image was tagged locally, + ///
and omitted otherwise. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LastTagTime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string LastTagTime { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum VolumeScope + { + + [System.Runtime.Serialization.EnumMember(Value = @"local")] + Local = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"global")] + Global = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UsageData + { + /// + /// Amount of disk space used by the volume (in bytes). This information + ///
is only available for volumes created with the `"local"` volume + ///
driver. For volumes created with other volume drivers, this field + ///
is set to `-1` ("not available") + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Size")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public long Size { get; set; } = -1L; + + /// + /// The number of containers referencing this volume. This field + ///
is set to `-1` if the reference-count is not available. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RefCount")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public long RefCount { get; set; } = -1L; + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum BuildCacheType + { + + [System.Runtime.Serialization.EnumMember(Value = @"internal")] + Internal = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"frontend")] + Frontend = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"source.local")] + Source_local = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"source.git.checkout")] + Source_git_checkout = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"exec.cachemount")] + Exec_cachemount = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"regular")] + Regular = 5, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Settings + { + + [System.Text.Json.Serialization.JsonPropertyName("Mounts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Mounts { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Env")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Env { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Args")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Args { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Devices")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Devices { get; } = new System.Collections.ObjectModel.Collection(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Config2 + { + /// + /// Docker Version used to create the plugin + /// + + [System.Text.Json.Serialization.JsonPropertyName("DockerVersion")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string DockerVersion { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Documentation")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Documentation { get; set; } + + /// + /// The interface between Docker and the plugin + /// + + [System.Text.Json.Serialization.JsonPropertyName("Interface")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public Interface Interface { get; set; } = new Interface(); + + [System.Text.Json.Serialization.JsonPropertyName("Entrypoint")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Entrypoint { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("WorkDir")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string WorkDir { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("User")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public User User { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Network")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public Network2 Network { get; set; } = new Network2(); + + [System.Text.Json.Serialization.JsonPropertyName("Linux")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public Linux Linux { get; set; } = new Linux(); + + [System.Text.Json.Serialization.JsonPropertyName("PropagatedMount")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string PropagatedMount { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("IpcHost")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public bool IpcHost { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("PidHost")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public bool PidHost { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Mounts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Mounts { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Env")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Env { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Args")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public Args Args { get; set; } = new Args(); + + [System.Text.Json.Serialization.JsonPropertyName("rootfs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Rootfs Rootfs { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum NodeSpecRole + { + + [System.Runtime.Serialization.EnumMember(Value = @"worker")] + Worker = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"manager")] + Manager = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum NodeSpecAvailability + { + + [System.Runtime.Serialization.EnumMember(Value = @"active")] + Active = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"pause")] + Pause = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"drain")] + Drain = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Plugins + { + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Orchestration + { + /// + /// The number of historic tasks to keep per instance or node. If + ///
negative, never remove completed or failed tasks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("TaskHistoryRetentionLimit")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? TaskHistoryRetentionLimit { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Raft + { + /// + /// The number of log entries between snapshots. + /// + + [System.Text.Json.Serialization.JsonPropertyName("SnapshotInterval")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? SnapshotInterval { get; set; } + + /// + /// The number of snapshots to keep beyond the current snapshot. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("KeepOldSnapshots")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? KeepOldSnapshots { get; set; } + + /// + /// The number of log entries to keep around to sync up slow followers + ///
after a snapshot is created. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LogEntriesForSlowFollowers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? LogEntriesForSlowFollowers { get; set; } + + /// + /// The number of ticks that a follower will wait for a message from + ///
the leader before becoming a candidate and starting an election. + ///
`ElectionTick` must be greater than `HeartbeatTick`. + ///
+ ///
A tick currently defaults to one second, so these translate + ///
directly to seconds currently, but this is NOT guaranteed. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ElectionTick")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ElectionTick { get; set; } + + /// + /// The number of ticks between heartbeats. Every HeartbeatTick ticks, + ///
the leader will send a heartbeat to the followers. + ///
+ ///
A tick currently defaults to one second, so these translate + ///
directly to seconds currently, but this is NOT guaranteed. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("HeartbeatTick")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? HeartbeatTick { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Dispatcher + { + /// + /// The delay for an agent to send a heartbeat to the dispatcher. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("HeartbeatPeriod")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? HeartbeatPeriod { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CAConfig + { + /// + /// The duration node certificates are issued for. + /// + + [System.Text.Json.Serialization.JsonPropertyName("NodeCertExpiry")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? NodeCertExpiry { get; set; } + + /// + /// Configuration for forwarding signing requests to an external + ///
certificate authority. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ExternalCAs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection ExternalCAs { get; set; } + + /// + /// The desired signing CA certificate for all swarm node TLS leaf + ///
certificates, in PEM format. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SigningCACert")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SigningCACert { get; set; } + + /// + /// The desired signing CA key for all swarm node TLS leaf certificates, + ///
in PEM format. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SigningCAKey")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SigningCAKey { get; set; } + + /// + /// An integer whose purpose is to force swarm to generate a new + ///
signing CA certificate and key, if none have been specified in + ///
`SigningCACert` and `SigningCAKey` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ForceRotate")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ForceRotate { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class EncryptionConfig + { + /// + /// If set, generate a key and use it to lock data stored on the + ///
managers. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AutoLockManagers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? AutoLockManagers { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class TaskDefaults + { + /// + /// The log driver to use for tasks created in the orchestrator if + ///
unspecified by a service. + ///
+ ///
Updating this value only affects new tasks. Existing tasks continue + ///
to use their previously configured log driver until recreated. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LogDriver")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public LogDriver2 LogDriver { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PluginSpec + { + /// + /// The name or 'alias' to use for the plugin. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// The plugin image reference to use. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Remote")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Remote { get; set; } + + /// + /// Disable the plugin once scheduled. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Disabled")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Disabled { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("PluginPrivilege")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection PluginPrivilege { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerSpec + { + /// + /// The image name to use for the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Image")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Image { get; set; } + + /// + /// User-defined key/value data. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Labels")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Labels { get; set; } + + /// + /// The command to be run in the image. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Command")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Command { get; set; } + + /// + /// Arguments to the command. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Args")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Args { get; set; } + + /// + /// The hostname to use for the container, as a valid + ///
[RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Hostname")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Hostname { get; set; } + + /// + /// A list of environment variables in the form `VAR=value`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Env")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Env { get; set; } + + /// + /// The working directory for commands to run in. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Dir")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Dir { get; set; } + + /// + /// The user inside the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("User")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string User { get; set; } + + /// + /// A list of additional groups that the container process will run as. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Groups")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Groups { get; set; } + + /// + /// Security options for the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("Privileges")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Privileges Privileges { get; set; } + + /// + /// Whether a pseudo-TTY should be allocated. + /// + + [System.Text.Json.Serialization.JsonPropertyName("TTY")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? TTY { get; set; } + + /// + /// Open `stdin` + /// + + [System.Text.Json.Serialization.JsonPropertyName("OpenStdin")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? OpenStdin { get; set; } + + /// + /// Mount the container's root filesystem as read only. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ReadOnly")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? ReadOnly { get; set; } + + /// + /// Specification for mounts to be added to containers created as part + ///
of the service. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Mounts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Mounts { get; set; } + + /// + /// Signal to stop the container. + /// + + [System.Text.Json.Serialization.JsonPropertyName("StopSignal")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string StopSignal { get; set; } + + /// + /// Amount of time to wait for the container to terminate before + ///
forcefully killing it. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("StopGracePeriod")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? StopGracePeriod { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("HealthCheck")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public HealthConfig HealthCheck { get; set; } + + /// + /// A list of hostname/IP mappings to add to the container's `hosts` + ///
file. The format of extra hosts is specified in the + ///
[hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) + ///
man page: + ///
+ ///
IP_address canonical_hostname [aliases...] + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Hosts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Hosts { get; set; } + + /// + /// Specification for DNS related configurations in resolver configuration + ///
file (`resolv.conf`). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DNSConfig")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public DNSConfig DNSConfig { get; set; } + + /// + /// Secrets contains references to zero or more secrets that will be + ///
exposed to the service. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Secrets")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Secrets { get; set; } + + /// + /// Configs contains references to zero or more configs that will be + ///
exposed to the service. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Configs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Configs { get; set; } + + /// + /// Isolation technology of the containers running the service. + ///
(Windows only) + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Isolation")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ContainerSpecIsolation? Isolation { get; set; } + + /// + /// Run an init inside the container that forwards signals and reaps + ///
processes. This field is omitted if empty, and the default (as + ///
configured on the daemon) is used. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Init")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Init { get; set; } + + /// + /// Set kernel namedspaced parameters (sysctls) in the container. + ///
The Sysctls option on services accepts the same sysctls as the + ///
are supported on containers. Note that while the same sysctls are + ///
supported, no guarantees or checks are made about their + ///
suitability for a clustered environment, and it's up to the user + ///
to determine whether a given sysctl will work properly in a + ///
Service. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Sysctls")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Sysctls { get; set; } + + /// + /// A list of kernel capabilities to add to the default set + ///
for the container. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CapabilityAdd")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection CapabilityAdd { get; set; } + + /// + /// A list of kernel capabilities to drop from the default set + ///
for the container. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CapabilityDrop")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection CapabilityDrop { get; set; } + + /// + /// A list of resource limits to set in the container. For example: `{"Name": "nofile", "Soft": 1024, "Hard": 2048}`" + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Ulimits")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Ulimits { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkAttachmentSpec + { + /// + /// ID of the container represented by this task + /// + + [System.Text.Json.Serialization.JsonPropertyName("ContainerID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ContainerID { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Resources2 + { + /// + /// Define resources limits. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Limits")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Limit Limits { get; set; } + + /// + /// Define resources reservation. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Reservations")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ResourceObject Reservations { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RestartPolicy2 + { + /// + /// Condition for restart. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Condition")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RestartPolicy2Condition? Condition { get; set; } + + /// + /// Delay between restart attempts. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Delay")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Delay { get; set; } + + /// + /// Maximum attempts to restart a given container before giving up + ///
(default value is 0, which is ignored). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MaxAttempts")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MaxAttempts { get; set; } = 0L; + + /// + /// Windows is the time window used to evaluate the restart policy + ///
(default value is 0, which is unbounded). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Window")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Window { get; set; } = 0L; + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Placement + { + /// + /// An array of constraint expressions to limit the set of nodes where + ///
a task can be scheduled. Constraint expressions can either use a + ///
_match_ (`==`) or _exclude_ (`!=`) rule. Multiple constraints find + ///
nodes that satisfy every expression (AND match). Constraints can + ///
match node or Docker Engine labels as follows: + ///
+ ///
node attribute | matches | example + ///
---------------------|--------------------------------|----------------------------------------------- + ///
`node.id` | Node ID | `node.id==2ivku8v2gvtg4` + ///
`node.hostname` | Node hostname | `node.hostname!=node-2` + ///
`node.role` | Node role (`manager`/`worker`) | `node.role==manager` + ///
`node.platform.os` | Node operating system | `node.platform.os==windows` + ///
`node.platform.arch` | Node architecture | `node.platform.arch==x86_64` + ///
`node.labels` | User-defined node labels | `node.labels.security==high` + ///
`engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-14.04` + ///
+ ///
`engine.labels` apply to Docker Engine labels like operating system, + ///
drivers, etc. Swarm administrators add `node.labels` for operational + ///
purposes by using the [`node update endpoint`](#operation/NodeUpdate). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Constraints")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Constraints { get; set; } + + /// + /// Preferences provide a way to make the scheduler aware of factors + ///
such as topology. They are provided in order from highest to + ///
lowest precedence. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Preferences")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Preferences { get; set; } + + /// + /// Maximum number of replicas for per node (default value is 0, which + ///
is unlimited) + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MaxReplicas")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MaxReplicas { get; set; } = 0L; + + /// + /// Platforms stores all the platforms that the service's image can + ///
run on. This field is used in the platform filter for scheduling. + ///
If empty, then the platform filter is off, meaning there are no + ///
scheduling restrictions. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Platforms")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Platforms { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LogDriver + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Status + { + + [System.Text.Json.Serialization.JsonPropertyName("Timestamp")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Timestamp { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("State")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public TaskState? State { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Message")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Message { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Err")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Err { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ContainerStatus")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ContainerStatus ContainerStatus { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Mode + { + + [System.Text.Json.Serialization.JsonPropertyName("Replicated")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Replicated Replicated { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Global")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public object Global { get; set; } + + /// + /// The mode used for services with a finite number of tasks that run + ///
to a completed state. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ReplicatedJob")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ReplicatedJob ReplicatedJob { get; set; } + + /// + /// The mode used for services which run a task to the completed state + ///
on each valid node. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("GlobalJob")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public object GlobalJob { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UpdateConfig + { + /// + /// Maximum number of tasks to be updated in one iteration (0 means + ///
unlimited parallelism). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Parallelism")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Parallelism { get; set; } + + /// + /// Amount of time between updates, in nanoseconds. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Delay")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Delay { get; set; } + + /// + /// Action to take if an updated task fails to run, or stops running + ///
during the update. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("FailureAction")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UpdateConfigFailureAction? FailureAction { get; set; } + + /// + /// Amount of time to monitor each updated task for failures, in + ///
nanoseconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Monitor")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Monitor { get; set; } + + /// + /// The fraction of tasks that may fail during an update before the + ///
failure action is invoked, specified as a floating point number + ///
between 0 and 1. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MaxFailureRatio")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public double? MaxFailureRatio { get; set; } = 0D; + + /// + /// The order of operations when rolling out an updated task. Either + ///
the old task is shut down before the new task is started, or the + ///
new task is started before the old task is shut down. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Order")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UpdateConfigOrder? Order { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class RollbackConfig + { + /// + /// Maximum number of tasks to be rolled back in one iteration (0 means + ///
unlimited parallelism). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Parallelism")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Parallelism { get; set; } + + /// + /// Amount of time between rollback iterations, in nanoseconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Delay")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Delay { get; set; } + + /// + /// Action to take if an rolled back task fails to run, or stops + ///
running during the rollback. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("FailureAction")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RollbackConfigFailureAction? FailureAction { get; set; } + + /// + /// Amount of time to monitor each rolled back task for failures, in + ///
nanoseconds. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Monitor")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Monitor { get; set; } + + /// + /// The fraction of tasks that may fail during a rollback before the + ///
failure action is invoked, specified as a floating point number + ///
between 0 and 1. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MaxFailureRatio")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public double? MaxFailureRatio { get; set; } = 0D; + + /// + /// The order of operations when rolling back a task. Either the old + ///
task is shut down before the new task is started, or the new task + ///
is started before the old task is shut down. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Order")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public RollbackConfigOrder? Order { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EndpointPortConfigProtocol + { + + [System.Runtime.Serialization.EnumMember(Value = @"tcp")] + Tcp = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"udp")] + Udp = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"sctp")] + Sctp = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EndpointPortConfigPublishMode + { + + [System.Runtime.Serialization.EnumMember(Value = @"ingress")] + Ingress = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"host")] + Host = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EndpointSpecMode + { + + [System.Runtime.Serialization.EnumMember(Value = @"vip")] + Vip = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"dnsrr")] + Dnsrr = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Endpoint + { + + [System.Text.Json.Serialization.JsonPropertyName("Spec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public EndpointSpec Spec { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Ports")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Ports { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("VirtualIPs")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection VirtualIPs { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class UpdateStatus + { + + [System.Text.Json.Serialization.JsonPropertyName("State")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public UpdateStatusState? State { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("StartedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string StartedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("CompletedAt")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CompletedAt { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Message")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Message { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ServiceStatus + { + /// + /// The number of tasks for the service currently in the Running state. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RunningTasks")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? RunningTasks { get; set; } + + /// + /// The number of tasks for the service desired to be running. + ///
For replicated services, this is the replica count from the + ///
service spec. For global services, this is computed by taking + ///
count of all tasks for the service with a Desired State other + ///
than Shutdown. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("DesiredTasks")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? DesiredTasks { get; set; } + + /// + /// The number of tasks for a job that are in the Completed state. + ///
This field must be cross-referenced with the service type, as the + ///
value of 0 may mean the service is not in a job mode, or it may + ///
mean the job-mode service has no tasks yet Completed. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CompletedTasks")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? CompletedTasks { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class JobStatus + { + /// + /// JobIteration is a value increased each time a Job is executed, + ///
successfully or otherwise. "Executed", in this case, means the + ///
job as a whole has been started, not that an individual Task has + ///
been launched. A job is "Executed" when its ServiceSpec is + ///
updated. JobIteration can be used to disambiguate Tasks belonging + ///
to different executions of a job. Though JobIteration will + ///
increase with each subsequent execution, it may not necessarily + ///
increase by 1, and so JobIteration should not be used to + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("JobIteration")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public ObjectVersion JobIteration { get; set; } + + /// + /// The last time, as observed by the server, that this job was + ///
started. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LastExecution")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string LastExecution { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class HostConfig2 + { + + [System.Text.Json.Serialization.JsonPropertyName("NetworkMode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NetworkMode { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NetworkSettings2 + { + + [System.Text.Json.Serialization.JsonPropertyName("Networks")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Networks { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ContainerStateStatus + { + + [System.Runtime.Serialization.EnumMember(Value = @"created")] + Created = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"running")] + Running = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"paused")] + Paused = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"restarting")] + Restarting = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"removing")] + Removing = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"exited")] + Exited = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"dead")] + Dead = 6, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Platform2 + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Components + { + /// + /// Name of the component + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + /// + /// Version of the component + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Version")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Version { get; set; } + + /// + /// Key/value pairs of strings with additional information about the + ///
component. These values are intended for informational purposes + ///
only, and their content is not defined, and not part of the API + ///
specification. + ///
+ ///
These messages can be printed by the client as information to the user. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Details")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public object Details { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SystemInfoCgroupDriver + { + + [System.Runtime.Serialization.EnumMember(Value = @"cgroupfs")] + Cgroupfs = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"systemd")] + Systemd = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"none")] + None = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SystemInfoCgroupVersion + { + + [System.Runtime.Serialization.EnumMember(Value = @"1")] + _1 = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"2")] + _2 = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum SystemInfoIsolation + { + + [System.Runtime.Serialization.EnumMember(Value = @"default")] + Default = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"hyperv")] + Hyperv = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"process")] + Process = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DefaultAddressPools + { + /// + /// The network address in CIDR format + /// + + [System.Text.Json.Serialization.JsonPropertyName("Base")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Base { get; set; } + + /// + /// The network pool size + /// + + [System.Text.Json.Serialization.JsonPropertyName("Size")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Size { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EventMessageType + { + + [System.Runtime.Serialization.EnumMember(Value = @"builder")] + Builder = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"config")] + Config = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"container")] + Container = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"daemon")] + Daemon = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"image")] + Image = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"network")] + Network = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"node")] + Node = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"plugin")] + Plugin = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"secret")] + Secret = 8, + + [System.Runtime.Serialization.EnumMember(Value = @"service")] + Service = 9, + + [System.Runtime.Serialization.EnumMember(Value = @"volume")] + Volume = 10, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum EventMessageScope + { + + [System.Runtime.Serialization.EnumMember(Value = @"local")] + Local = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"swarm")] + Swarm = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Info + { + /// + /// The capacity of the volume in bytes. A value of 0 indicates that + ///
the capacity is unknown. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CapacityBytes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? CapacityBytes { get; set; } + + /// + /// A map of strings to strings returned from the storage plugin when + ///
the volume is created. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("VolumeContext")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary VolumeContext { get; set; } + + /// + /// The ID of the volume as returned by the CSI storage plugin. This + ///
is distinct from the volume's ID as provided by Docker. This ID + ///
is never used by the user when communicating with Docker to refer + ///
to this volume. If the ID is blank, then the Volume has not been + ///
successfully created in the plugin yet. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("VolumeID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string VolumeID { get; set; } + + /// + /// The topology this volume is actually accessible from. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AccessibleTopology")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection AccessibleTopology { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class PublishStatus + { + /// + /// The ID of the Swarm node the volume is published on. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("NodeID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NodeID { get; set; } + + /// + /// The published state of the volume. + ///
* `pending-publish` The volume should be published to this node, but the call to the controller plugin to do so has not yet been successfully completed. + ///
* `published` The volume is published successfully to the node. + ///
* `pending-node-unpublish` The volume should be unpublished from the node, and the manager is awaiting confirmation from the worker that it has done so. + ///
* `pending-controller-unpublish` The volume is successfully unpublished from the node, but has not yet been successfully unpublished on the controller. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("State")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public PublishStatusState? State { get; set; } + + /// + /// A map of strings to strings returned by the CSI controller + ///
plugin when a volume is published. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("PublishContext")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary PublishContext { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AccessMode + { + /// + /// The set of nodes this volume can be used on at one time. + ///
- `single` The volume may only be scheduled to one node at a time. + ///
- `multi` the volume may be scheduled to any supported number of nodes at a time. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Scope")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public AccessModeScope? Scope { get; set; } = DockerEngine.AccessModeScope.Single; + + /// + /// The number and way that different tasks can use this volume + ///
at one time. + ///
- `none` The volume may only be used by one task at a time. + ///
- `readonly` The volume may be used by any number of tasks, but they all must mount the volume as readonly + ///
- `onewriter` The volume may be used by any number of tasks, but only one may mount it as read/write. + ///
- `all` The volume may have any number of readers and writers. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Sharing")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public AccessModeSharing? Sharing { get; set; } = DockerEngine.AccessModeSharing.None; + + /// + /// Options for using this volume as a Mount-type volume. + ///
+ ///
Either MountVolume or BlockVolume, but not both, must be + ///
present. + ///
properties: + ///
FsType: + ///
type: "string" + ///
description: | + ///
Specifies the filesystem type for the mount volume. + ///
Optional. + ///
MountFlags: + ///
type: "array" + ///
description: | + ///
Flags to pass when mounting the volume. Optional. + ///
items: + ///
type: "string" + ///
BlockVolume: + ///
type: "object" + ///
description: | + ///
Options for using this volume as a Block-type volume. + ///
Intentionally empty. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MountVolume")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public object MountVolume { get; set; } + + /// + /// Swarm Secrets that are passed to the CSI storage plugin when + ///
operating on this volume. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Secrets")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Secrets { get; set; } + + /// + /// Requirements for the accessible topology of the volume. These + ///
fields are optional. For an in-depth description of what these + ///
fields mean, see the CSI specification. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("AccessibilityRequirements")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public AccessibilityRequirements AccessibilityRequirements { get; set; } + + /// + /// The desired capacity that the volume should be created with. If + ///
empty, the plugin will decide the capacity. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CapacityRange")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public CapacityRange CapacityRange { get; set; } + + /// + /// The availability of the volume for use in tasks. + ///
- `active` The volume is fully available for scheduling on the cluster + ///
- `pause` No new workloads should use the volume, but existing workloads are not stopped. + ///
- `drain` All workloads using this volume should be stopped and rescheduled, and no new ones should be started. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Availability")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public AccessModeAvailability? Availability { get; set; } = DockerEngine.AccessModeAvailability.Active; + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum BindOptionsPropagation + { + + [System.Runtime.Serialization.EnumMember(Value = @"private")] + Private = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"rprivate")] + Rprivate = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"shared")] + Shared = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"rshared")] + Rshared = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"slave")] + Slave = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"rslave")] + Rslave = 5, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DriverConfig + { + /// + /// Name of the driver to use to create the volume. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// key/value map of driver specific options. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class NamedResourceSpec + { + + [System.Text.Json.Serialization.JsonPropertyName("Kind")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Kind { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Value")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Value { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DiscreteResourceSpec + { + + [System.Text.Json.Serialization.JsonPropertyName("Kind")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Kind { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Value")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Value { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum LogConfigType + { + + [System.Runtime.Serialization.EnumMember(Value = @"json-file")] + JsonFile = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"syslog")] + Syslog = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"journald")] + Journald = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"gelf")] + Gelf = 3, + + [System.Runtime.Serialization.EnumMember(Value = @"fluentd")] + Fluentd = 4, + + [System.Runtime.Serialization.EnumMember(Value = @"awslogs")] + Awslogs = 5, + + [System.Runtime.Serialization.EnumMember(Value = @"splunk")] + Splunk = 6, + + [System.Runtime.Serialization.EnumMember(Value = @"etwlogs")] + Etwlogs = 7, + + [System.Runtime.Serialization.EnumMember(Value = @"none")] + None = 8, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Interface + { + + [System.Text.Json.Serialization.JsonPropertyName("Types")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Types { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Socket")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Socket { get; set; } + + /// + /// Protocol to use for clients connecting to the plugin. + /// + + [System.Text.Json.Serialization.JsonPropertyName("ProtocolScheme")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public InterfaceProtocolScheme? ProtocolScheme { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class User + { + + [System.Text.Json.Serialization.JsonPropertyName("UID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? UID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("GID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? GID { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Network2 + { + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Type { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Linux + { + + [System.Text.Json.Serialization.JsonPropertyName("Capabilities")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Capabilities { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("AllowAllDevices")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + public bool AllowAllDevices { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Devices")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Devices { get; } = new System.Collections.ObjectModel.Collection(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Args + { + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Name { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Description")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public string Description { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Settable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Settable { get; } = new System.Collections.ObjectModel.Collection(); + + [System.Text.Json.Serialization.JsonPropertyName("Value")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)] + [System.ComponentModel.DataAnnotations.Required] + public System.Collections.Generic.ICollection Value { get; } = new System.Collections.ObjectModel.Collection(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Rootfs + { + + [System.Text.Json.Serialization.JsonPropertyName("type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Type { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("diff_ids")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Diff_ids { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ExternalCAs + { + /// + /// Protocol for communication with the external CA (currently + ///
only `cfssl` is supported). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Protocol")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public ExternalCAsProtocol? Protocol { get; set; } = DockerEngine.ExternalCAsProtocol.Cfssl; + + /// + /// URL where certificate signing requests should be sent. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("URL")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string URL { get; set; } + + /// + /// An object with key/value pairs that are interpreted as + ///
protocol-specific options for the external CA driver. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + /// + /// The root CA certificate (in PEM format) this external CA uses + ///
to issue TLS certificates (assumed to be to the current swarm + ///
root CA certificate if not provided). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("CACert")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string CACert { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class LogDriver2 + { + /// + /// The log driver to use as a default for new tasks. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// Driver-specific options for the selectd log driver, specified + ///
as key/value pairs. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.IDictionary Options { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Privileges + { + /// + /// CredentialSpec for managed service account (Windows only) + /// + + [System.Text.Json.Serialization.JsonPropertyName("CredentialSpec")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public CredentialSpec CredentialSpec { get; set; } + + /// + /// SELinux labels of the container + /// + + [System.Text.Json.Serialization.JsonPropertyName("SELinuxContext")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public SELinuxContext SELinuxContext { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class DNSConfig + { + /// + /// The IP addresses of the name servers. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Nameservers")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Nameservers { get; set; } + + /// + /// A search list for host-name lookup. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Search")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Search { get; set; } + + /// + /// A list of internal resolver variables to be modified (e.g., + ///
`debug`, `ndots:3`, etc.). + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Options")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Options { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Secrets + { + /// + /// File represents a specific target that is backed by a file. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("File")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public File File { get; set; } + + /// + /// SecretID represents the ID of the specific secret that we're + ///
referencing. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SecretID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SecretID { get; set; } + + /// + /// SecretName is the name of the secret that this references, + ///
but this is just provided for lookup/display purposes. The + ///
secret in the reference will be identified by its ID. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SecretName")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SecretName { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Configs + { + /// + /// File represents a specific target that is backed by a file. + ///
+ ///
<p><br /><p> + ///
+ ///
> **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("File")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public File2 File { get; set; } + + /// + /// Runtime represents a target that is not mounted into the + ///
container but is used by the task + ///
+ ///
<p><br /><p> + ///
+ ///
> **Note**: `Configs.File` and `Configs.Runtime` are mutually + ///
> exclusive + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Runtime")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public object Runtime { get; set; } + + /// + /// ConfigID represents the ID of the specific config that we're + ///
referencing. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ConfigID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ConfigID { get; set; } + + /// + /// ConfigName is the name of the config that this references, + ///
but this is just provided for lookup/display purposes. The + ///
config in the reference will be identified by its ID. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("ConfigName")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ConfigName { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ContainerSpecIsolation + { + + [System.Runtime.Serialization.EnumMember(Value = @"default")] + Default = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"process")] + Process = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"hyperv")] + Hyperv = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Ulimits2 + { + /// + /// Name of ulimit + /// + + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// Soft limit + /// + + [System.Text.Json.Serialization.JsonPropertyName("Soft")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Soft { get; set; } + + /// + /// Hard limit + /// + + [System.Text.Json.Serialization.JsonPropertyName("Hard")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Hard { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RestartPolicy2Condition + { + + [System.Runtime.Serialization.EnumMember(Value = @"none")] + None = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"on-failure")] + OnFailure = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"any")] + Any = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Preferences + { + + [System.Text.Json.Serialization.JsonPropertyName("Spread")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public Spread Spread { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ContainerStatus + { + + [System.Text.Json.Serialization.JsonPropertyName("ContainerID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string ContainerID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("PID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? PID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("ExitCode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? ExitCode { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Replicated + { + + [System.Text.Json.Serialization.JsonPropertyName("Replicas")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? Replicas { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ReplicatedJob + { + /// + /// The maximum number of replicas to run simultaneously. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("MaxConcurrent")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? MaxConcurrent { get; set; } = 1L; + + /// + /// The total number of replicas desired to reach the Completed + ///
state. If unset, will default to the value of `MaxConcurrent` + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("TotalCompletions")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? TotalCompletions { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdateConfigFailureAction + { + + [System.Runtime.Serialization.EnumMember(Value = @"continue")] + Continue = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"pause")] + Pause = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"rollback")] + Rollback = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdateConfigOrder + { + + [System.Runtime.Serialization.EnumMember(Value = @"stop-first")] + StopFirst = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"start-first")] + StartFirst = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RollbackConfigFailureAction + { + + [System.Runtime.Serialization.EnumMember(Value = @"continue")] + Continue = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"pause")] + Pause = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum RollbackConfigOrder + { + + [System.Runtime.Serialization.EnumMember(Value = @"stop-first")] + StopFirst = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"start-first")] + StartFirst = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class VirtualIPs + { + + [System.Text.Json.Serialization.JsonPropertyName("NetworkID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string NetworkID { get; set; } + + [System.Text.Json.Serialization.JsonPropertyName("Addr")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Addr { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum UpdateStatusState + { + + [System.Runtime.Serialization.EnumMember(Value = @"updating")] + Updating = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"paused")] + Paused = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"completed")] + Completed = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum PublishStatusState + { + + [System.Runtime.Serialization.EnumMember(Value = @"pending-publish")] + PendingPublish = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"published")] + Published = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"pending-node-unpublish")] + PendingNodeUnpublish = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"pending-controller-unpublish")] + PendingControllerUnpublish = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum AccessModeScope + { + + [System.Runtime.Serialization.EnumMember(Value = @"single")] + Single = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"multi")] + Multi = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum AccessModeSharing + { + + [System.Runtime.Serialization.EnumMember(Value = @"none")] + None = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"readonly")] + Readonly = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"onewriter")] + Onewriter = 2, + + [System.Runtime.Serialization.EnumMember(Value = @"all")] + All = 3, + + } + + /// + /// One cluster volume secret entry. Defines a key-value pair that + ///
is passed to the plugin. + ///
+ ///
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Secrets2 + { + /// + /// Key is the name of the key of the key-value pair passed to + ///
the plugin. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Key")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Key { get; set; } + + /// + /// Secret is the swarm Secret object from which to read data. + ///
This can be a Secret name or ID. The Secret data is + ///
retrieved by swarm and used as the value of the key-value + ///
pair passed to the plugin. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Secret")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Secret { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class AccessibilityRequirements + { + /// + /// A list of required topologies, at least one of which the + ///
volume must be accessible from. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Requisite")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Requisite { get; set; } + + /// + /// A list of topologies that the volume should attempt to be + ///
provisioned in. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Preferred")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public System.Collections.Generic.ICollection Preferred { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CapacityRange + { + /// + /// The volume must be at least this big. The value of 0 + ///
indicates an unspecified minimum + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("RequiredBytes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? RequiredBytes { get; set; } + + /// + /// The volume must not be bigger than this. The value of 0 + ///
indicates an unspecified maximum. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("LimitBytes")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public long? LimitBytes { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum AccessModeAvailability + { + + [System.Runtime.Serialization.EnumMember(Value = @"active")] + Active = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"pause")] + Pause = 1, + + [System.Runtime.Serialization.EnumMember(Value = @"drain")] + Drain = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum InterfaceProtocolScheme + { + + [System.Runtime.Serialization.EnumMember(Value = @"")] + Empty = 0, + + [System.Runtime.Serialization.EnumMember(Value = @"moby.plugins.http/v1")] + Moby_plugins_http_v1 = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public enum ExternalCAsProtocol + { + + [System.Runtime.Serialization.EnumMember(Value = @"cfssl")] + Cfssl = 0, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class CredentialSpec + { + /// + /// Load credential spec from a Swarm Config with the given ID. + ///
The specified config must also be present in the Configs + ///
field with the Runtime property set. + ///
+ ///
<p><br /></p> + ///
+ ///
+ ///
> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + ///
> and `CredentialSpec.Config` are mutually exclusive. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Config")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Config { get; set; } + + /// + /// Load credential spec from this file. The file is read by + ///
the daemon, and must be present in the `CredentialSpecs` + ///
subdirectory in the docker data directory, which defaults + ///
to `C:\ProgramData\Docker\` on Windows. + ///
+ ///
For example, specifying `spec.json` loads + ///
`C:\ProgramData\Docker\CredentialSpecs\spec.json`. + ///
+ ///
<p><br /></p> + ///
+ ///
> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + ///
> and `CredentialSpec.Config` are mutually exclusive. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("File")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string File { get; set; } + + /// + /// Load credential spec from this value in the Windows + ///
registry. The specified registry value must be located in: + ///
+ ///
`HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + ///
+ ///
<p><br /></p> + ///
+ ///
+ ///
> **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, + ///
> and `CredentialSpec.Config` are mutually exclusive. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Registry")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Registry { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class SELinuxContext + { + /// + /// Disable SELinux + /// + + [System.Text.Json.Serialization.JsonPropertyName("Disable")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public bool? Disable { get; set; } + + /// + /// SELinux user label + /// + + [System.Text.Json.Serialization.JsonPropertyName("User")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string User { get; set; } + + /// + /// SELinux role label + /// + + [System.Text.Json.Serialization.JsonPropertyName("Role")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Role { get; set; } + + /// + /// SELinux type label + /// + + [System.Text.Json.Serialization.JsonPropertyName("Type")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Type { get; set; } + + /// + /// SELinux level label + /// + + [System.Text.Json.Serialization.JsonPropertyName("Level")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Level { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class File + { + /// + /// Name represents the final filename in the filesystem. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// UID represents the file UID. + /// + + [System.Text.Json.Serialization.JsonPropertyName("UID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UID { get; set; } + + /// + /// GID represents the file GID. + /// + + [System.Text.Json.Serialization.JsonPropertyName("GID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string GID { get; set; } + + /// + /// Mode represents the FileMode of the file. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Mode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Mode { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class File2 + { + /// + /// Name represents the final filename in the filesystem. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("Name")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string Name { get; set; } + + /// + /// UID represents the file UID. + /// + + [System.Text.Json.Serialization.JsonPropertyName("UID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string UID { get; set; } + + /// + /// GID represents the file GID. + /// + + [System.Text.Json.Serialization.JsonPropertyName("GID")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string GID { get; set; } + + /// + /// Mode represents the FileMode of the file. + /// + + [System.Text.Json.Serialization.JsonPropertyName("Mode")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public int? Mode { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class Spread + { + /// + /// label descriptor, such as `engine.labels.az`. + ///
+ ///
+ + [System.Text.Json.Serialization.JsonPropertyName("SpreadDescriptor")] + + [System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)] + public string SpreadDescriptor { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FileParameter + { + public FileParameter(System.IO.Stream data) + : this (data, null, null) + { + } + + public FileParameter(System.IO.Stream data, string fileName) + : this (data, fileName, null) + { + } + + public FileParameter(System.IO.Stream data, string fileName, string contentType) + { + Data = data; + FileName = fileName; + ContentType = contentType; + } + + public System.IO.Stream Data { get; private set; } + + public string FileName { get; private set; } + + public string ContentType { get; private set; } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class FileResponse : System.IDisposable + { + private System.IDisposable _client; + private System.IDisposable _response; + + public int StatusCode { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public System.IO.Stream Stream { get; private set; } + + public bool IsPartial + { + get { return StatusCode == 206; } + } + + public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictionary> headers, System.IO.Stream stream, System.IDisposable client, System.IDisposable response) + { + StatusCode = statusCode; + Headers = headers; + Stream = stream; + _client = client; + _response = response; + } + + public void Dispose() + { + Stream.Dispose(); + if (_response != null) + _response.Dispose(); + if (_client != null) + _client.Dispose(); + } + } + + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.20.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0))")] + public partial class ApiException : ApiException + { + public TResult Result { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 108 +#pragma warning restore 114 +#pragma warning restore 472 +#pragma warning restore 612 +#pragma warning restore 1573 +#pragma warning restore 1591 +#pragma warning restore 8073 +#pragma warning restore 3016 +#pragma warning restore 8603 +#pragma warning restore 8604 \ No newline at end of file diff --git a/src/DockerEngine/DockerEngine.csproj b/src/DockerEngine/DockerEngine.csproj new file mode 100644 index 000000000..b557c3d24 --- /dev/null +++ b/src/DockerEngine/DockerEngine.csproj @@ -0,0 +1,15 @@ + + + net6.0 + latest + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + \ No newline at end of file diff --git a/src/DockerEngine/NSwag.json b/src/DockerEngine/NSwag.json new file mode 100644 index 000000000..22e87a995 --- /dev/null +++ b/src/DockerEngine/NSwag.json @@ -0,0 +1,18 @@ +{ + "runtime": "Net60", + "documentGenerator": { + "fromDocument": { + "url": "https://docs.docker.com/reference/engine/v1.43.yaml" + } + }, + "codeGenerators": { + "openApiToCSharpClient": { + "className": "DockerClient", + "namespace": "DockerEngine", + "jsonLibrary": "SystemTextJson", + "generateImmutableArrayProperties": true, + "generateImmutableDictionaryProperties": true, + "output": "DockerClient.cs" + } + } +} \ No newline at end of file diff --git a/tests/DockerEngine.Tests/.editorconfig b/tests/DockerEngine.Tests/.editorconfig new file mode 100644 index 000000000..6f066619d --- /dev/null +++ b/tests/DockerEngine.Tests/.editorconfig @@ -0,0 +1 @@ +root = true \ No newline at end of file diff --git a/tests/DockerEngine.Tests/DockerClientTest.cs b/tests/DockerEngine.Tests/DockerClientTest.cs new file mode 100644 index 000000000..30f576f0c --- /dev/null +++ b/tests/DockerEngine.Tests/DockerClientTest.cs @@ -0,0 +1,53 @@ +namespace DockerEngine; + +public sealed class DockerClientTest : IAsyncLifetime +{ + private const string DockerHost = "0.0.0.0"; + + private const ushort DockerPort = 2375; + + private readonly IContainer _dockerContainer = new ContainerBuilder() + .WithImage("docker:24.0.5-dind") + .WithEntrypoint("dockerd") + .WithCommand("--host", "tcp://" + DockerHost + ":" + DockerPort, "--debug") + .WithPortBinding(DockerPort, true) + .WithPrivileged(true) + .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("API listen on \\[::\\]:" + DockerPort)) + .Build(); + + public System.Threading.Tasks.Task InitializeAsync() + { + return _dockerContainer.StartAsync(); + } + + public System.Threading.Tasks.Task DisposeAsync() + { + return _dockerContainer.DisposeAsync().AsTask(); + } + + [Fact] + [Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))] + public async System.Threading.Tasks.Task EstablishesConnection() + { + // Given + const string repository = "alpine"; + + const string tag = "latest"; + + // TODO: Add support for additional schemes such as TCP, SSH, Unix, and Named Pipes (npipe) daemon socket. + var dockerClient = new DockerClient(new UriBuilder(Uri.UriSchemeHttp, _dockerContainer.Hostname, _dockerContainer.GetMappedPublicPort(DockerPort)).ToString(), new HttpClient()); + + // When + // TODO: Consider creating request and response objects instead of using a lengthy list of arguments. + await dockerClient.ImageCreateAsync(repository, null, null, tag, null, string.Empty, null, null, null); + + // TODO: Somehow, the HTTP request terminates too early, and the Docker image cannot be used or is not available right away. The container creation operation returns: no such image. + await System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(3)); + + // TODO: Try to avoid wrapping the actual content within an additional (unnecessary) body type, like `Body : ContainerConfig`. + var response = await dockerClient.ContainerCreateAsync(null, null, new Body { Image = repository + ":" + tag }); + + // Then + Assert.Equal(64, response.Id.Length); + } +} \ No newline at end of file diff --git a/tests/DockerEngine.Tests/DockerEngine.Tests.csproj b/tests/DockerEngine.Tests/DockerEngine.Tests.csproj new file mode 100644 index 000000000..c40dd0fde --- /dev/null +++ b/tests/DockerEngine.Tests/DockerEngine.Tests.csproj @@ -0,0 +1,18 @@ + + + net6.0 + false + false + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/DockerEngine.Tests/Usings.cs b/tests/DockerEngine.Tests/Usings.cs new file mode 100644 index 000000000..2eb034e3f --- /dev/null +++ b/tests/DockerEngine.Tests/Usings.cs @@ -0,0 +1,6 @@ +global using System; +global using System.Net.Http; +global using DotNet.Testcontainers.Builders; +global using DotNet.Testcontainers.Commons; +global using DotNet.Testcontainers.Containers; +global using Xunit; \ No newline at end of file