Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 9 additions & 7 deletions src/Docker.DotNet/Endpoints/ContainerOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ public async Task<CreateContainerResponse> CreateContainerAsync(CreateContainerP
throw new ArgumentNullException(nameof(parameters));
}

IQueryString? queryParameters = null;
if (!string.IsNullOrEmpty(parameters.Name))
{
queryParameters = new QueryString<CreateContainerParameters>(parameters);
}
var queryParameters = new QueryString<CreateContainerParameters>(parameters);

var data = new JsonRequestContent<CreateContainerParameters>(parameters, DockerClient.JsonSerializer);

Expand Down Expand Up @@ -130,10 +126,13 @@ public async Task<MultiplexedStream> GetContainerLogsAsync(string id, ContainerL
var containerInspectResponse = await InspectContainerAsync(id, cancellationToken)
.ConfigureAwait(false);

var containerConfig = containerInspectResponse.Config
?? throw new InvalidOperationException("Container inspect response did not include container configuration.");

var response = await _client.MakeRequestForStreamAsync([NoSuchContainerHandler], HttpMethod.Get, $"containers/{id}/logs", queryParameters, null, null, cancellationToken)
.ConfigureAwait(false);

return new MultiplexedStream(response, !containerInspectResponse.Config.Tty);
return new MultiplexedStream(response, !containerConfig.Tty);
}

public async Task<IList<ContainerFileSystemChangeResponse>> InspectChangesAsync(string id, CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -350,10 +349,13 @@ public async Task<MultiplexedStream> AttachContainerAsync(string id, ContainerAt
var containerInspectResponse = await InspectContainerAsync(id, cancellationToken)
.ConfigureAwait(false);

var containerConfig = containerInspectResponse.Config
?? throw new InvalidOperationException("Container inspect response did not include container configuration.");

var response = await _client.MakeRequestForHijackedStreamAsync([NoSuchContainerHandler], HttpMethod.Post, $"containers/{id}/attach", queryParameters, null, null, cancellationToken)
.ConfigureAwait(false);

return new MultiplexedStream(response, !containerInspectResponse.Config.Tty);
return new MultiplexedStream(response, !containerConfig.Tty);
}

public async Task<ContainerWaitResponse> WaitContainerAsync(string id, CancellationToken cancellationToken = default)
Expand Down
17 changes: 14 additions & 3 deletions src/Docker.DotNet/Endpoints/ImageOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,25 @@ private static Dictionary<string, string> RegistryAuthHeaders(AuthConfig? authCo
};
}

private static Dictionary<string, string> RegistryConfigHeaders(IEnumerable<AuthConfig>? authConfig)
private static Dictionary<string, string> RegistryConfigHeaders(IEnumerable<AuthConfig>? authConfigs)
{
var configDictionary = (authConfig ?? Array.Empty<AuthConfig>()).ToDictionary(e => e.ServerAddress, e => e);
var registryAuthConfigurations = new Dictionary<string, AuthConfig>();

foreach (var registryAuthConfiguration in authConfigs ?? Array.Empty<AuthConfig>())
{
var registryAddress = registryAuthConfiguration.ServerAddress;

if (!string.IsNullOrEmpty(registryAddress))
{
registryAuthConfigurations[registryAddress] = registryAuthConfiguration;
}
}

return new Dictionary<string, string>
{
{
RegistryConfigHeaderKey,
Convert.ToBase64String(DockerClient.JsonSerializer.SerializeToUtf8Bytes(configDictionary))
Convert.ToBase64String(DockerClient.JsonSerializer.SerializeToUtf8Bytes(registryAuthConfigurations))
}
};
}
Expand Down
5 changes: 3 additions & 2 deletions src/Docker.DotNet/Models/Actor.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class Actor // (events.Actor)
{
[JsonPropertyName("ID")]
public string ID { get; set; }
public string ID { get; set; } = default!;

[JsonPropertyName("Attributes")]
public IDictionary<string, string> Attributes { get; set; }
public IDictionary<string, string> Attributes { get; set; } = default!;
}
}
5 changes: 3 additions & 2 deletions src/Docker.DotNet/Models/Annotations.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class Annotations // (swarm.Annotations)
{
[JsonPropertyName("Name")]
public string Name { get; set; }
public string? Name { get; set; }

[JsonPropertyName("Labels")]
public IDictionary<string, string> Labels { get; set; }
public IDictionary<string, string> Labels { get; set; } = default!;
}
}
3 changes: 2 additions & 1 deletion src/Docker.DotNet/Models/AppArmorOpts.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class AppArmorOpts // (swarm.AppArmorOpts)
{
[JsonPropertyName("Mode")]
public string Mode { get; set; }
public string? Mode { get; set; }
}
}
3 changes: 2 additions & 1 deletion src/Docker.DotNet/Models/AttestationProperties.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class AttestationProperties // (image.AttestationProperties)
{
[JsonPropertyName("For")]
public string For { get; set; }
public string For { get; set; } = default!;
}
}
13 changes: 7 additions & 6 deletions src/Docker.DotNet/Models/AuthConfig.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class AuthConfig // (registry.AuthConfig)
{
[JsonPropertyName("username")]
public string Username { get; set; }
public string? Username { get; set; }

[JsonPropertyName("password")]
public string Password { get; set; }
public string? Password { get; set; }

[JsonPropertyName("auth")]
public string Auth { get; set; }
public string? Auth { get; set; }

[JsonPropertyName("serveraddress")]
public string ServerAddress { get; set; }
public string? ServerAddress { get; set; }

[JsonPropertyName("identitytoken")]
public string IdentityToken { get; set; }
public string? IdentityToken { get; set; }

[JsonPropertyName("registrytoken")]
public string RegistryToken { get; set; }
public string? RegistryToken { get; set; }
}
}
5 changes: 3 additions & 2 deletions src/Docker.DotNet/Models/AuthResponse.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class AuthResponse // (registry.AuthResponse)
{
[JsonPropertyName("IdentityToken")]
public string IdentityToken { get; set; }
public string? IdentityToken { get; set; }

[JsonPropertyName("Status")]
public string Status { get; set; }
public string Status { get; set; } = default!;
}
}
11 changes: 6 additions & 5 deletions src/Docker.DotNet/Models/BindOptions.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class BindOptions // (mount.BindOptions)
{
[JsonPropertyName("Propagation")]
public string Propagation { get; set; }
public string? Propagation { get; set; }

[JsonPropertyName("NonRecursive")]
public bool NonRecursive { get; set; }
public bool? NonRecursive { get; set; }

[JsonPropertyName("CreateMountpoint")]
public bool CreateMountpoint { get; set; }
public bool? CreateMountpoint { get; set; }

[JsonPropertyName("ReadOnlyNonRecursive")]
public bool ReadOnlyNonRecursive { get; set; }
public bool? ReadOnlyNonRecursive { get; set; }

[JsonPropertyName("ReadOnlyForceRecursive")]
public bool ReadOnlyForceRecursive { get; set; }
public bool? ReadOnlyForceRecursive { get; set; }
}
}
9 changes: 5 additions & 4 deletions src/Docker.DotNet/Models/BlkioStatEntry.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class BlkioStatEntry // (container.BlkioStatEntry)
{
[JsonPropertyName("major")]
public ulong Major { get; set; }
public ulong Major { get; set; } = default!;

[JsonPropertyName("minor")]
public ulong Minor { get; set; }
public ulong Minor { get; set; } = default!;

[JsonPropertyName("op")]
public string Op { get; set; }
public string Op { get; set; } = default!;

[JsonPropertyName("value")]
public ulong Value { get; set; }
public ulong Value { get; set; } = default!;
}
}
17 changes: 9 additions & 8 deletions src/Docker.DotNet/Models/BlkioStats.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class BlkioStats // (container.BlkioStats)
{
[JsonPropertyName("io_service_bytes_recursive")]
public IList<BlkioStatEntry> IoServiceBytesRecursive { get; set; }
public IList<BlkioStatEntry> IoServiceBytesRecursive { get; set; } = default!;

[JsonPropertyName("io_serviced_recursive")]
public IList<BlkioStatEntry> IoServicedRecursive { get; set; }
public IList<BlkioStatEntry> IoServicedRecursive { get; set; } = default!;

[JsonPropertyName("io_queue_recursive")]
public IList<BlkioStatEntry> IoQueuedRecursive { get; set; }
public IList<BlkioStatEntry> IoQueuedRecursive { get; set; } = default!;

[JsonPropertyName("io_service_time_recursive")]
public IList<BlkioStatEntry> IoServiceTimeRecursive { get; set; }
public IList<BlkioStatEntry> IoServiceTimeRecursive { get; set; } = default!;

[JsonPropertyName("io_wait_time_recursive")]
public IList<BlkioStatEntry> IoWaitTimeRecursive { get; set; }
public IList<BlkioStatEntry> IoWaitTimeRecursive { get; set; } = default!;

[JsonPropertyName("io_merged_recursive")]
public IList<BlkioStatEntry> IoMergedRecursive { get; set; }
public IList<BlkioStatEntry> IoMergedRecursive { get; set; } = default!;

[JsonPropertyName("io_time_recursive")]
public IList<BlkioStatEntry> IoTimeRecursive { get; set; }
public IList<BlkioStatEntry> IoTimeRecursive { get; set; } = default!;

[JsonPropertyName("sectors_recursive")]
public IList<BlkioStatEntry> SectorsRecursive { get; set; }
public IList<BlkioStatEntry> SectorsRecursive { get; set; } = default!;
}
}
11 changes: 6 additions & 5 deletions src/Docker.DotNet/Models/CAConfig.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class CAConfig // (swarm.CAConfig)
{
[JsonPropertyName("NodeCertExpiry")]
public long NodeCertExpiry { get; set; }
public long? NodeCertExpiry { get; set; }

[JsonPropertyName("ExternalCAs")]
public IList<ExternalCA> ExternalCAs { get; set; }
public IList<ExternalCA>? ExternalCAs { get; set; }

[JsonPropertyName("SigningCACert")]
public string SigningCACert { get; set; }
public string? SigningCACert { get; set; }

[JsonPropertyName("SigningCAKey")]
public string SigningCAKey { get; set; }
public string? SigningCAKey { get; set; }

[JsonPropertyName("ForceRotate")]
public ulong ForceRotate { get; set; }
public ulong? ForceRotate { get; set; }
}
}
9 changes: 5 additions & 4 deletions src/Docker.DotNet/Models/CPUStats.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class CPUStats // (container.CPUStats)
{
[JsonPropertyName("cpu_usage")]
public CPUUsage CPUUsage { get; set; }
public CPUUsage CPUUsage { get; set; } = default!;

[JsonPropertyName("system_cpu_usage")]
public ulong SystemUsage { get; set; }
public ulong? SystemUsage { get; set; }

[JsonPropertyName("online_cpus")]
public uint OnlineCPUs { get; set; }
public uint? OnlineCPUs { get; set; }

[JsonPropertyName("throttling_data")]
public ThrottlingData ThrottlingData { get; set; }
public ThrottlingData? ThrottlingData { get; set; }
}
}
9 changes: 5 additions & 4 deletions src/Docker.DotNet/Models/CPUUsage.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class CPUUsage // (container.CPUUsage)
{
[JsonPropertyName("total_usage")]
public ulong TotalUsage { get; set; }
public ulong TotalUsage { get; set; } = default!;

[JsonPropertyName("percpu_usage")]
public IList<ulong> PercpuUsage { get; set; }
public IList<ulong>? PercpuUsage { get; set; }

[JsonPropertyName("usage_in_kernelmode")]
public ulong UsageInKernelmode { get; set; }
public ulong UsageInKernelmode { get; set; } = default!;

[JsonPropertyName("usage_in_usermode")]
public ulong UsageInUsermode { get; set; }
public ulong UsageInUsermode { get; set; } = default!;
}
}
5 changes: 3 additions & 2 deletions src/Docker.DotNet/Models/CapacityRange.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class CapacityRange // (volume.CapacityRange)
{
[JsonPropertyName("RequiredBytes")]
public long RequiredBytes { get; set; }
public long RequiredBytes { get; set; } = default!;

[JsonPropertyName("LimitBytes")]
public long LimitBytes { get; set; }
public long LimitBytes { get; set; } = default!;
}
}
21 changes: 11 additions & 10 deletions src/Docker.DotNet/Models/ClusterInfo.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#nullable enable
namespace Docker.DotNet.Models
{
public class ClusterInfo // (swarm.ClusterInfo)
Expand All @@ -17,33 +18,33 @@ public ClusterInfo(Meta Meta)
}

