Documentation ¶
Overview ¶
Example (Info_help) ¶
package main import ( "os" "github.com/aws-cloudformation/rain/internal/cmd/info" ) func main() { os.Args = []string{ os.Args[0], "--help", } info.Cmd.Execute() }
Output: Display the AWS account and region that you're configured to use. Usage: info Flags: -c, --creds Include current AWS credentials -h, --help help for info
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "info", Short: "Show your current configuration", Long: "Display the AWS account and region that you're configured to use.", DisableFlagsInUseLine: true, Run: func(cmd *cobra.Command, args []string) { spinner.Push("Getting identity") id, err := sts.GetCallerID() if err != nil { panic(ui.Errorf(err, "unable to load identity")) } spinner.Pop() fmt.Println("Account: ", console.Yellow(*id.Account)) fmt.Println("Region: ", console.Yellow(aws.Config().Region)) fmt.Println("Identity:", console.Yellow(*id.Arn)) if config.Profile != "" { fmt.Println("Profile: ", console.Yellow(config.Profile)) } else if profile, ok := os.LookupEnv("AWS_PROFILE"); ok { fmt.Println("Profile: ", console.Yellow(profile)) } if checkCreds { fmt.Println() c, err := aws.Config().Credentials.Retrieve(context.Background()) if err == nil { fmt.Println("Credentials:") fmt.Println(" Source: ", console.Yellow(c.Source)) fmt.Println(" AccessKeyId: ", console.Yellow(c.AccessKeyID)) fmt.Println(" SecretAccessKey:", console.Yellow(c.SecretAccessKey)) if c.SessionToken != "" { fmt.Println(" SessionToken: ", console.Yellow(c.SessionToken)) } if !c.Expires.IsZero() { fmt.Println(" Expires: ", console.Yellow(fmt.Sprint(c.Expires))) } } } }, }
Cmd is the info command's entrypoint
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.