(cmd *cobra.Command, f *cmdutil.Factory, s *Shortcut)
| 978 | } |
| 979 | |
| 980 | func resolveShortcutIdentity(cmd *cobra.Command, f *cmdutil.Factory, s *Shortcut) (core.Identity, error) { |
| 981 | // Step 1: determine identity (--as > default-as > auto-detect). |
| 982 | asFlag, _ := cmd.Flags().GetString("as") |
| 983 | as := f.ResolveAs(cmd.Context(), cmd, core.Identity(asFlag)) |
| 984 | |
| 985 | if err := f.CheckStrictMode(cmd.Context(), as); err != nil { |
| 986 | return "", err |
| 987 | } |
| 988 | |
| 989 | // Step 2: check if this shortcut supports the resolved identity. |
| 990 | if err := f.CheckIdentity(as, s.AuthTypes); err != nil { |
| 991 | return "", err |
| 992 | } |
| 993 | return as, nil |
| 994 | } |
| 995 | |
| 996 | func checkShortcutScopes(f *cmdutil.Factory, ctx context.Context, as core.Identity, config *core.CliConfig, scopes []string) error { |
| 997 | if len(scopes) == 0 { |
no test coverage detected