Documentation
¶
Overview ¶
Package config handles reading and writing SSO profiles to ~/.aws/config.
Index ¶
- func CredentialsPath() (string, error)
- func DeleteProfile(name string) error
- func LoadProfiles() ([]profile.SSOProfile, error)
- func Path() (string, error)
- func SaveProfile(p profile.SSOProfile) error
- func SaveProfiles(profiles []profile.SSOProfile) error
- func WriteCredentials(profileName, accessKeyID, secretAccessKey, sessionToken string) error
- func WriteSSOCache(startURL, region, accessToken string, expiresAt time.Time) error
- type SSOToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CredentialsPath ¶
CredentialsPath returns the path to the AWS credentials file.
func DeleteProfile ¶
DeleteProfile removes an SSO profile from the AWS config file.
func LoadProfiles ¶
func LoadProfiles() ([]profile.SSOProfile, error)
LoadProfiles reads all SSO profiles from the AWS config file.
func SaveProfile ¶
func SaveProfile(p profile.SSOProfile) error
SaveProfile writes an SSO profile to the AWS config file.
func SaveProfiles ¶
func SaveProfiles(profiles []profile.SSOProfile) error
SaveProfiles writes multiple SSO profiles to the AWS config file in a single read/write cycle. This is much faster than calling SaveProfile in a loop.
func WriteCredentials ¶
WriteCredentials writes temporary credentials to the AWS credentials file.
Types ¶
type SSOToken ¶
type SSOToken struct {
StartURL string `json:"startUrl"`
Region string `json:"region"`
AccessToken string `json:"accessToken"`
ExpiresAt time.Time `json:"-"` // custom marshal to RFC3339
}
SSOToken represents a cached SSO access token in the standard AWS CLI format. Stored at ~/.aws/sso/cache/{SHA1(startUrl)}.json.
func ReadSSOCache ¶
ReadSSOCache reads a cached SSO access token for the given start URL. Returns nil if the cache file doesn't exist or the token is expired.
func (SSOToken) MarshalJSON ¶
MarshalJSON implements json.Marshaler with RFC3339 expiresAt.
func (*SSOToken) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler with RFC3339 expiresAt.