Documentation ¶
Overview ¶
Package awsconfigfile contains logic to template ~/.aws/config files based on Common Fate access rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultProfileNameTemplate = "{{ .AccountName }}/{{ .RoleName }}"
Functions ¶
func DefaultSharedConfigFilename ¶
func DefaultSharedConfigFilename() string
DefaultSharedConfigFilename returns the AWS SDK's default file path for the shared config file. It is vendored from the AWS Go SDK v2 to prevent importing the entire module.
Builds the shared config file path based on the OS's platform.
- Linux/Unix: $HOME/.aws/config
- Windows: %USERPROFILE%\.aws\config
Types ¶
type Generator ¶ added in v0.3.0
type Generator struct { Sources []Source Config *ini.File NoCredentialProcess bool ProfileNameTemplate string Prefix string // PruneStartURLs is a slice of AWS SSO start URLs which profiles are being generated for. // Existing profiles with these start URLs will be removed if they aren't found in the Profiles field. PruneStartURLs []string }
Generator generates AWS profiles for ~/.aws/config. It reads profiles from sources and merges them with an existing ini config file.
type MergeOpts ¶
type MergeOpts struct { Config *ini.File Prefix string Profiles []SSOProfile SectionNameTemplate string NoCredentialProcess bool // PruneStartURLs is a slice of AWS SSO start URLs which profiles are being generated for. // Existing profiles with these start URLs will be removed if they aren't found in the Profiles field. PruneStartURLs []string }
type SSOProfile ¶
type SSOProfile struct { SSOStartURL string SSORegion string // Account and role details Region string AccountID string AccountName string RoleName string CommonFateURL string // GeneratedFrom is the source that the profile // was created from, such as 'commonfate' or 'aws-sso' GeneratedFrom string }
func (SSOProfile) ToIni ¶
func (p SSOProfile) ToIni(profileName string, noCredentialProcess bool) any
ToIni converts a profile to a struct with `ini` tags ready to be written to an ini config file.
if noCredentialProcess is true, the struct will contain sso_ parameters like sso_role_name, sso_start_url, etc.
if noCredentialProcess is false, the struct will contain granted_sso parameters for use with the Granted credential process, like granted_sso_role_name, granted_sso_start_url, and so forth.