This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
/
swarm.go
89 lines (77 loc) · 2.84 KB
/
swarm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2021 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package docker
import (
"context"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/client"
)
// SwarmService implements all the swarm
// related functions for the Docker mock.
type SwarmService struct{}
// SwarmGetUnlockKey is a helper function to simulate
// a mocked call to capture the unlock key for a
// Docker swarm cluster.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.SwarmGetUnlockKey
func (s *SwarmService) SwarmGetUnlockKey(ctx context.Context) (types.SwarmUnlockKeyResponse, error) {
return types.SwarmUnlockKeyResponse{}, nil
}
// SwarmInit is a helper function to simulate
// a mocked call to initialize the Docker
// swarm cluster.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.SwarmInit
func (s *SwarmService) SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error) {
return "", nil
}
// SwarmInspect is a helper function to simulate
// a mocked call to inspect the Docker swarm
// cluster.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.SwarmInspect
func (s *SwarmService) SwarmInspect(ctx context.Context) (swarm.Swarm, error) {
return swarm.Swarm{}, nil
}
// SwarmJoin is a helper function to simulate
// a mocked call to join the Docker swarm
// cluster.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.SwarmJoin
func (s *SwarmService) SwarmJoin(ctx context.Context, req swarm.JoinRequest) error {
return nil
}
// SwarmLeave is a helper function to simulate
// a mocked call to leave the Docker swarm
// cluster.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.SwarmLeave
func (s *SwarmService) SwarmLeave(ctx context.Context, force bool) error {
return nil
}
// SwarmUnlock is a helper function to simulate
// a mocked call to unlock the Docker swarm
// cluster.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.SwarmUnlock
func (s *SwarmService) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error {
return nil
}
// SwarmUpdate is a helper function to simulate
// a mocked call to update the Docker swarm
// cluster.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.SwarmUpdate
func (s *SwarmService) SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error {
return nil
}
// WARNING: DO NOT REMOVE THIS UNDER ANY CIRCUMSTANCES
//
// This line serves as a quick and efficient way to ensure that our
// SwarmService satisfies the SwarmAPIClient interface that
// the Docker client expects.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#SwarmAPIClient
var _ client.SwarmAPIClient = (*SwarmService)(nil)