Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WhoamiCmd = &cobra.Command{ Use: "whoami", Short: "Print information about the auth token", Run: func(cmd *cobra.Command, args []string) { client, err := egapi.NewClient(config.C.AuthURI) if err != nil { fmt.Fprintln(os.Stderr, "error preparing API client: ", err) os.Exit(1) } iam, err := egiam.NewClient(client) if err != nil { fmt.Fprintln(os.Stderr, "error preparing API client: ", err) os.Exit(1) } whoami, err := iam.WhoamiWithResponse(cmd.Context()) if err != nil { fmt.Fprintln(os.Stderr, "error making whoami API request: ", err) os.Exit(1) } if whoami.JSON200 == nil { fmt.Fprintln(os.Stderr, "unexpected response from server: ", string(whoami.Body)) return } err = json.NewEncoder(os.Stdout).Encode(whoami.JSON200) if err != nil { fmt.Fprintln(os.Stderr, "error encoding response to json: ", err) os.Exit(1) } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.