mirror of https://github.com/docker/cli.git
more review updates
- use /secrets for swarm secret create route - do not specify omitempty for secret and secret reference - simplify lookup for secret ids - do not use pointer for secret grpc conversion Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
72ff77999c
commit
548728bb84
|
@ -225,7 +225,7 @@ type secretNotFoundError struct {
|
||||||
|
|
||||||
// Error returns a string representation of a secretNotFoundError
|
// Error returns a string representation of a secretNotFoundError
|
||||||
func (e secretNotFoundError) Error() string {
|
func (e secretNotFoundError) Error() string {
|
||||||
return fmt.Sprintf("Error: No such secret: %s", e.name)
|
return fmt.Sprintf("Error: no such secret: %s", e.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NoFound indicates that this error type is of NotFound
|
// NoFound indicates that this error type is of NotFound
|
||||||
|
|
|
@ -13,7 +13,7 @@ func (cli *Client) SecretCreate(ctx context.Context, secret swarm.SecretSpec) (t
|
||||||
var headers map[string][]string
|
var headers map[string][]string
|
||||||
|
|
||||||
var response types.SecretCreateResponse
|
var response types.SecretCreateResponse
|
||||||
resp, err := cli.post(ctx, "/secrets/create", nil, secret, headers)
|
resp, err := cli.post(ctx, "/secrets", nil, secret, headers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func TestSecretCreateError(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSecretCreate(t *testing.T) {
|
func TestSecretCreate(t *testing.T) {
|
||||||
expectedURL := "/secrets/create"
|
expectedURL := "/secrets"
|
||||||
client := &Client{
|
client := &Client{
|
||||||
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
||||||
if !strings.HasPrefix(req.URL.Path, expectedURL) {
|
if !strings.HasPrefix(req.URL.Path, expectedURL) {
|
||||||
|
|
Loading…
Reference in New Issue