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:
Evan Hazlett 2016-10-27 00:41:32 -07:00
parent 72ff77999c
commit 548728bb84
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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
} }

View File

@ -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) {