info

package
v1.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL