Skip to content

Commit

Permalink
fix(dotnet#630): Move config values from property directly onto param…
Browse files Browse the repository at this point in the history
…eters class (dotnet#636)
  • Loading branch information
kevinboss authored Jun 6, 2023
1 parent 3441fb9 commit aacf3c2
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/Docker.DotNet/Endpoints/ImageOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ public async Task<ImagesPruneResponse> PruneImagesAsync(ImagesPruneParameters pa
throw new ArgumentNullException(nameof(parameters));
}

var data = parameters.Config == null
? null
: new JsonRequestContent<Config>(parameters.Config, this._client.JsonSerializer);
var data = new JsonRequestContent<CommitContainerChangesParameters>(parameters, this._client.JsonSerializer);

IQueryString queryParameters = new QueryString<CommitContainerChangesParameters>(parameters);
var response = await this._client.MakeRequestAsync(this._client.NoErrorHandlers, HttpMethod.Post, "commit", queryParameters, data, cancellationToken).ConfigureAwait(false);
Expand Down
115 changes: 113 additions & 2 deletions src/Docker.DotNet/Models/CommitContainerChangesParameters.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace Docker.DotNet.Models
{
[DataContract]
public class CommitContainerChangesParameters // (main.CommitContainerChangesParameters)
{
public CommitContainerChangesParameters()
{
}

public CommitContainerChangesParameters(Config Config)
{
if (Config != null)
{
this.Hostname = Config.Hostname;
this.Domainname = Config.Domainname;
this.User = Config.User;
this.AttachStdin = Config.AttachStdin;
this.AttachStdout = Config.AttachStdout;
this.AttachStderr = Config.AttachStderr;
this.ExposedPorts = Config.ExposedPorts;
this.Tty = Config.Tty;
this.OpenStdin = Config.OpenStdin;
this.StdinOnce = Config.StdinOnce;
this.Env = Config.Env;
this.Cmd = Config.Cmd;
this.Healthcheck = Config.Healthcheck;
this.ArgsEscaped = Config.ArgsEscaped;
this.Image = Config.Image;
this.Volumes = Config.Volumes;
this.WorkingDir = Config.WorkingDir;
this.Entrypoint = Config.Entrypoint;
this.NetworkDisabled = Config.NetworkDisabled;
this.MacAddress = Config.MacAddress;
this.OnBuild = Config.OnBuild;
this.Labels = Config.Labels;
this.StopSignal = Config.StopSignal;
this.StopTimeout = Config.StopTimeout;
this.Shell = Config.Shell;
}
}

[QueryStringParameter("container", true)]
public string ContainerID { get; set; }

Expand All @@ -27,7 +65,80 @@ public class CommitContainerChangesParameters // (main.CommitContainerChangesPar
[QueryStringParameter("pause", false, typeof(BoolQueryStringConverter))]
public bool? Pause { get; set; }

[DataMember(Name = "Config", EmitDefaultValue = false)]
public Config Config { get; set; }
[DataMember(Name = "Hostname", EmitDefaultValue = false)]
public string Hostname { get; set; }

[DataMember(Name = "Domainname", EmitDefaultValue = false)]
public string Domainname { get; set; }

[DataMember(Name = "User", EmitDefaultValue = false)]
public string User { get; set; }

[DataMember(Name = "AttachStdin", EmitDefaultValue = false)]
public bool AttachStdin { get; set; }

[DataMember(Name = "AttachStdout", EmitDefaultValue = false)]
public bool AttachStdout { get; set; }

[DataMember(Name = "AttachStderr", EmitDefaultValue = false)]
public bool AttachStderr { get; set; }

[DataMember(Name = "ExposedPorts", EmitDefaultValue = false)]
public IDictionary<string, EmptyStruct> ExposedPorts { get; set; }

[DataMember(Name = "Tty", EmitDefaultValue = false)]
public bool Tty { get; set; }

[DataMember(Name = "OpenStdin", EmitDefaultValue = false)]
public bool OpenStdin { get; set; }

[DataMember(Name = "StdinOnce", EmitDefaultValue = false)]
public bool StdinOnce { get; set; }

[DataMember(Name = "Env", EmitDefaultValue = false)]
public IList<string> Env { get; set; }

[DataMember(Name = "Cmd", EmitDefaultValue = false)]
public IList<string> Cmd { get; set; }

[DataMember(Name = "Healthcheck", EmitDefaultValue = false)]
public HealthConfig Healthcheck { get; set; }

[DataMember(Name = "ArgsEscaped", EmitDefaultValue = false)]
public bool ArgsEscaped { get; set; }

[DataMember(Name = "Image", EmitDefaultValue = false)]
public string Image { get; set; }

[DataMember(Name = "Volumes", EmitDefaultValue = false)]
public IDictionary<string, EmptyStruct> Volumes { get; set; }

[DataMember(Name = "WorkingDir", EmitDefaultValue = false)]
public string WorkingDir { get; set; }

[DataMember(Name = "Entrypoint", EmitDefaultValue = false)]
public IList<string> Entrypoint { get; set; }

[DataMember(Name = "NetworkDisabled", EmitDefaultValue = false)]
public bool NetworkDisabled { get; set; }

[DataMember(Name = "MacAddress", EmitDefaultValue = false)]
public string MacAddress { get; set; }

[DataMember(Name = "OnBuild", EmitDefaultValue = false)]
public IList<string> OnBuild { get; set; }

[DataMember(Name = "Labels", EmitDefaultValue = false)]
public IDictionary<string, string> Labels { get; set; }

[DataMember(Name = "StopSignal", EmitDefaultValue = false)]
public string StopSignal { get; set; }

[DataMember(Name = "StopTimeout", EmitDefaultValue = false)]
[JsonConverter(typeof(TimeSpanSecondsConverter))]
public TimeSpan? StopTimeout { get; set; }

[DataMember(Name = "Shell", EmitDefaultValue = false)]
public IList<string> Shell { get; set; }
}
}
16 changes: 8 additions & 8 deletions tools/specgen/modeldefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ type ImageBuildParameters struct {

// CommitContainerChangesParameters for POST /commit
type CommitContainerChangesParameters struct {
ContainerID string `rest:"query,container,required"`
RepositoryName string `rest:"query,repo"`
Tag string `rest:"query"`
Comment string `rest:"query"`
Author string `rest:"query"`
Changes []string `rest:"query"`
Pause bool `rest:"query"`
Config *container.Config
ContainerID string `rest:"query,container,required"`
RepositoryName string `rest:"query,repo"`
Tag string `rest:"query"`
Comment string `rest:"query"`
Author string `rest:"query"`
Changes []string `rest:"query"`
Pause bool `rest:"query"`
*container.Config `rest:"body"`
}

// CommitContainerChangesResponse for POST /commit
Expand Down

0 comments on commit aacf3c2

Please sign in to comment.