console

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "console [stack]",
	Short: "Login to the AWS console",
	Long: `Use your current credentials to create a sign-in URL for the AWS console and open it in a web browser.

If you supply a stack name (and didn't use the --service option), the browser will open with that stack selected.

The console command is only valid with an IAM role; not an IAM user.`,
	Args:                  cobra.MaximumNArgs(1),
	DisableFlagsInUseLine: true,
	Run: func(cmd *cobra.Command, args []string) {
		stackName := ""
		if len(args) == 1 {
			stackName = args[0]
		}

		spinner.Push("Generating sign-in URL")
		uri, err := console.GetURI(service, stackName)
		if err != nil {
			panic(err)
		}
		spinner.Pop()

		if !printOnly {
			switch runtime.GOOS {
			case "linux":
				err = exec.Command("xdg-open", uri).Start()
			case "windows":
				err = exec.Command("rundll32", "url.dll,FileProtocolHandler", uri).Start()
			case "darwin":
				err = exec.Command("open", uri).Start()
			}
		}

		if printOnly || err != nil {
			fmt.Printf("Open the following URL in your browser: %s\n", uri)
		}
	},
}

Cmd is the console 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