Skip to content

Commit

Permalink
[AM-4684] Add Flink model roles to CLI list/describe commands (#2769)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucy-fan committed May 28, 2024
1 parent 2ab27c0 commit c8b7c5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/iam/command_rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var (
identityNamespace = optional.NewString("identity")
flinkNamespace = optional.NewString("flink")
workloadNamespace = optional.NewString("workload")
flinkModelNamespace = optional.NewString("flinkmodel")
)

func newRbacCommand(cfg *config.Config, prerunner pcmd.PreRunner) *cobra.Command {
Expand Down
4 changes: 4 additions & 0 deletions internal/iam/command_rbac_role_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func (c *roleCommand) ccloudDescribe(cmd *cobra.Command, role string) error {
namespacesList = append(namespacesList, flinkNamespace.Value(), workloadNamespace.Value())
}

if featureflags.Manager.BoolVariation("flink.model.rbac.namespace.cli.enable", c.Context, ldClient, true, false) {
namespacesList = append(namespacesList, flinkModelNamespace.Value())
}

namespaces := optional.NewString(strings.Join(namespacesList, ","))

opts := &mdsv2alpha1.RoleDetailOpts{Namespace: namespaces}
Expand Down
8 changes: 8 additions & 0 deletions internal/iam/command_rbac_role_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ func (c *roleCommand) ccloudList(cmd *cobra.Command) error {
roles = append(roles, workloadRoles...)
}

if featureflags.Manager.BoolVariation("flink.model.rbac.namespace.cli.enable", c.Context, ldClient, true, false) {
flinkModelRoles, err := c.namespaceRoles(flinkModelNamespace)
if err != nil {
return err
}
roles = append(roles, flinkModelRoles...)
}

if output.GetFormat(cmd).IsSerialized() {
return output.SerializedOutput(cmd, roles)
}
Expand Down

0 comments on commit c8b7c5c

Please sign in to comment.