Documentation ¶
Index ¶
Constants ¶
const (
// DefaultCredentialsFile is the default place to load profiles from
DefaultCredentialsFile = "credentials"
)
const DefaultProfileFile = "default-profile"
DefaultProfileFile is the configuration file containing the default profile name
Variables ¶
var Command = &cobra.Command{ Use: "profile", Short: "Manage the authentication profiles for this tool", Aliases: []string{ "profiles", }, }
Command is the base command for managing profiles
Functions ¶
func LoadDefaultProfile ¶
LoadDefaultProfile reads the profile name from the default profile file.
func LoadProfiles ¶
LoadProfiles reads the credential profiles from the default path.
func WithCredentials ¶
func WithCredentials(f func(c *Credentials))
WithCredentials loads and returns the CLI credentials.
func WithCredentialsFrom ¶
func WithCredentialsFrom(configDir string, f func(c *Credentials))
WithCredentialsFrom loads and returns the CLI credentials from a specified location.
Types ¶
type Credentials ¶
type Credentials struct { DefaultProfile string Profiles map[string]Profile ConfigDirectory string }
Credentials is the metadata around all configured profiles
func LoadCredentials ¶
func LoadCredentials(configDir string) (*Credentials, error)
LoadCredentials loads the current CLI credentials from disk.
func (*Credentials) AddProfile ¶
func (c *Credentials) AddProfile(profileName, region, apiKey string) error
AddProfile adds a new profile to the credentials file.
func (*Credentials) Default ¶
func (c *Credentials) Default() *Profile
Default returns the default profile
func (*Credentials) List ¶
func (c *Credentials) List()
List outputs a list of all the configured Credentials
func (*Credentials) RemoveProfile ¶
func (c *Credentials) RemoveProfile(profileName string) error
RemoveProfile removes an existing profile from the credentials file.
func (*Credentials) SetDefaultProfile ¶
func (c *Credentials) SetDefaultProfile(profileName string) error
SetDefaultProfile modifies the profile name to use by default.