[JsonPropertyName("ID")]
public string ID { get; set; }
public string ID { get; set; } = default!;

[JsonPropertyName("Version")]
public Version Version { get; set; }
public Version? Version { get; set; }

[JsonPropertyName("CreatedAt")]
public DateTime CreatedAt { get; set; }
public DateTime? CreatedAt { get; set; }

[JsonPropertyName("UpdatedAt")]
public DateTime UpdatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }

[JsonPropertyName("Spec")]
public Spec Spec { get; set; }
public Spec Spec { get; set; } = default!;

[JsonPropertyName("TLSInfo")]
public TLSInfo TLSInfo { get; set; }
public TLSInfo TLSInfo { get; set; } = default!;

[JsonPropertyName("RootRotationInProgress")]
public bool RootRotationInProgress { get; set; }
public bool RootRotationInProgress { get; set; } = default!;

[JsonPropertyName("DefaultAddrPool")]
public IList<string> DefaultAddrPool { get; set; }
public IList<string> DefaultAddrPool { get; set; } = default!;

[JsonPropertyName("SubnetSize")]
public uint SubnetSize { get; set; }
public uint SubnetSize { get; set; } = default!;

[JsonPropertyName("DataPathPort")]
public uint DataPathPort { get; set; }
public uint DataPathPort { get; set; } = default!;
}
}
Loading