Documentation ¶
Index ¶
- Constants
- Variables
- func ClientInfoFileDestination(configDir ...string) (string, error)
- func CurrentProfile() string
- func GetAWSConfigSections(filename string) ([]string, error)
- func GetAWSProfileName(profile string) string
- func GetAWSProfiles() ([]string, error)
- func GetAccessToken() string
- func GetAndSaveRoleCredentials(ctx context.Context, cfg *aws.Config, accountID, roleName, accessToken *string, ...) (string, error)
- func GetCallerIdentity(ctx context.Context, cfg *aws.Config) (*sts.GetCallerIdentityOutput, error)
- func GetClusterInfo(ctx context.Context, cfg *aws.Config, cluster string) (*eks.DescribeClusterOutput, error)
- func GetClusters(ctx context.Context, cfg *aws.Config) ([]string, error)
- func GetECRRegistryName(ctx context.Context, cfg *aws.Config) (string, error)
- func GetECRToken(ctx context.Context, cfg *aws.Config) (string, string, error)
- func GetRoleCredentials(ctx context.Context, cfg *aws.Config, accountID, roleName, accessToken *string) (*sso.GetRoleCredentialsOutput, error)
- func GetTokenHash(token string) (string, error)
- func GetURL() (string, error)
- func IsLocalConfig(profile string) (bool, error)
- func IsProfileConfigured() bool
- func Logout(ctx context.Context, cfg *aws.Config, accessToken string) error
- func PrintClusterInfo(ctx context.Context, cfg *aws.Config, cluster string, out io.Writer) error
- func RetrieveAccountInformation(ctx context.Context, cfg *aws.Config, accessToken, acctID *string) (*types.AccountInfo, error)
- func RetrieveRoleInfo(ctx context.Context, cfg *aws.Config, accountID, accessToken string, ...) (types.RoleInfo, error)
- func RetrieveToken(ctx context.Context, cfg *aws.Config, clientInfo *ClientInformation) error
- func SaveUsageInformation(accountInfo *types.AccountInfo, roleInfo *types.RoleInfo) error
- func StartDeviceAuthorization(ctx context.Context, cfg *aws.Config, startUrl string, ...) (*ssooidc.StartDeviceAuthorizationOutput, error)
- func WriteAWSConfigFile(profile, region, output string) error
- func WriteAWSCredentialsFile(profile string, credentials *sso.GetRoleCredentialsOutput) error
- type ClientInformation
- func GatherClientInformation(ctx context.Context, cfg *aws.Config, startUrl string, b browser.Browser, ...) (*ClientInformation, error)
- func ReadClientInformation(file string) (*ClientInformation, error)
- func RegisterClient(ctx context.Context, cfg *aws.Config, startUrl string, b browser.Browser) (*ClientInformation, error)
- type CredentialsFileTemplate
- type LastUsageInformation
Constants ¶
const ( ACCESS_TOKEN_FILE = "-token.json" AWS_TOKEN_PATH = ".aws/sso/cache/" DEFAULT_ACCESS_TOKEN = "access-token.json" )
const LastUsageLocation = "/.aws/sso/cache/last-usage.json"
Variables ¶
var ( ErrMoreThanOneLocation = errors.New("too many configuration locations provided") ErrStartURLCannotBeEmpty = errors.New("start URL cannot be empty") )
var ErrAccountNotFound = errors.New("account provided couldn't be found")
var ErrFileNotFound = errors.New("the provided file could not be found")
Functions ¶
func ClientInfoFileDestination ¶
ClientInfoFileDestination finds local AWS configuration settings. Users can optionally input their own home directory location.
func CurrentProfile ¶ added in v1.0.3
func CurrentProfile() string
func GetAWSConfigSections ¶ added in v1.0.3
func GetAWSProfileName ¶ added in v1.0.3
func GetAWSProfiles ¶ added in v1.0.3
func GetAccessToken ¶
func GetAccessToken() string
func GetCallerIdentity ¶
Gather sts caller identity
func GetClusterInfo ¶
func GetClusterInfo(ctx context.Context, cfg *aws.Config, cluster string) (*eks.DescribeClusterOutput, error)
Get cluster information for provided cluster
func GetClusters ¶
Returns a list of the clusters in the environment
func GetECRRegistryName ¶
Returns the name of the ECR registry for the AWS environment
func GetECRToken ¶
Gather an ECR authentication token and return token, proxy endpoint
func GetRoleCredentials ¶
func GetTokenHash ¶ added in v1.2.3
func IsLocalConfig ¶ added in v1.0.3
func IsProfileConfigured ¶ added in v1.0.3
func IsProfileConfigured() bool
IsProfileConfigured returns true if profile is configured, false otherwise.
func PrintClusterInfo ¶
func RetrieveRoleInfo ¶
func RetrieveToken ¶
func SaveUsageInformation ¶
func SaveUsageInformation(accountInfo *types.AccountInfo, roleInfo *types.RoleInfo) error
func StartDeviceAuthorization ¶
func StartDeviceAuthorization(ctx context.Context, cfg *aws.Config, startUrl string, rco *ssooidc.RegisterClientOutput) (*ssooidc.StartDeviceAuthorizationOutput, error)
func WriteAWSConfigFile ¶
func WriteAWSCredentialsFile ¶
func WriteAWSCredentialsFile(profile string, credentials *sso.GetRoleCredentialsOutput) error
Types ¶
type ClientInformation ¶
type ClientInformation struct { AccessTokenExpiresAt time.Time AccessToken string ClientId string ClientSecret string ClientSecretExpiresAt string DeviceCode string VerificationUriComplete string StartUrl string }
func GatherClientInformation ¶
func GatherClientInformation(ctx context.Context, cfg *aws.Config, startUrl string, b browser.Browser, refresh bool) (*ClientInformation, error)
Attempts to gather current client information. If it doesn't exist, creates new information for the client
func ReadClientInformation ¶
func ReadClientInformation(file string) (*ClientInformation, error)
Will attempt to read in client information given a file location
func RegisterClient ¶
func RegisterClient(ctx context.Context, cfg *aws.Config, startUrl string, b browser.Browser) (*ClientInformation, error)
Registers a client with AWS OIDC and return the client information
func (*ClientInformation) IsExpired ¶
func (c *ClientInformation) IsExpired() bool
Checks to see if the ClientInformation AccessTokenExpiresAt is past the current time
type CredentialsFileTemplate ¶
type CredentialsFileTemplate struct { AwsAccessKeyId string `ini:"aws_access_key_id,omitempty"` AwsSecretAccessKey string `ini:"aws_secret_access_key,omitempty"` AwsSessionToken string `ini:"aws_session_token,omitempty"` CredentialProcess string `ini:"credential_process,omitempty"` Output string `ini:"output,omitempty"` Region string `ini:"region,omitempty"` }