open-vault/api/ssh.go
2015-06-25 21:47:32 -04:00

27 lines
441 B
Go

package api
import "fmt"
type Ssh struct {
c *Client
}
func (c *Client) Ssh() *Ssh {
return &Ssh{c: c}
}
func (c *Ssh) KeyCreate(data map[string]interface{}) (*Secret, error) {
r := c.c.NewRequest("PUT", fmt.Sprintf("/v1/ssh/creds/web"))
if err := r.SetJSONBody(data); err != nil {
return nil, err
}
resp, err := c.c.RawRequest(r)
if err != nil {
return nil, err
}
defer resp.Body.Close()
return ParseSecret(resp.Body)
}