github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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  	modelcmd.IAASOnlyCommand
    14  }
    15  
    16  // NewKeyManagerClient returns a keymanager client for the root api endpoint
    17  // that the environment command returns.
    18  func (c *SSHKeysBase) NewKeyManagerClient() (*keymanager.Client, error) {
    19  	root, err := c.NewAPIRoot()
    20  	if err != nil {
    21  		return nil, err
    22  	}
    23  	return keymanager.NewClient(root), nil
    24  }