Skip to content

Commit

Permalink
Add initial test
Browse files Browse the repository at this point in the history
  - Remove unneeded ccloud parameters from mds iam apis
  • Loading branch information
arvindth committed Sep 17, 2019
1 parent 9f0dada commit 124d692
Show file tree
Hide file tree
Showing 8 changed files with 397 additions and 19 deletions.
4 changes: 1 addition & 3 deletions internal/cmd/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ func NewConfluentCommand(cliName string, cfg *configs.Config, ver *versions.Vers
//conn.Hidden = true // The connect feature isn't finished yet, so let's hide it
//cli.AddCommand(conn)
} else if cliName == "confluent" {
ch := &pcmd.ConfigHelper{Config: cfg, Client: client}

cli.AddCommand(iam.New(prerunner, cfg, ch, ver, mdsClient))
cli.AddCommand(iam.New(prerunner, cfg, mdsClient))

bash, err := basher.NewContext("/bin/bash", false)
if err != nil {
Expand Down
13 changes: 5 additions & 8 deletions internal/cmd/iam/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,25 @@ import (

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
"github.com/confluentinc/cli/internal/pkg/config"
"github.com/confluentinc/cli/internal/pkg/version"
"github.com/confluentinc/mds-sdk-go"
)

type command struct {
*cobra.Command
config *config.Config
ch *pcmd.ConfigHelper
client *mds.APIClient
}

// New returns the default command object for interacting with RBAC.
func New(prerunner pcmd.PreRunner, config *config.Config, ch *pcmd.ConfigHelper, version *version.Version, client *mds.APIClient) *cobra.Command {
func New(prerunner pcmd.PreRunner, config *config.Config, client *mds.APIClient) *cobra.Command {
cmd := &command{
Command: &cobra.Command{
Use: "iam",
Short: "Manage RBAC, ACL and IAM permissions.",
Long: "Manage Role Based Access (RBAC), Access Control Lists (ACL), and Identity and Access Management (IAM) permissions.",
//PersistentPreRunE: prerunner.Authenticated(),
PersistentPreRunE: prerunner.Authenticated(),
},
config: config,
ch: ch,
client: client,
}

Expand All @@ -38,9 +35,9 @@ func New(prerunner pcmd.PreRunner, config *config.Config, ch *pcmd.ConfigHelper,

func (c *command) init() {
c.AddCommand(NewRoleCommand(c.config, c.client))
c.AddCommand(NewRolebindingCommand(c.config, c.ch, c.client))
c.AddCommand(NewRolebindingCommand(c.config, c.client))
if os.Getenv("XX_FLAG_CENTRALIZED_ACL_ENABLE") != "" {
// TODO: Remove the feature flag if statement once 5.4 is released
c.AddCommand(NewACLCommand(c.config, c.ch, c.client))
// TODO: Remove this feature flag if statement once 5.4 is released
c.AddCommand(NewACLCommand(c.config, c.client))
}
}
3 changes: 1 addition & 2 deletions internal/cmd/iam/command_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/hashicorp/go-multierror"
"github.com/spf13/cobra"

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
"github.com/confluentinc/cli/internal/pkg/config"
"github.com/confluentinc/cli/internal/pkg/errors"
"github.com/confluentinc/mds-sdk-go"
Expand All @@ -25,7 +24,7 @@ type aclCommand struct {
}

// NewACLCommand returns the Cobra command for ACLs.
func NewACLCommand(config *config.Config, ch *pcmd.ConfigHelper, client *mds.APIClient) *cobra.Command {
func NewACLCommand(config *config.Config, client *mds.APIClient) *cobra.Command {
cmd := &aclCommand{
Command: &cobra.Command{
Use: "acl",
Expand Down
Loading

0 comments on commit 124d692

Please sign in to comment.