-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APP-7004] Implement ListOAuthApplications CLI Command #4646
Merged
JosephBorodach
merged 4 commits into
main
from
APP-7004-Implement-ListOAuthApplications-CLI-Command
Jan 7, 2025
+112
−0
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4dc0a89
Implement ListOAuthApplications CLI Command
JosephBorodach 772956b
Merge remote-tracking branch 'upstream/main' into APP-7004-Implement-…
JosephBorodach aaae621
Change list command to be subcommand for organizations auth-service o…
JosephBorodach ed1846d
Add TestListOAuthAppsAction
JosephBorodach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -425,6 +425,49 @@ func (c *viamClient) organizationsLogoGetAction(cCtx *cli.Context, orgID string) | |
return nil | ||
} | ||
|
||
type listOAuthAppsArgs struct { | ||
OrgID string | ||
} | ||
|
||
// ListOAuthAppsAction corresponds to `list-oauth-apps`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add tests in client_test too pls? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
func ListOAuthAppsAction(cCtx *cli.Context, args listOAuthAppsArgs) error { | ||
c, err := newViamClient(cCtx) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
orgID := args.OrgID | ||
if orgID == "" { | ||
return errors.New("organization ID is required to list OAuth apps") | ||
} | ||
|
||
return c.listOAuthAppsAction(cCtx, orgID) | ||
} | ||
|
||
func (c *viamClient) listOAuthAppsAction(cCtx *cli.Context, orgID string) error { | ||
if err := c.ensureLoggedIn(); err != nil { | ||
return err | ||
} | ||
|
||
resp, err := c.client.ListOAuthApps(cCtx.Context, &apppb.ListOAuthAppsRequest{ | ||
OrgId: orgID, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if len(resp.ClientIds) == 0 { | ||
printf(cCtx.App.Writer, "No OAuth apps found for organization %q\n", orgID) | ||
return nil | ||
} | ||
|
||
printf(cCtx.App.Writer, "OAuth apps for organization %q:\n", orgID) | ||
for _, id := range resp.ClientIds { | ||
printf(cCtx.App.Writer, " - %s\n", id) | ||
} | ||
return nil | ||
} | ||
|
||
// ListLocationsAction is the corresponding Action for 'locations list'. | ||
func ListLocationsAction(c *cli.Context, args emptyArgs) error { | ||
client, err := newViamClient(c) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want this to be the command? or should it be something like
organization oauth list
so we can also haveorganization oauth create
etc.would check scope and check with @maxhorowitz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the existing
delete
command (created by gloria) as an example to work of so it should be good now