Skip to content

Commit 5b3e655

Browse files
committed
api/types: move ServiceUpdateResponse
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 48cacbc commit 5b3e655

7 files changed

Lines changed: 43 additions & 34 deletions

File tree

api/server/router/swarm/backend.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,40 @@ package swarm // import "github.com/docker/docker/api/server/router/swarm"
33
import (
44
"context"
55

6-
basictypes "github.com/docker/docker/api/types"
6+
"github.com/docker/docker/api/types"
77
"github.com/docker/docker/api/types/backend"
8-
types "github.com/docker/docker/api/types/swarm"
8+
"github.com/docker/docker/api/types/swarm"
99
)
1010

1111
// Backend abstracts a swarm manager.
1212
type Backend interface {
13-
Init(req types.InitRequest) (string, error)
14-
Join(req types.JoinRequest) error
13+
Init(req swarm.InitRequest) (string, error)
14+
Join(req swarm.JoinRequest) error
1515
Leave(ctx context.Context, force bool) error
16-
Inspect() (types.Swarm, error)
17-
Update(uint64, types.Spec, types.UpdateFlags) error
16+
Inspect() (swarm.Swarm, error)
17+
Update(uint64, swarm.Spec, swarm.UpdateFlags) error
1818
GetUnlockKey() (string, error)
19-
UnlockSwarm(req types.UnlockRequest) error
20-
GetServices(basictypes.ServiceListOptions) ([]types.Service, error)
21-
GetService(idOrName string, insertDefaults bool) (types.Service, error)
22-
CreateService(types.ServiceSpec, string, bool) (*basictypes.ServiceCreateResponse, error)
23-
UpdateService(string, uint64, types.ServiceSpec, basictypes.ServiceUpdateOptions, bool) (*basictypes.ServiceUpdateResponse, error)
19+
UnlockSwarm(req swarm.UnlockRequest) error
20+
GetServices(types.ServiceListOptions) ([]swarm.Service, error)
21+
GetService(idOrName string, insertDefaults bool) (swarm.Service, error)
22+
CreateService(swarm.ServiceSpec, string, bool) (*types.ServiceCreateResponse, error)
23+
UpdateService(string, uint64, swarm.ServiceSpec, types.ServiceUpdateOptions, bool) (*swarm.ServiceUpdateResponse, error)
2424
RemoveService(string) error
25-
ServiceLogs(context.Context, *backend.LogSelector, *basictypes.ContainerLogsOptions) (<-chan *backend.LogMessage, error)
26-
GetNodes(basictypes.NodeListOptions) ([]types.Node, error)
27-
GetNode(string) (types.Node, error)
28-
UpdateNode(string, uint64, types.NodeSpec) error
25+
ServiceLogs(context.Context, *backend.LogSelector, *types.ContainerLogsOptions) (<-chan *backend.LogMessage, error)
26+
GetNodes(types.NodeListOptions) ([]swarm.Node, error)
27+
GetNode(string) (swarm.Node, error)
28+
UpdateNode(string, uint64, swarm.NodeSpec) error
2929
RemoveNode(string, bool) error
30-
GetTasks(basictypes.TaskListOptions) ([]types.Task, error)
31-
GetTask(string) (types.Task, error)
32-
GetSecrets(opts basictypes.SecretListOptions) ([]types.Secret, error)
33-
CreateSecret(s types.SecretSpec) (string, error)
30+
GetTasks(types.TaskListOptions) ([]swarm.Task, error)
31+
GetTask(string) (swarm.Task, error)
32+
GetSecrets(opts types.SecretListOptions) ([]swarm.Secret, error)
33+
CreateSecret(s swarm.SecretSpec) (string, error)
3434
RemoveSecret(idOrName string) error
35-
GetSecret(id string) (types.Secret, error)
36-
UpdateSecret(idOrName string, version uint64, spec types.SecretSpec) error
37-
GetConfigs(opts basictypes.ConfigListOptions) ([]types.Config, error)
38-
CreateConfig(s types.ConfigSpec) (string, error)
35+
GetSecret(id string) (swarm.Secret, error)
36+
UpdateSecret(idOrName string, version uint64, spec swarm.SecretSpec) error
37+
GetConfigs(opts types.ConfigListOptions) ([]swarm.Config, error)
38+
CreateConfig(s swarm.ConfigSpec) (string, error)
3939
RemoveConfig(id string) error
40-
GetConfig(id string) (types.Config, error)
41-
UpdateConfig(idOrName string, version uint64, spec types.ConfigSpec) error
40+
GetConfig(id string) (swarm.Config, error)
41+
UpdateConfig(idOrName string, version uint64, spec swarm.ConfigSpec) error
4242
}

