List Gateways and current Gateway in `gwa login`
- Dominant language
- Go
- Stars
- 8
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Mimic the informative output from `oc` upon login:
```
Logged into "https://api.gold.devops.gov.bc.ca:6443" as "russell.vinegar@gov.bc.ca" using the token provided.
You have access to the following projects and can switch between them with 'oc project ':
* b8840c-dev
b8840c-prod
b8840c-test
b8840c-tools
ec38a0-prod
fe3a7e-prod
Using project "b8840c-dev".
```
WIP:
```
Waiting for authentication handshake...
✓ Successfully logged in using device login.
You have access to the following Gateways and can switch between them with 'gwa config set gateway ':
Display Name Gateway ID
Gateway gw-fdfee gw-fdfee
new-test111 gw-c168f
RVINEGAR's Gateway gw-ff064
Tester gw-44d2a
This-namespace gw-b963a
Currently using:
This-namespace gw-b963a
```
Benefits:
- Existing users:
- This saves users the need to run `gateway list` and/or `gateway current` to see what gateway is set.
- Prompts user to change current gateway if invalid gw is set
- (if we show host) may reduce confusion for users who use our test and prod envs
- New users:
- Prompts user to create a new gateway and provides command directly within CLI
WIP in `feature/ns-to-gw-login` branch
To determine:
- include the host in login success message (api.gov.bc.ca, api-gov-bc-ca.test.api.gov.bc.ca, etc)
- should client cred login also list Gateways or show current Gateway? (or only list this info for device login?)
- can service accounts even be attached to more than one Gateway?
To do for WIP:
- resolve errors on client cred flags (`--client-id`, `--client-secret`)
- either don't run `list` and `current` for client cred, or stop passing those flags
- handle errors if an inaccessible or non-existing current gateway is set with a custom message
- message: `The current Gateway (gw-name) could not be accessed. Switch to a valid Gateway with 'gwa config set gateway'`
- new user use case: set responses for when there are no existing gateways and/or no current gateway set
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the login flow and the WIP implementation on the `feature/ns-to-gw-login` branch first. Verify gateway listing and the current gateway after device login, resolve client-credential flag handling, and cover inaccessible, missing, and new-user gateway cases with the specified CLI messages; clarify whether client-credential logins should show this information and whether hosts belong in the success message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100