1+ // Package keys provides methods for managing a user's ssh keys.
12package keys
23
34import (
@@ -10,7 +11,7 @@ import (
1011 "github.com/deis/controller-sdk-go/api"
1112)
1213
13- // List keys on a controller .
14+ // List lists a user's ssh keys .
1415func List (c * deis.Client , results int ) ([]api.Key , int , error ) {
1516 body , count , err := c .LimitedRequest ("/v2/keys/" , results )
1617
@@ -26,7 +27,9 @@ func List(c *deis.Client, results int) ([]api.Key, int, error) {
2627 return keys , count , nil
2728}
2829
29- // New creates a new key.
30+ // New adds a new ssh key for the user. This is used for authenting with the git
31+ // remote for the builder. This key must be unique to the current user, or the error
32+ // deis.ErrDuplicateKey will be returned.
3033func New (c * deis.Client , id string , pubKey string ) (api.Key , error ) {
3134 req := api.KeyCreateRequest {ID : id , Public : pubKey }
3235 body , err := json .Marshal (req )
@@ -49,7 +52,8 @@ func New(c *deis.Client, id string, pubKey string) (api.Key, error) {
4952 return key , nil
5053}
5154
52- // Delete a key.
55+ // Delete removes a user's ssh key. The key ID will be the key comment, usually the email or user@hostname
56+ // of the user. The exact keyID can be retrived with List()
5357func Delete (c * deis.Client , keyID string ) error {
5458 u := fmt .Sprintf ("/v2/keys/%s" , keyID )
5559
0 commit comments