Merge pull request #51399 from thaJeztah/swarm_enums

api/types/swarm: create types for enum-consts
This commit is contained in:
Sebastiaan van Stijn
2025-11-05 16:33:20 +01:00
committed by GitHub
7 changed files with 64 additions and 28 deletions

View File

@@ -276,7 +276,14 @@ func (sr *swarmRouter) updateService(ctx context.Context, w http.ResponseWriter,
// Get returns "" if the header does not exist
flags.EncodedRegistryAuth = r.Header.Get(registry.AuthHeader)
flags.RegistryAuthFrom = r.URL.Query().Get("registryAuthFrom")
if v := r.URL.Query().Get("registryAuthFrom"); v != "" {
switch val := types.RegistryAuthSource(v); val {
case types.RegistryAuthFromSpec, types.RegistryAuthFromPreviousSpec:
flags.RegistryAuthFrom = val
default:
return errdefs.InvalidParameter(fmt.Errorf("invalid registryAuthFrom '%s'", v))
}
}
flags.Rollback = r.URL.Query().Get("rollback")
queryRegistry := false
if v := httputils.VersionFromContext(ctx); v != "" {

View File

@@ -1,6 +1,9 @@
package swarmbackend
import "github.com/moby/moby/v2/daemon/internal/filters"
import (
"github.com/moby/moby/api/types/swarm"
"github.com/moby/moby/v2/daemon/internal/filters"
)
type ConfigListOptions struct {
Filters filters.Args
@@ -34,7 +37,7 @@ type ServiceUpdateOptions struct {
// RegistryAuthFrom specifies where to find the registry authorization
// credentials if they are not given in EncodedRegistryAuth. Valid
// values are "spec" and "previous-spec".
RegistryAuthFrom string
RegistryAuthFrom swarm.RegistryAuthSource
// Rollback indicates whether a server-side rollback should be
// performed. When this is set, the provided spec will be ignored.