Browse Source

client/tailscale: fix request object for key creation.

The request takes key capabilities as an argument, but wrapped in a parent
object.

Signed-off-by: David Anderson <[email protected]>
David Anderson 3 years ago
parent
commit
c0fcab01ac
1 changed files with 4 additions and 1 deletions
  1. 4 1
      client/tailscale/keys.go

+ 4 - 1
client/tailscale/keys.go

@@ -72,7 +72,10 @@ func (c *Client) Keys(ctx context.Context) ([]string, error) {
 // can be created. Returns the key itself, which cannot be retrieved again
 // can be created. Returns the key itself, which cannot be retrieved again
 // later, and the key metadata.
 // later, and the key metadata.
 func (c *Client) CreateKey(ctx context.Context, caps KeyCapabilities) (string, *Key, error) {
 func (c *Client) CreateKey(ctx context.Context, caps KeyCapabilities) (string, *Key, error) {
-	bs, err := json.Marshal(caps)
+	keyRequest := struct {
+		Capabilities KeyCapabilities `json:"capabilities"`
+	}{caps}
+	bs, err := json.Marshal(keyRequest)
 	if err != nil {
 	if err != nil {
 		return "", nil, err
 		return "", nil, err
 	}
 	}