Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -16,6 +16,9 @@ type stableAPIClient interface {
|
| 16 | 16 |
ConfigAPIClient |
| 17 | 17 |
ContainerAPIClient |
| 18 | 18 |
DistributionAPIClient |
| 19 |
+ RegistrySearchClient |
|
| 20 |
+ ExecAPIClient |
|
| 21 |
+ ImageBuildAPIClient |
|
| 19 | 22 |
ImageAPIClient |
| 20 | 23 |
NetworkAPIClient |
| 21 | 24 |
PluginAPIClient |
| ... | ... |
@@ -36,6 +39,7 @@ type SwarmManagementAPIClient interface {
|
| 36 | 36 |
SwarmAPIClient |
| 37 | 37 |
NodeAPIClient |
| 38 | 38 |
ServiceAPIClient |
| 39 |
+ TaskAPIClient |
|
| 39 | 40 |
SecretAPIClient |
| 40 | 41 |
ConfigAPIClient |
| 41 | 42 |
} |
| ... | ... |
@@ -47,40 +51,45 @@ type HijackDialer interface {
|
| 47 | 47 |
|
| 48 | 48 |
// ContainerAPIClient defines API client methods for the containers |
| 49 | 49 |
type ContainerAPIClient interface {
|
| 50 |
- ContainerAttach(ctx context.Context, container string, options ContainerAttachOptions) (ContainerAttachResult, error) |
|
| 51 |
- ContainerCommit(ctx context.Context, container string, options ContainerCommitOptions) (ContainerCommitResult, error) |
|
| 52 | 50 |
ContainerCreate(ctx context.Context, options ContainerCreateOptions) (ContainerCreateResult, error) |
| 53 |
- ContainerDiff(ctx context.Context, container string, options ContainerDiffOptions) (ContainerDiffResult, error) |
|
| 54 |
- ExecAPIClient |
|
| 55 |
- ContainerExport(ctx context.Context, container string, options ContainerExportOptions) (ContainerExportResult, error) |
|
| 56 | 51 |
ContainerInspect(ctx context.Context, container string, options ContainerInspectOptions) (ContainerInspectResult, error) |
| 57 |
- ContainerKill(ctx context.Context, container string, options ContainerKillOptions) (ContainerKillResult, error) |
|
| 58 | 52 |
ContainerList(ctx context.Context, options ContainerListOptions) (ContainerListResult, error) |
| 53 |
+ ContainerUpdate(ctx context.Context, container string, updateConfig ContainerUpdateOptions) (ContainerUpdateResult, error) |
|
| 54 |
+ ContainerRemove(ctx context.Context, container string, options ContainerRemoveOptions) (ContainerRemoveResult, error) |
|
| 55 |
+ ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 56 |
+ |
|
| 59 | 57 |
ContainerLogs(ctx context.Context, container string, options ContainerLogsOptions) (ContainerLogsResult, error) |
| 58 |
+ |
|
| 59 |
+ ContainerStart(ctx context.Context, container string, options ContainerStartOptions) (ContainerStartResult, error) |
|
| 60 |
+ ContainerStop(ctx context.Context, container string, options ContainerStopOptions) (ContainerStopResult, error) |
|
| 61 |
+ ContainerRestart(ctx context.Context, container string, options ContainerRestartOptions) (ContainerRestartResult, error) |
|
| 60 | 62 |
ContainerPause(ctx context.Context, container string, options ContainerPauseOptions) (ContainerPauseResult, error) |
| 61 |
- ContainerRemove(ctx context.Context, container string, options ContainerRemoveOptions) (ContainerRemoveResult, error) |
|
| 63 |
+ ContainerUnpause(ctx context.Context, container string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) |
|
| 64 |
+ ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult |
|
| 65 |
+ ContainerKill(ctx context.Context, container string, options ContainerKillOptions) (ContainerKillResult, error) |
|
| 66 |
+ |
|
| 62 | 67 |
ContainerRename(ctx context.Context, container string, options ContainerRenameOptions) (ContainerRenameResult, error) |
| 63 | 68 |
ContainerResize(ctx context.Context, container string, options ContainerResizeOptions) (ContainerResizeResult, error) |
| 64 |
- ContainerRestart(ctx context.Context, container string, options ContainerRestartOptions) (ContainerRestartResult, error) |
|
| 65 |
- ContainerStatPath(ctx context.Context, container string, options ContainerStatPathOptions) (ContainerStatPathResult, error) |
|
| 69 |
+ ContainerAttach(ctx context.Context, container string, options ContainerAttachOptions) (ContainerAttachResult, error) |
|
| 70 |
+ ContainerCommit(ctx context.Context, container string, options ContainerCommitOptions) (ContainerCommitResult, error) |
|
| 71 |
+ ContainerDiff(ctx context.Context, container string, options ContainerDiffOptions) (ContainerDiffResult, error) |
|
| 72 |
+ ContainerExport(ctx context.Context, container string, options ContainerExportOptions) (ContainerExportResult, error) |
|
| 73 |
+ |
|
| 66 | 74 |
ContainerStats(ctx context.Context, container string, options ContainerStatsOptions) (ContainerStatsResult, error) |
| 67 |
- ContainerStart(ctx context.Context, container string, options ContainerStartOptions) (ContainerStartResult, error) |
|
| 68 |
- ContainerStop(ctx context.Context, container string, options ContainerStopOptions) (ContainerStopResult, error) |
|
| 69 | 75 |
ContainerTop(ctx context.Context, container string, options ContainerTopOptions) (ContainerTopResult, error) |
| 70 |
- ContainerUnpause(ctx context.Context, container string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) |
|
| 71 |
- ContainerUpdate(ctx context.Context, container string, updateConfig ContainerUpdateOptions) (ContainerUpdateResult, error) |
|
| 72 |
- ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult |
|
| 76 |
+ |
|
| 77 |
+ ContainerStatPath(ctx context.Context, container string, options ContainerStatPathOptions) (ContainerStatPathResult, error) |
|
| 73 | 78 |
CopyFromContainer(ctx context.Context, container string, options CopyFromContainerOptions) (CopyFromContainerResult, error) |
| 74 | 79 |
CopyToContainer(ctx context.Context, container string, options CopyToContainerOptions) (CopyToContainerResult, error) |
| 75 |
- ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 76 | 80 |
} |
| 77 | 81 |
|
| 78 | 82 |
type ExecAPIClient interface {
|
| 79 | 83 |
ExecCreate(ctx context.Context, container string, options ExecCreateOptions) (ExecCreateResult, error) |
| 80 |
- ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) |
|
| 81 |
- ExecAttach(ctx context.Context, execID string, options ExecAttachOptions) (ExecAttachResult, error) |
|
| 82 | 84 |
ExecInspect(ctx context.Context, execID string, options ExecInspectOptions) (ExecInspectResult, error) |
| 83 | 85 |
ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) |
| 86 |
+ |
|
| 87 |
+ ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) |
|
| 88 |
+ ExecAttach(ctx context.Context, execID string, options ExecAttachOptions) (ExecAttachResult, error) |
|
| 84 | 89 |
} |
| 85 | 90 |
|
| 86 | 91 |
// DistributionAPIClient defines API client methods for the registry |
| ... | ... |
@@ -88,58 +97,69 @@ type DistributionAPIClient interface {
|
| 88 | 88 |
DistributionInspect(ctx context.Context, image string, options DistributionInspectOptions) (DistributionInspectResult, error) |
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 |
-// ImageAPIClient defines API client methods for the images |
|
| 92 |
-type ImageAPIClient interface {
|
|
| 91 |
+type RegistrySearchClient interface {
|
|
| 92 |
+ ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) |
|
| 93 |
+} |
|
| 94 |
+ |
|
| 95 |
+// ImageBuildAPIClient defines API client methods for building images |
|
| 96 |
+// using the REST API. |
|
| 97 |
+type ImageBuildAPIClient interface {
|
|
| 93 | 98 |
ImageBuild(ctx context.Context, context io.Reader, options ImageBuildOptions) (ImageBuildResult, error) |
| 94 | 99 |
BuildCachePrune(ctx context.Context, opts BuildCachePruneOptions) (BuildCachePruneResult, error) |
| 95 | 100 |
BuildCancel(ctx context.Context, id string, opts BuildCancelOptions) (BuildCancelResult, error) |
| 101 |
+} |
|
| 102 |
+ |
|
| 103 |
+// ImageAPIClient defines API client methods for the images |
|
| 104 |
+type ImageAPIClient interface {
|
|
| 96 | 105 |
ImageImport(ctx context.Context, source ImageImportSource, ref string, options ImageImportOptions) (ImageImportResult, error) |
| 97 | 106 |
|
| 98 | 107 |
ImageList(ctx context.Context, options ImageListOptions) (ImageListResult, error) |
| 99 | 108 |
ImagePull(ctx context.Context, ref string, options ImagePullOptions) (ImagePullResponse, error) |
| 100 | 109 |
ImagePush(ctx context.Context, ref string, options ImagePushOptions) (ImagePushResponse, error) |
| 101 | 110 |
ImageRemove(ctx context.Context, image string, options ImageRemoveOptions) (ImageRemoveResult, error) |
| 102 |
- ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) |
|
| 103 | 111 |
ImageTag(ctx context.Context, options ImageTagOptions) (ImageTagResult, error) |
| 104 | 112 |
ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) |
| 105 | 113 |
|
| 106 | 114 |
ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (ImageInspectResult, error) |
| 107 | 115 |
ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) (ImageHistoryResult, error) |
| 116 |
+ |
|
| 108 | 117 |
ImageLoad(ctx context.Context, input io.Reader, _ ...ImageLoadOption) (ImageLoadResult, error) |
| 109 | 118 |
ImageSave(ctx context.Context, images []string, _ ...ImageSaveOption) (ImageSaveResult, error) |
| 110 | 119 |
} |
| 111 | 120 |
|
| 112 | 121 |
// NetworkAPIClient defines API client methods for the networks |
| 113 | 122 |
type NetworkAPIClient interface {
|
| 114 |
- NetworkConnect(ctx context.Context, network string, options NetworkConnectOptions) (NetworkConnectResult, error) |
|
| 115 | 123 |
NetworkCreate(ctx context.Context, name string, options NetworkCreateOptions) (NetworkCreateResult, error) |
| 116 |
- NetworkDisconnect(ctx context.Context, network string, options NetworkDisconnectOptions) (NetworkDisconnectResult, error) |
|
| 117 | 124 |
NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (NetworkInspectResult, error) |
| 118 | 125 |
NetworkList(ctx context.Context, options NetworkListOptions) (NetworkListResult, error) |
| 119 | 126 |
NetworkRemove(ctx context.Context, network string, options NetworkRemoveOptions) (NetworkRemoveResult, error) |
| 120 | 127 |
NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) |
| 128 |
+ |
|
| 129 |
+ NetworkConnect(ctx context.Context, network string, options NetworkConnectOptions) (NetworkConnectResult, error) |
|
| 130 |
+ NetworkDisconnect(ctx context.Context, network string, options NetworkDisconnectOptions) (NetworkDisconnectResult, error) |
|
| 121 | 131 |
} |
| 122 | 132 |
|
| 123 | 133 |
// NodeAPIClient defines API client methods for the nodes |
| 124 | 134 |
type NodeAPIClient interface {
|
| 125 | 135 |
NodeInspect(ctx context.Context, nodeID string, options NodeInspectOptions) (NodeInspectResult, error) |
| 126 | 136 |
NodeList(ctx context.Context, options NodeListOptions) (NodeListResult, error) |
| 127 |
- NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) |
|
| 128 | 137 |
NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) |
| 138 |
+ NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) |
|
| 129 | 139 |
} |
| 130 | 140 |
|
| 131 | 141 |
// PluginAPIClient defines API client methods for the plugins |
| 132 | 142 |
type PluginAPIClient interface {
|
| 143 |
+ PluginCreate(ctx context.Context, createContext io.Reader, options PluginCreateOptions) (PluginCreateResult, error) |
|
| 144 |
+ PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (PluginInstallResult, error) |
|
| 145 |
+ PluginInspect(ctx context.Context, name string, options PluginInspectOptions) (PluginInspectResult, error) |
|
| 133 | 146 |
PluginList(ctx context.Context, options PluginListOptions) (PluginListResult, error) |
| 134 | 147 |
PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) (PluginRemoveResult, error) |
| 148 |
+ |
|
| 135 | 149 |
PluginEnable(ctx context.Context, name string, options PluginEnableOptions) (PluginEnableResult, error) |
| 136 | 150 |
PluginDisable(ctx context.Context, name string, options PluginDisableOptions) (PluginDisableResult, error) |
| 137 |
- PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (PluginInstallResult, error) |
|
| 138 | 151 |
PluginUpgrade(ctx context.Context, name string, options PluginUpgradeOptions) (PluginUpgradeResult, error) |
| 139 | 152 |
PluginPush(ctx context.Context, name string, options PluginPushOptions) (PluginPushResult, error) |
| 140 | 153 |
PluginSet(ctx context.Context, name string, options PluginSetOptions) (PluginSetResult, error) |
| 141 |
- PluginInspect(ctx context.Context, name string, options PluginInspectOptions) (PluginInspectResult, error) |
|
| 142 |
- PluginCreate(ctx context.Context, createContext io.Reader, options PluginCreateOptions) (PluginCreateResult, error) |
|
| 143 | 154 |
} |
| 144 | 155 |
|
| 145 | 156 |
// ServiceAPIClient defines API client methods for the services |
| ... | ... |
@@ -147,23 +167,30 @@ type ServiceAPIClient interface {
|
| 147 | 147 |
ServiceCreate(ctx context.Context, options ServiceCreateOptions) (ServiceCreateResult, error) |
| 148 | 148 |
ServiceInspect(ctx context.Context, serviceID string, options ServiceInspectOptions) (ServiceInspectResult, error) |
| 149 | 149 |
ServiceList(ctx context.Context, options ServiceListOptions) (ServiceListResult, error) |
| 150 |
- ServiceRemove(ctx context.Context, serviceID string, options ServiceRemoveOptions) (ServiceRemoveResult, error) |
|
| 151 | 150 |
ServiceUpdate(ctx context.Context, serviceID string, options ServiceUpdateOptions) (ServiceUpdateResult, error) |
| 151 |
+ ServiceRemove(ctx context.Context, serviceID string, options ServiceRemoveOptions) (ServiceRemoveResult, error) |
|
| 152 |
+ |
|
| 152 | 153 |
ServiceLogs(ctx context.Context, serviceID string, options ServiceLogsOptions) (ServiceLogsResult, error) |
| 153 |
- TaskLogs(ctx context.Context, taskID string, options TaskLogsOptions) (TaskLogsResult, error) |
|
| 154 |
+} |
|
| 155 |
+ |
|
| 156 |
+// TaskAPIClient defines API client methods to manage swarm tasks. |
|
| 157 |
+type TaskAPIClient interface {
|
|
| 154 | 158 |
TaskInspect(ctx context.Context, taskID string, options TaskInspectOptions) (TaskInspectResult, error) |
| 155 | 159 |
TaskList(ctx context.Context, options TaskListOptions) (TaskListResult, error) |
| 160 |
+ |
|
| 161 |
+ TaskLogs(ctx context.Context, taskID string, options TaskLogsOptions) (TaskLogsResult, error) |
|
| 156 | 162 |
} |
| 157 | 163 |
|
| 158 | 164 |
// SwarmAPIClient defines API client methods for the swarm |
| 159 | 165 |
type SwarmAPIClient interface {
|
| 160 | 166 |
SwarmInit(ctx context.Context, options SwarmInitOptions) (SwarmInitResult, error) |
| 161 | 167 |
SwarmJoin(ctx context.Context, options SwarmJoinOptions) (SwarmJoinResult, error) |
| 162 |
- SwarmGetUnlockKey(ctx context.Context) (SwarmGetUnlockKeyResult, error) |
|
| 163 |
- SwarmUnlock(ctx context.Context, options SwarmUnlockOptions) (SwarmUnlockResult, error) |
|
| 164 |
- SwarmLeave(ctx context.Context, options SwarmLeaveOptions) (SwarmLeaveResult, error) |
|
| 165 | 168 |
SwarmInspect(ctx context.Context, options SwarmInspectOptions) (SwarmInspectResult, error) |
| 166 | 169 |
SwarmUpdate(ctx context.Context, options SwarmUpdateOptions) (SwarmUpdateResult, error) |
| 170 |
+ SwarmLeave(ctx context.Context, options SwarmLeaveOptions) (SwarmLeaveResult, error) |
|
| 171 |
+ |
|
| 172 |
+ SwarmGetUnlockKey(ctx context.Context) (SwarmGetUnlockKeyResult, error) |
|
| 173 |
+ SwarmUnlock(ctx context.Context, options SwarmUnlockOptions) (SwarmUnlockResult, error) |
|
| 167 | 174 |
} |
| 168 | 175 |
|
| 169 | 176 |
// SystemAPIClient defines API client methods for the system |
| ... | ... |
@@ -180,25 +207,25 @@ type VolumeAPIClient interface {
|
| 180 | 180 |
VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) |
| 181 | 181 |
VolumeInspect(ctx context.Context, volumeID string, options VolumeInspectOptions) (VolumeInspectResult, error) |
| 182 | 182 |
VolumeList(ctx context.Context, options VolumeListOptions) (VolumeListResult, error) |
| 183 |
+ VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) |
|
| 183 | 184 |
VolumeRemove(ctx context.Context, volumeID string, options VolumeRemoveOptions) (VolumeRemoveResult, error) |
| 184 | 185 |
VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) |
| 185 |
- VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) |
|
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 | 188 |
// SecretAPIClient defines API client methods for secrets |
| 189 | 189 |
type SecretAPIClient interface {
|
| 190 |
- SecretList(ctx context.Context, options SecretListOptions) (SecretListResult, error) |
|
| 191 | 190 |
SecretCreate(ctx context.Context, options SecretCreateOptions) (SecretCreateResult, error) |
| 192 |
- SecretRemove(ctx context.Context, id string, options SecretRemoveOptions) (SecretRemoveResult, error) |
|
| 193 | 191 |
SecretInspect(ctx context.Context, id string, options SecretInspectOptions) (SecretInspectResult, error) |
| 192 |
+ SecretList(ctx context.Context, options SecretListOptions) (SecretListResult, error) |
|
| 194 | 193 |
SecretUpdate(ctx context.Context, id string, options SecretUpdateOptions) (SecretUpdateResult, error) |
| 194 |
+ SecretRemove(ctx context.Context, id string, options SecretRemoveOptions) (SecretRemoveResult, error) |
|
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 | 197 |
// ConfigAPIClient defines API client methods for configs |
| 198 | 198 |
type ConfigAPIClient interface {
|
| 199 |
- ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) |
|
| 200 | 199 |
ConfigCreate(ctx context.Context, options ConfigCreateOptions) (ConfigCreateResult, error) |
| 201 |
- ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) |
|
| 202 | 200 |
ConfigInspect(ctx context.Context, id string, options ConfigInspectOptions) (ConfigInspectResult, error) |
| 201 |
+ ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) |
|
| 203 | 202 |
ConfigUpdate(ctx context.Context, id string, options ConfigUpdateOptions) (ConfigUpdateResult, error) |
| 203 |
+ ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) |
|
| 204 | 204 |
} |
| ... | ... |
@@ -218,7 +218,7 @@ func ServiceWithMemorySwappiness(swappiness *int64) ServiceSpecOpt {
|
| 218 | 218 |
} |
| 219 | 219 |
|
| 220 | 220 |
// GetRunningTasks gets the list of running tasks for a service |
| 221 |
-func GetRunningTasks(ctx context.Context, t *testing.T, c client.ServiceAPIClient, serviceID string) []swarmtypes.Task {
|
|
| 221 |
+func GetRunningTasks(ctx context.Context, t *testing.T, c client.TaskAPIClient, serviceID string) []swarmtypes.Task {
|
|
| 222 | 222 |
t.Helper() |
| 223 | 223 |
|
| 224 | 224 |
taskList, err := c.TaskList(ctx, client.TaskListOptions{
|
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 | 12 |
// NoTasksForService verifies that there are no more tasks for the given service |
| 13 |
-func NoTasksForService(ctx context.Context, apiClient client.ServiceAPIClient, serviceID string) func(log poll.LogT) poll.Result {
|
|
| 13 |
+func NoTasksForService(ctx context.Context, apiClient client.TaskAPIClient, serviceID string) func(log poll.LogT) poll.Result {
|
|
| 14 | 14 |
return func(log poll.LogT) poll.Result {
|
| 15 | 15 |
taskList, err := apiClient.TaskList(ctx, client.TaskListOptions{
|
| 16 | 16 |
Filters: make(client.Filters).Add("service", serviceID),
|
| ... | ... |
@@ -30,7 +30,7 @@ func NoTasksForService(ctx context.Context, apiClient client.ServiceAPIClient, s |
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
// NoTasks verifies that all tasks are gone |
| 33 |
-func NoTasks(ctx context.Context, apiClient client.ServiceAPIClient) func(log poll.LogT) poll.Result {
|
|
| 33 |
+func NoTasks(ctx context.Context, apiClient client.TaskAPIClient) func(log poll.LogT) poll.Result {
|
|
| 34 | 34 |
return func(log poll.LogT) poll.Result {
|
| 35 | 35 |
taskResult, err := apiClient.TaskList(ctx, client.TaskListOptions{})
|
| 36 | 36 |
switch {
|
| ... | ... |
@@ -45,7 +45,7 @@ func NoTasks(ctx context.Context, apiClient client.ServiceAPIClient) func(log po |
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 | 47 |
// RunningTasksCount verifies there are `instances` tasks running for `serviceID` |
| 48 |
-func RunningTasksCount(ctx context.Context, apiClient client.ServiceAPIClient, serviceID string, instances uint64) func(log poll.LogT) poll.Result {
|
|
| 48 |
+func RunningTasksCount(ctx context.Context, apiClient client.TaskAPIClient, serviceID string, instances uint64) func(log poll.LogT) poll.Result {
|
|
| 49 | 49 |
return func(log poll.LogT) poll.Result {
|
| 50 | 50 |
taskList, err := apiClient.TaskList(ctx, client.TaskListOptions{
|
| 51 | 51 |
Filters: make(client.Filters).Add("service", serviceID),
|
| ... | ... |
@@ -84,7 +84,7 @@ func RunningTasksCount(ctx context.Context, apiClient client.ServiceAPIClient, s |
| 84 | 84 |
// JobComplete is a poll function for determining that a ReplicatedJob is |
| 85 | 85 |
// completed additionally, while polling, it verifies that the job never |
| 86 | 86 |
// exceeds MaxConcurrent running tasks |
| 87 |
-func JobComplete(ctx context.Context, apiClient client.ServiceAPIClient, service swarmtypes.Service) func(log poll.LogT) poll.Result {
|
|
| 87 |
+func JobComplete(ctx context.Context, apiClient client.TaskAPIClient, service swarmtypes.Service) func(log poll.LogT) poll.Result {
|
|
| 88 | 88 |
filter := make(client.Filters).Add("service", service.ID)
|
| 89 | 89 |
|
| 90 | 90 |
var jobIteration swarmtypes.Version |
| ... | ... |
@@ -16,6 +16,9 @@ type stableAPIClient interface {
|
| 16 | 16 |
ConfigAPIClient |
| 17 | 17 |
ContainerAPIClient |
| 18 | 18 |
DistributionAPIClient |
| 19 |
+ RegistrySearchClient |
|
| 20 |
+ ExecAPIClient |
|
| 21 |
+ ImageBuildAPIClient |
|
| 19 | 22 |
ImageAPIClient |
| 20 | 23 |
NetworkAPIClient |
| 21 | 24 |
PluginAPIClient |
| ... | ... |
@@ -36,6 +39,7 @@ type SwarmManagementAPIClient interface {
|
| 36 | 36 |
SwarmAPIClient |
| 37 | 37 |
NodeAPIClient |
| 38 | 38 |
ServiceAPIClient |
| 39 |
+ TaskAPIClient |
|
| 39 | 40 |
SecretAPIClient |
| 40 | 41 |
ConfigAPIClient |
| 41 | 42 |
} |
| ... | ... |
@@ -47,40 +51,45 @@ type HijackDialer interface {
|
| 47 | 47 |
|
| 48 | 48 |
// ContainerAPIClient defines API client methods for the containers |
| 49 | 49 |
type ContainerAPIClient interface {
|
| 50 |
- ContainerAttach(ctx context.Context, container string, options ContainerAttachOptions) (ContainerAttachResult, error) |
|
| 51 |
- ContainerCommit(ctx context.Context, container string, options ContainerCommitOptions) (ContainerCommitResult, error) |
|
| 52 | 50 |
ContainerCreate(ctx context.Context, options ContainerCreateOptions) (ContainerCreateResult, error) |
| 53 |
- ContainerDiff(ctx context.Context, container string, options ContainerDiffOptions) (ContainerDiffResult, error) |
|
| 54 |
- ExecAPIClient |
|
| 55 |
- ContainerExport(ctx context.Context, container string, options ContainerExportOptions) (ContainerExportResult, error) |
|
| 56 | 51 |
ContainerInspect(ctx context.Context, container string, options ContainerInspectOptions) (ContainerInspectResult, error) |
| 57 |
- ContainerKill(ctx context.Context, container string, options ContainerKillOptions) (ContainerKillResult, error) |
|
| 58 | 52 |
ContainerList(ctx context.Context, options ContainerListOptions) (ContainerListResult, error) |
| 53 |
+ ContainerUpdate(ctx context.Context, container string, updateConfig ContainerUpdateOptions) (ContainerUpdateResult, error) |
|
| 54 |
+ ContainerRemove(ctx context.Context, container string, options ContainerRemoveOptions) (ContainerRemoveResult, error) |
|
| 55 |
+ ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 56 |
+ |
|
| 59 | 57 |
ContainerLogs(ctx context.Context, container string, options ContainerLogsOptions) (ContainerLogsResult, error) |
| 58 |
+ |
|
| 59 |
+ ContainerStart(ctx context.Context, container string, options ContainerStartOptions) (ContainerStartResult, error) |
|
| 60 |
+ ContainerStop(ctx context.Context, container string, options ContainerStopOptions) (ContainerStopResult, error) |
|
| 61 |
+ ContainerRestart(ctx context.Context, container string, options ContainerRestartOptions) (ContainerRestartResult, error) |
|
| 60 | 62 |
ContainerPause(ctx context.Context, container string, options ContainerPauseOptions) (ContainerPauseResult, error) |
| 61 |
- ContainerRemove(ctx context.Context, container string, options ContainerRemoveOptions) (ContainerRemoveResult, error) |
|
| 63 |
+ ContainerUnpause(ctx context.Context, container string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) |
|
| 64 |
+ ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult |
|
| 65 |
+ ContainerKill(ctx context.Context, container string, options ContainerKillOptions) (ContainerKillResult, error) |
|
| 66 |
+ |
|
| 62 | 67 |
ContainerRename(ctx context.Context, container string, options ContainerRenameOptions) (ContainerRenameResult, error) |
| 63 | 68 |
ContainerResize(ctx context.Context, container string, options ContainerResizeOptions) (ContainerResizeResult, error) |
| 64 |
- ContainerRestart(ctx context.Context, container string, options ContainerRestartOptions) (ContainerRestartResult, error) |
|
| 65 |
- ContainerStatPath(ctx context.Context, container string, options ContainerStatPathOptions) (ContainerStatPathResult, error) |
|
| 69 |
+ ContainerAttach(ctx context.Context, container string, options ContainerAttachOptions) (ContainerAttachResult, error) |
|
| 70 |
+ ContainerCommit(ctx context.Context, container string, options ContainerCommitOptions) (ContainerCommitResult, error) |
|
| 71 |
+ ContainerDiff(ctx context.Context, container string, options ContainerDiffOptions) (ContainerDiffResult, error) |
|
| 72 |
+ ContainerExport(ctx context.Context, container string, options ContainerExportOptions) (ContainerExportResult, error) |
|
| 73 |
+ |
|
| 66 | 74 |
ContainerStats(ctx context.Context, container string, options ContainerStatsOptions) (ContainerStatsResult, error) |
| 67 |
- ContainerStart(ctx context.Context, container string, options ContainerStartOptions) (ContainerStartResult, error) |
|
| 68 |
- ContainerStop(ctx context.Context, container string, options ContainerStopOptions) (ContainerStopResult, error) |
|
| 69 | 75 |
ContainerTop(ctx context.Context, container string, options ContainerTopOptions) (ContainerTopResult, error) |
| 70 |
- ContainerUnpause(ctx context.Context, container string, options ContainerUnpauseOptions) (ContainerUnpauseResult, error) |
|
| 71 |
- ContainerUpdate(ctx context.Context, container string, updateConfig ContainerUpdateOptions) (ContainerUpdateResult, error) |
|
| 72 |
- ContainerWait(ctx context.Context, container string, options ContainerWaitOptions) ContainerWaitResult |
|
| 76 |
+ |
|
| 77 |
+ ContainerStatPath(ctx context.Context, container string, options ContainerStatPathOptions) (ContainerStatPathResult, error) |
|
| 73 | 78 |
CopyFromContainer(ctx context.Context, container string, options CopyFromContainerOptions) (CopyFromContainerResult, error) |
| 74 | 79 |
CopyToContainer(ctx context.Context, container string, options CopyToContainerOptions) (CopyToContainerResult, error) |
| 75 |
- ContainerPrune(ctx context.Context, opts ContainerPruneOptions) (ContainerPruneResult, error) |
|
| 76 | 80 |
} |
| 77 | 81 |
|
| 78 | 82 |
type ExecAPIClient interface {
|
| 79 | 83 |
ExecCreate(ctx context.Context, container string, options ExecCreateOptions) (ExecCreateResult, error) |
| 80 |
- ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) |
|
| 81 |
- ExecAttach(ctx context.Context, execID string, options ExecAttachOptions) (ExecAttachResult, error) |
|
| 82 | 84 |
ExecInspect(ctx context.Context, execID string, options ExecInspectOptions) (ExecInspectResult, error) |
| 83 | 85 |
ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) |
| 86 |
+ |
|
| 87 |
+ ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) |
|
| 88 |
+ ExecAttach(ctx context.Context, execID string, options ExecAttachOptions) (ExecAttachResult, error) |
|
| 84 | 89 |
} |
| 85 | 90 |
|
| 86 | 91 |
// DistributionAPIClient defines API client methods for the registry |
| ... | ... |
@@ -88,58 +97,69 @@ type DistributionAPIClient interface {
|
| 88 | 88 |
DistributionInspect(ctx context.Context, image string, options DistributionInspectOptions) (DistributionInspectResult, error) |
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 |
-// ImageAPIClient defines API client methods for the images |
|
| 92 |
-type ImageAPIClient interface {
|
|
| 91 |
+type RegistrySearchClient interface {
|
|
| 92 |
+ ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) |
|
| 93 |
+} |
|
| 94 |
+ |
|
| 95 |
+// ImageBuildAPIClient defines API client methods for building images |
|
| 96 |
+// using the REST API. |
|
| 97 |
+type ImageBuildAPIClient interface {
|
|
| 93 | 98 |
ImageBuild(ctx context.Context, context io.Reader, options ImageBuildOptions) (ImageBuildResult, error) |
| 94 | 99 |
BuildCachePrune(ctx context.Context, opts BuildCachePruneOptions) (BuildCachePruneResult, error) |
| 95 | 100 |
BuildCancel(ctx context.Context, id string, opts BuildCancelOptions) (BuildCancelResult, error) |
| 101 |
+} |
|
| 102 |
+ |
|
| 103 |
+// ImageAPIClient defines API client methods for the images |
|
| 104 |
+type ImageAPIClient interface {
|
|
| 96 | 105 |
ImageImport(ctx context.Context, source ImageImportSource, ref string, options ImageImportOptions) (ImageImportResult, error) |
| 97 | 106 |
|
| 98 | 107 |
ImageList(ctx context.Context, options ImageListOptions) (ImageListResult, error) |
| 99 | 108 |
ImagePull(ctx context.Context, ref string, options ImagePullOptions) (ImagePullResponse, error) |
| 100 | 109 |
ImagePush(ctx context.Context, ref string, options ImagePushOptions) (ImagePushResponse, error) |
| 101 | 110 |
ImageRemove(ctx context.Context, image string, options ImageRemoveOptions) (ImageRemoveResult, error) |
| 102 |
- ImageSearch(ctx context.Context, term string, options ImageSearchOptions) (ImageSearchResult, error) |
|
| 103 | 111 |
ImageTag(ctx context.Context, options ImageTagOptions) (ImageTagResult, error) |
| 104 | 112 |
ImagePrune(ctx context.Context, opts ImagePruneOptions) (ImagePruneResult, error) |
| 105 | 113 |
|
| 106 | 114 |
ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (ImageInspectResult, error) |
| 107 | 115 |
ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) (ImageHistoryResult, error) |
| 116 |
+ |
|
| 108 | 117 |
ImageLoad(ctx context.Context, input io.Reader, _ ...ImageLoadOption) (ImageLoadResult, error) |
| 109 | 118 |
ImageSave(ctx context.Context, images []string, _ ...ImageSaveOption) (ImageSaveResult, error) |
| 110 | 119 |
} |
| 111 | 120 |
|
| 112 | 121 |
// NetworkAPIClient defines API client methods for the networks |
| 113 | 122 |
type NetworkAPIClient interface {
|
| 114 |
- NetworkConnect(ctx context.Context, network string, options NetworkConnectOptions) (NetworkConnectResult, error) |
|
| 115 | 123 |
NetworkCreate(ctx context.Context, name string, options NetworkCreateOptions) (NetworkCreateResult, error) |
| 116 |
- NetworkDisconnect(ctx context.Context, network string, options NetworkDisconnectOptions) (NetworkDisconnectResult, error) |
|
| 117 | 124 |
NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (NetworkInspectResult, error) |
| 118 | 125 |
NetworkList(ctx context.Context, options NetworkListOptions) (NetworkListResult, error) |
| 119 | 126 |
NetworkRemove(ctx context.Context, network string, options NetworkRemoveOptions) (NetworkRemoveResult, error) |
| 120 | 127 |
NetworkPrune(ctx context.Context, opts NetworkPruneOptions) (NetworkPruneResult, error) |
| 128 |
+ |
|
| 129 |
+ NetworkConnect(ctx context.Context, network string, options NetworkConnectOptions) (NetworkConnectResult, error) |
|
| 130 |
+ NetworkDisconnect(ctx context.Context, network string, options NetworkDisconnectOptions) (NetworkDisconnectResult, error) |
|
| 121 | 131 |
} |
| 122 | 132 |
|
| 123 | 133 |
// NodeAPIClient defines API client methods for the nodes |
| 124 | 134 |
type NodeAPIClient interface {
|
| 125 | 135 |
NodeInspect(ctx context.Context, nodeID string, options NodeInspectOptions) (NodeInspectResult, error) |
| 126 | 136 |
NodeList(ctx context.Context, options NodeListOptions) (NodeListResult, error) |
| 127 |
- NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) |
|
| 128 | 137 |
NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) |
| 138 |
+ NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) |
|
| 129 | 139 |
} |
| 130 | 140 |
|
| 131 | 141 |
// PluginAPIClient defines API client methods for the plugins |
| 132 | 142 |
type PluginAPIClient interface {
|
| 143 |
+ PluginCreate(ctx context.Context, createContext io.Reader, options PluginCreateOptions) (PluginCreateResult, error) |
|
| 144 |
+ PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (PluginInstallResult, error) |
|
| 145 |
+ PluginInspect(ctx context.Context, name string, options PluginInspectOptions) (PluginInspectResult, error) |
|
| 133 | 146 |
PluginList(ctx context.Context, options PluginListOptions) (PluginListResult, error) |
| 134 | 147 |
PluginRemove(ctx context.Context, name string, options PluginRemoveOptions) (PluginRemoveResult, error) |
| 148 |
+ |
|
| 135 | 149 |
PluginEnable(ctx context.Context, name string, options PluginEnableOptions) (PluginEnableResult, error) |
| 136 | 150 |
PluginDisable(ctx context.Context, name string, options PluginDisableOptions) (PluginDisableResult, error) |
| 137 |
- PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (PluginInstallResult, error) |
|
| 138 | 151 |
PluginUpgrade(ctx context.Context, name string, options PluginUpgradeOptions) (PluginUpgradeResult, error) |
| 139 | 152 |
PluginPush(ctx context.Context, name string, options PluginPushOptions) (PluginPushResult, error) |
| 140 | 153 |
PluginSet(ctx context.Context, name string, options PluginSetOptions) (PluginSetResult, error) |
| 141 |
- PluginInspect(ctx context.Context, name string, options PluginInspectOptions) (PluginInspectResult, error) |
|
| 142 |
- PluginCreate(ctx context.Context, createContext io.Reader, options PluginCreateOptions) (PluginCreateResult, error) |
|
| 143 | 154 |
} |
| 144 | 155 |
|
| 145 | 156 |
// ServiceAPIClient defines API client methods for the services |
| ... | ... |
@@ -147,23 +167,30 @@ type ServiceAPIClient interface {
|
| 147 | 147 |
ServiceCreate(ctx context.Context, options ServiceCreateOptions) (ServiceCreateResult, error) |
| 148 | 148 |
ServiceInspect(ctx context.Context, serviceID string, options ServiceInspectOptions) (ServiceInspectResult, error) |
| 149 | 149 |
ServiceList(ctx context.Context, options ServiceListOptions) (ServiceListResult, error) |
| 150 |
- ServiceRemove(ctx context.Context, serviceID string, options ServiceRemoveOptions) (ServiceRemoveResult, error) |
|
| 151 | 150 |
ServiceUpdate(ctx context.Context, serviceID string, options ServiceUpdateOptions) (ServiceUpdateResult, error) |
| 151 |
+ ServiceRemove(ctx context.Context, serviceID string, options ServiceRemoveOptions) (ServiceRemoveResult, error) |
|
| 152 |
+ |
|
| 152 | 153 |
ServiceLogs(ctx context.Context, serviceID string, options ServiceLogsOptions) (ServiceLogsResult, error) |
| 153 |
- TaskLogs(ctx context.Context, taskID string, options TaskLogsOptions) (TaskLogsResult, error) |
|
| 154 |
+} |
|
| 155 |
+ |
|
| 156 |
+// TaskAPIClient defines API client methods to manage swarm tasks. |
|
| 157 |
+type TaskAPIClient interface {
|
|
| 154 | 158 |
TaskInspect(ctx context.Context, taskID string, options TaskInspectOptions) (TaskInspectResult, error) |
| 155 | 159 |
TaskList(ctx context.Context, options TaskListOptions) (TaskListResult, error) |
| 160 |
+ |
|
| 161 |
+ TaskLogs(ctx context.Context, taskID string, options TaskLogsOptions) (TaskLogsResult, error) |
|
| 156 | 162 |
} |
| 157 | 163 |
|
| 158 | 164 |
// SwarmAPIClient defines API client methods for the swarm |
| 159 | 165 |
type SwarmAPIClient interface {
|
| 160 | 166 |
SwarmInit(ctx context.Context, options SwarmInitOptions) (SwarmInitResult, error) |
| 161 | 167 |
SwarmJoin(ctx context.Context, options SwarmJoinOptions) (SwarmJoinResult, error) |
| 162 |
- SwarmGetUnlockKey(ctx context.Context) (SwarmGetUnlockKeyResult, error) |
|
| 163 |
- SwarmUnlock(ctx context.Context, options SwarmUnlockOptions) (SwarmUnlockResult, error) |
|
| 164 |
- SwarmLeave(ctx context.Context, options SwarmLeaveOptions) (SwarmLeaveResult, error) |
|
| 165 | 168 |
SwarmInspect(ctx context.Context, options SwarmInspectOptions) (SwarmInspectResult, error) |
| 166 | 169 |
SwarmUpdate(ctx context.Context, options SwarmUpdateOptions) (SwarmUpdateResult, error) |
| 170 |
+ SwarmLeave(ctx context.Context, options SwarmLeaveOptions) (SwarmLeaveResult, error) |
|
| 171 |
+ |
|
| 172 |
+ SwarmGetUnlockKey(ctx context.Context) (SwarmGetUnlockKeyResult, error) |
|
| 173 |
+ SwarmUnlock(ctx context.Context, options SwarmUnlockOptions) (SwarmUnlockResult, error) |
|
| 167 | 174 |
} |
| 168 | 175 |
|
| 169 | 176 |
// SystemAPIClient defines API client methods for the system |
| ... | ... |
@@ -180,25 +207,25 @@ type VolumeAPIClient interface {
|
| 180 | 180 |
VolumeCreate(ctx context.Context, options VolumeCreateOptions) (VolumeCreateResult, error) |
| 181 | 181 |
VolumeInspect(ctx context.Context, volumeID string, options VolumeInspectOptions) (VolumeInspectResult, error) |
| 182 | 182 |
VolumeList(ctx context.Context, options VolumeListOptions) (VolumeListResult, error) |
| 183 |
+ VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) |
|
| 183 | 184 |
VolumeRemove(ctx context.Context, volumeID string, options VolumeRemoveOptions) (VolumeRemoveResult, error) |
| 184 | 185 |
VolumePrune(ctx context.Context, options VolumePruneOptions) (VolumePruneResult, error) |
| 185 |
- VolumeUpdate(ctx context.Context, volumeID string, options VolumeUpdateOptions) (VolumeUpdateResult, error) |
|
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 | 188 |
// SecretAPIClient defines API client methods for secrets |
| 189 | 189 |
type SecretAPIClient interface {
|
| 190 |
- SecretList(ctx context.Context, options SecretListOptions) (SecretListResult, error) |
|
| 191 | 190 |
SecretCreate(ctx context.Context, options SecretCreateOptions) (SecretCreateResult, error) |
| 192 |
- SecretRemove(ctx context.Context, id string, options SecretRemoveOptions) (SecretRemoveResult, error) |
|
| 193 | 191 |
SecretInspect(ctx context.Context, id string, options SecretInspectOptions) (SecretInspectResult, error) |
| 192 |
+ SecretList(ctx context.Context, options SecretListOptions) (SecretListResult, error) |
|
| 194 | 193 |
SecretUpdate(ctx context.Context, id string, options SecretUpdateOptions) (SecretUpdateResult, error) |
| 194 |
+ SecretRemove(ctx context.Context, id string, options SecretRemoveOptions) (SecretRemoveResult, error) |
|
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 | 197 |
// ConfigAPIClient defines API client methods for configs |
| 198 | 198 |
type ConfigAPIClient interface {
|
| 199 |
- ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) |
|
| 200 | 199 |
ConfigCreate(ctx context.Context, options ConfigCreateOptions) (ConfigCreateResult, error) |
| 201 |
- ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) |
|
| 202 | 200 |
ConfigInspect(ctx context.Context, id string, options ConfigInspectOptions) (ConfigInspectResult, error) |
| 201 |
+ ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) |
|
| 203 | 202 |
ConfigUpdate(ctx context.Context, id string, options ConfigUpdateOptions) (ConfigUpdateResult, error) |
| 203 |
+ ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) |
|
| 204 | 204 |
} |