api/types/service_update_response.go renamed to api/types/swarm/service_update_response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package types
1+
package swarm
22

33
// This file was generated by the swagger tool.
44
// Editing this file might prove futile when you re-run the swagger generate command

api/types/types_deprecated.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package types
33
import (
44
"github.com/docker/docker/api/types/checkpoint"
55
"github.com/docker/docker/api/types/image"
6+
"github.com/docker/docker/api/types/swarm"
67
"github.com/docker/docker/api/types/system"
78
)
89

@@ -79,6 +80,11 @@ type ImageSummary = image.Summary
7980
// Deprecated: use [image.Metadata].
8081
type ImageMetadata = image.Metadata
8182

83+
// ServiceUpdateResponse service update response.
84+
//
85+
// Deprecated: use [swarm.ServiceUpdateResponse].
86+
type ServiceUpdateResponse = swarm.ServiceUpdateResponse
87+
8288
// DecodeSecurityOptions decodes a security options string slice to a type safe
8389
// [system.SecurityOpt].
8490
//

client/interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ type ServiceAPIClient interface {
145145
ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
146146
ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
147147
ServiceRemove(ctx context.Context, serviceID string) error
148-
ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
148+
ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
149149
ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
150150
TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
151151
TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)

client/service_update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
// ServiceUpdate updates a Service. The version number is required to avoid conflicting writes.
1616
// It should be the value as set *before* the update. You can find this value in the Meta field
1717
// of swarm.Service, which can be found using ServiceInspectWithRaw.
18-
func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
18+
func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
1919
// Make sure we negotiated (if the client is configured to do so),
2020
// as code below contains API-version specific handling of options.
2121
//
@@ -25,7 +25,7 @@ func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version
2525

2626
var (
2727
query = url.Values{}
28-
response = types.ServiceUpdateResponse{}
28+
response = swarm.ServiceUpdateResponse{}
2929
)
3030

3131
if options.RegistryAuthFrom != "" {

daemon/cluster/services.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRe
280280
}
281281

282282
// UpdateService updates existing service to match new properties.
283-
func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*types.ServiceUpdateResponse, error) {
284-
var resp *types.ServiceUpdateResponse
283+
func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*swarm.ServiceUpdateResponse, error) {
284+
var resp *swarm.ServiceUpdateResponse
285285

286286
err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
287287
err := c.populateNetworkID(ctx, state.controlClient, &spec)
@@ -299,7 +299,7 @@ func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swa
299299
return err
300300
}
301301

302-
resp = &types.ServiceUpdateResponse{}
302+
resp = &swarm.ServiceUpdateResponse{}
303303

304304
switch serviceSpec.Task.Runtime.(type) {
305305
case *swarmapi.TaskSpec_Attachment:

hack/generate-swagger-api.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ swagger generate model -f api/swagger.yaml \
1111
-n PluginMount \
1212
-n PluginEnv \
1313
-n PluginInterfaceType \
14-
-n Port \
15-
-n ServiceUpdateResponse
14+
-n Port
1615

1716
swagger generate model -f api/swagger.yaml \
1817
-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
@@ -40,3 +39,7 @@ swagger generate operation -f api/swagger.yaml \
4039
-n ContainerTop \
4140
-n ContainerUpdate \
4241
-n ImageHistory
42+
43+
swagger generate model -f api/swagger.yaml \
44+
-t api -m types/swarm --skip-validator -C api/swagger-gen.yaml \
45+
-n ServiceUpdateResponse

0 commit comments

Comments
 (0)