var serviceListParams = new ServicesListParameters()
{
Filters = new ServiceFilter()
{
Mode = new []
{
ServiceCreationMode.Replicated
}
the Mode filter requires an ServiceCreationMode enum, but that enum is missing a couple of items
replicated-job
global-job
public class ServicesListParameters
{
[QueryStringParameter("filters", false, typeof(MapQueryStringConverter))]
public ServiceFilter Filters { get; set; }
}
public class ServiceFilter : Dictionary<string, string[]>
{
public string[] Id
{
get => this["id"];
set => this["id"] = value;
}
public string[] Label
{
get => this["label"];
set => this["label"] = value;
}
public ServiceCreationMode[] Mode
{
get => this["mode"]?.ToList().Select(m => (ServiceCreationMode)Enum.Parse(typeof(ServiceCreationMode), m)).ToArray();
set => this["mode"] = value?.Select(m => m.ToString()).ToArray();
}
public string[] Name
{
get => this["name"];
set => this["name"] = value;
}
}
public enum ServiceCreationMode
{
Replicated,
Global
}
}
Not too bad as it looks like I should be able to workaround it by directly accessing the dictionary, but then if I set "mode" = "replicated-job" in the dictionary, the "Mode" property get accessor will throw an exception with an invalid cast..
This api that lets you list swarm services
the
Mode
filter requires anServiceCreationMode
enum, but that enum is missing a couple of itemsreplicated-job
global-job
Not too bad as it looks like I should be able to workaround it by directly accessing the dictionary, but then if I set "mode" = "replicated-job" in the dictionary, the "Mode" property get accessor will throw an exception with an invalid cast..