mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
0f9fc54df9
- Neither swarm init or swarm update should take an unlock key - Add an autolock flag to turn on autolock - Make the necessary docker api changes - Add SwarmGetUnlockKey API call and use it when turning on autolock - Add swarm unlock-key subcommand Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
21 lines
551 B
Go
21 lines
551 B
Go
package client
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
// SwarmGetUnlockKey retrieves the swarm's unlock key.
|
|
func (cli *Client) SwarmGetUnlockKey(ctx context.Context) (types.SwarmUnlockKeyResponse, error) {
|
|
serverResp, err := cli.get(ctx, "/swarm/unlockkey", nil, nil)
|
|
if err != nil {
|
|
return types.SwarmUnlockKeyResponse{}, err
|
|
}
|
|
|
|
var response types.SwarmUnlockKeyResponse
|
|
err = json.NewDecoder(serverResp.body).Decode(&response)
|
|
ensureReaderClosed(serverResp)
|
|
return response, err
|
|
}
|