-
Notifications
You must be signed in to change notification settings - Fork 24
CIAM-2206: CLI List roles command should return Ksql and SR roles with Stage 3 flag #1378
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
Merged
Akshay Ben (aben) (dragonmushu)
merged 10 commits into
main
from
aben/updateCLIForKsqlAndSRRoles
Aug 4, 2022
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e3bcb76
added sr and ksql roles to list roles
dragonmushu b352def
update cli
dragonmushu 355f38e
update comments
dragonmushu c0b7982
updated comments
dragonmushu 9cace16
update
dragonmushu bf041f9
added test
dragonmushu 3c06a20
update tests and logic
dragonmushu aa50087
Update internal/cmd/iam/command_rbac.go
dragonmushu 83cf382
update for lint
dragonmushu b240d14
fix comments
dragonmushu 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| package iam | ||
|
|
||
| import ( | ||
| "os" | ||
| "strings" | ||
|
|
||
| "github.com/antihax/optional" | ||
| "github.com/confluentinc/go-printer" | ||
| "github.com/confluentinc/mds-sdk-go/mdsv2alpha1" | ||
| "github.com/spf13/cobra" | ||
|
|
@@ -35,14 +39,27 @@ func (c *roleCommand) list(cmd *cobra.Command, _ []string) error { | |
| } | ||
|
|
||
| func (c *roleCommand) ccloudList(cmd *cobra.Command) error { | ||
| publicRoles, _, err := c.MDSv2Client.RBACRoleDefinitionsApi.Roles(c.createContext(), nil) | ||
| var roles []mdsv2alpha1.Role | ||
|
|
||
| // add public and dataplane roles | ||
| publicAndDataplaneNamespace := []string{publicNamespace.Value(), dataplaneNamespace.Value()} | ||
| publicAndDataplaneNamespaceOpt := optional.NewString(strings.Join(publicAndDataplaneNamespace, ",")) | ||
dragonmushu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| publicAndDataplaneRoles, err := c.namespaceRoles(publicAndDataplaneNamespaceOpt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| roles = append(roles, publicAndDataplaneRoles...) | ||
|
|
||
| opts := &mdsv2alpha1.RolesOpts{Namespace: dataplaneNamespace} | ||
| dataplaneRoles, _, _ := c.MDSv2Client.RBACRoleDefinitionsApi.Roles(c.createContext(), opts) | ||
| roles := append(publicRoles, dataplaneRoles...) | ||
| // add ksql and datagovernance roles | ||
| if os.Getenv("XX_DATAPLANE_3_ENABLE") != "" { | ||
|
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. FYI, we have a feature flag framework that you can use in the future, it would give you some more flexibility over these features. |
||
| ksqlAndDataGovernanceNamespace := []string{ksqlNamespace.Value(), dataGovernanceNamespace.Value()} | ||
| ksqlAndDataGovernanceNamespaceOpt := optional.NewString(strings.Join(ksqlAndDataGovernanceNamespace, ",")) | ||
dragonmushu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ksqlAndDataGovernanceRoles, err := c.namespaceRoles(ksqlAndDataGovernanceNamespaceOpt) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| roles = append(roles, ksqlAndDataGovernanceRoles...) | ||
| } | ||
|
|
||
| format, err := cmd.Flags().GetString(output.FlagName) | ||
| if err != nil { | ||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
406 changes: 406 additions & 0 deletions
406
test/fixtures/output/iam/rbac/role/list-dataplane-stage3-cloud.golden
Large diffs are not rendered by default.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.