dotnet / dotnet/Docker.DotNet

ServiceCreationMode is missing replicated-job and global-job

Open
#674 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
416
PR merge metrics
No merged PRs in 30d

Description

This api that lets you list swarm services

```
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
{
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..

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.