github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/cmd/juju/commands/sshkeys.go (about)

     1  // Copyright 2012, 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package commands
     5  
     6  import (
     7  	"github.com/juju/juju/api/keymanager"
     8  	"github.com/juju/juju/cmd/modelcmd"
     9  )
    10  
    11  type SSHKeysBase struct {
    12  	modelcmd.ModelCommandBase
    13  }
    14  
    15  // NewKeyManagerClient returns a keymanager client for the root api endpoint
    16  // that the environment command returns.
    17  func (c *SSHKeysBase) NewKeyManagerClient() (*keymanager.Client, error) {
    18  	root, err := c.NewAPIRoot()
    19  	if err != nil {
    20  		return nil, err
    21  	}
    22  	return keymanager.NewClient(root), nil
    23  }