Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/cmd/cloud-signup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
"github.com/confluentinc/cli/internal/pkg/errors"
launchdarkly "github.com/confluentinc/cli/internal/pkg/featureflags"
"github.com/confluentinc/cli/internal/pkg/featureflags"
"github.com/confluentinc/cli/internal/pkg/form"
"github.com/confluentinc/cli/internal/pkg/log"
"github.com/confluentinc/cli/internal/pkg/utils"
Expand Down Expand Up @@ -225,7 +225,7 @@ func (c *command) printFreeTrialAnnouncement(cmd *cobra.Command, client *ccloud.
if c.isTest {
freeTrialPromoCode = testserver.PromoTestCode
} else {
freeTrialPromoCode = launchdarkly.Manager.StringVariation("billing.service.signup_promo.promo_code", c.Config.Context(), ldClient, false, "")
freeTrialPromoCode = featureflags.Manager.StringVariation("billing.service.signup_promo.promo_code", c.Config.Context(), ldClient, false, "")
}

// try to find free trial promo code
Expand Down
11 changes: 9 additions & 2 deletions internal/cmd/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,25 @@ func NewConfluentCommand(cfg *v1.Config) *cobra.Command {
cmd.AddCommand(local.New(prerunner))
cmd.AddCommand(login.New(cfg, prerunner, ccloudClientFactory, mdsClientManager, netrcHandler, loginCredentialsManager, loginOrganizationManager, authTokenHandler))
cmd.AddCommand(logout.New(cfg, prerunner, netrcHandler))
cmd.AddCommand(pipeline.New(cfg, prerunner))
cmd.AddCommand(plugin.New(cfg, prerunner))
cmd.AddCommand(price.New(prerunner))
cmd.AddCommand(prompt.New(cfg))
cmd.AddCommand(servicequota.New(prerunner))
cmd.AddCommand(schemaregistry.New(cfg, prerunner, nil))
cmd.AddCommand(secret.New(prerunner, flagResolver, secrets.NewPasswordProtectionPlugin()))
cmd.AddCommand(shell.New(cmd, func() *cobra.Command { return NewConfluentCommand(cfg) }))
cmd.AddCommand(streamshare.New(cfg, prerunner))
cmd.AddCommand(update.New(prerunner, cfg.Version, updateClient))
cmd.AddCommand(version.New(prerunner, cfg.Version))

dc := dynamicconfig.New(cfg, nil, nil)
_ = dc.ParseFlagsIntoConfig(cmd)
if cfg.IsTest || featureflags.Manager.BoolVariation("cli.cdx", dc.Context(), v1.CliLaunchDarklyClient, true, false) {
cmd.AddCommand(streamshare.New(cfg, prerunner))
}
if cfg.IsTest || featureflags.Manager.BoolVariation("cli.stream_designer", dc.Context(), v1.CliLaunchDarklyClient, true, false) {
cmd.AddCommand(pipeline.New(cfg, prerunner))
}

changeDefaults(cmd, cfg)
deprecateCommandsAndFlags(cmd, cfg)
return cmd
Expand Down
10 changes: 8 additions & 2 deletions internal/cmd/iam/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
"github.com/confluentinc/cli/internal/pkg/featureflags"
)

type command struct {
Expand Down Expand Up @@ -34,9 +36,13 @@ func New(cfg *v1.Config, prerunner pcmd.PreRunner) *cobra.Command {
prerunner: prerunner,
}

dc := dynamicconfig.New(cfg, nil, nil)
_ = dc.ParseFlagsIntoConfig(cmd)
if cfg.IsTest || featureflags.Manager.BoolVariation("cli.identity-provider", dc.Context(), v1.CliLaunchDarklyClient, true, false) {
c.AddCommand(newPoolCommand(cfg, c.prerunner))
c.AddCommand(newProviderCommand(cfg, c.prerunner))
}
c.AddCommand(newACLCommand(c.prerunner))
c.AddCommand(newPoolCommand(cfg, c.prerunner))
c.AddCommand(newProviderCommand(cfg, c.prerunner))
c.AddCommand(newRBACCommand(cfg, c.prerunner))
c.AddCommand(newServiceAccountCommand(c.prerunner))
c.AddCommand(newUserCommand(c.prerunner))
Expand Down
6 changes: 0 additions & 6 deletions internal/cmd/iam/command_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
launchdarkly "github.com/confluentinc/cli/internal/pkg/featureflags"
)

type identityPoolCommand struct {
Expand All @@ -30,10 +28,6 @@ func newPoolCommand(cfg *v1.Config, prerunner pcmd.PreRunner) *cobra.Command {

c := &identityPoolCommand{pcmd.NewAuthenticatedCLICommand(cmd, prerunner)}

dc := dynamicconfig.New(cfg, nil, nil)
_ = dc.ParseFlagsIntoConfig(cmd)
c.Hidden = !(cfg.IsTest || launchdarkly.Manager.BoolVariation("cli.identity-provider", dc.Context(), v1.CliLaunchDarklyClient, true, false))

cmd.AddCommand(c.newCreateCommand())
cmd.AddCommand(c.newDeleteCommand())
cmd.AddCommand(c.newDescribeCommand())
Expand Down
6 changes: 0 additions & 6 deletions internal/cmd/iam/command_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
launchdarkly "github.com/confluentinc/cli/internal/pkg/featureflags"
)

var providerListFields = []string{"Id", "Name", "Description", "IssuerUri", "JwksUri"}
Expand All @@ -32,10 +30,6 @@ func newProviderCommand(cfg *v1.Config, prerunner pcmd.PreRunner) *cobra.Command

c := &identityProviderCommand{pcmd.NewAuthenticatedCLICommand(cmd, prerunner)}

dc := dynamicconfig.New(cfg, nil, nil)
_ = dc.ParseFlagsIntoConfig(cmd)
c.Hidden = !(cfg.IsTest || launchdarkly.Manager.BoolVariation("cli.identity-provider", dc.Context(), v1.CliLaunchDarklyClient, true, false))

cmd.AddCommand(c.newCreateCommand())
cmd.AddCommand(c.newDeleteCommand())
cmd.AddCommand(c.newDescribeCommand())
Expand Down
9 changes: 8 additions & 1 deletion internal/cmd/kafka/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
"github.com/confluentinc/cli/internal/pkg/featureflags"
)

func New(cfg *v1.Config, prerunner pcmd.PreRunner, clientID string) *cobra.Command {
Expand All @@ -21,10 +23,15 @@ func New(cfg *v1.Config, prerunner pcmd.PreRunner, clientID string) *cobra.Comma
cmd.AddCommand(newLinkCommand(cfg, prerunner))
cmd.AddCommand(newMirrorCommand(prerunner))
cmd.AddCommand(newPartitionCommand(prerunner))
cmd.AddCommand(newQuotaCommand(cfg, prerunner))
cmd.AddCommand(newRegionCommand(prerunner))
cmd.AddCommand(newReplicaCommand(prerunner))
cmd.AddCommand(newTopicCommand(cfg, prerunner, clientID))

dc := dynamicconfig.New(cfg, nil, nil)
_ = dc.ParseFlagsIntoConfig(cmd)
if cfg.IsTest || featureflags.Manager.BoolVariation("cli.client_quotas.enable", dc.Context(), v1.CliLaunchDarklyClient, true, false) {
cmd.AddCommand(newQuotaCommand(cfg, prerunner))
}

return cmd
}
7 changes: 0 additions & 7 deletions internal/cmd/kafka/command_quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
launchdarkly "github.com/confluentinc/cli/internal/pkg/featureflags"
"github.com/confluentinc/cli/internal/pkg/output"

kafkaquotas "github.com/confluentinc/ccloud-sdk-go-v2/kafka-quotas/v1"
Expand All @@ -25,11 +23,6 @@ func newQuotaCommand(config *v1.Config, prerunner pcmd.PreRunner) *cobra.Command

c := &quotaCommand{pcmd.NewAuthenticatedStateFlagCommand(cmd, prerunner)}

dc := dynamicconfig.New(config, nil, nil)
_ = dc.ParseFlagsIntoConfig(cmd)

c.Hidden = !(config.IsTest || launchdarkly.Manager.BoolVariation("cli.client_quotas.enable", dc.Context(), v1.CliLaunchDarklyClient, true, false))

c.AddCommand(c.newCreateCommand())
c.AddCommand(c.newDeleteCommand())
c.AddCommand(c.newDescribeCommand())
Expand Down
7 changes: 0 additions & 7 deletions internal/cmd/pipeline/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
launchdarkly "github.com/confluentinc/cli/internal/pkg/featureflags"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -70,10 +68,5 @@ func New(cfg *v1.Config, prerunner pcmd.PreRunner) *cobra.Command {
c.AddCommand(c.newListCommand(prerunner))
c.AddCommand(c.newUpdateCommand(prerunner))

dc := dynamicconfig.New(cfg, nil, nil)
_ = dc.ParseFlagsIntoConfig(cmd)

c.Hidden = !cfg.IsTest && !launchdarkly.Manager.BoolVariation("cli.stream_designer", dc.Context(), v1.CliLaunchDarklyClient, true, false)

return c.Command
}
2 changes: 1 addition & 1 deletion internal/cmd/stream-share/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/spf13/cobra"

pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
"github.com/confluentinc/cli/internal/pkg/config/v1"
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
"github.com/confluentinc/cli/internal/pkg/featureflags"
)
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/cmd/prerunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
v1 "github.com/confluentinc/cli/internal/pkg/config/v1"
dynamicconfig "github.com/confluentinc/cli/internal/pkg/dynamic-config"
"github.com/confluentinc/cli/internal/pkg/errors"
launchdarkly "github.com/confluentinc/cli/internal/pkg/featureflags"
"github.com/confluentinc/cli/internal/pkg/featureflags"
"github.com/confluentinc/cli/internal/pkg/form"
"github.com/confluentinc/cli/internal/pkg/log"
"github.com/confluentinc/cli/internal/pkg/netrc"
Expand Down Expand Up @@ -197,8 +197,8 @@ func (r *PreRun) Anonymous(command *CLICommand, willAuthenticate bool) func(cmd
}
// announcement and deprecation check, print out msg
ctx := dynamicconfig.NewDynamicContext(r.Config.Context(), nil, nil)
launchdarkly.PrintAnnouncements(launchdarkly.Announcements, ctx, cmd)
launchdarkly.PrintAnnouncements(launchdarkly.DeprecationNotices, ctx, cmd)
featureflags.PrintAnnouncements(featureflags.Announcements, ctx, cmd)
featureflags.PrintAnnouncements(featureflags.DeprecationNotices, ctx, cmd)
}

verbosity, err := cmd.Flags().GetCount("verbose")
Expand Down Expand Up @@ -238,7 +238,7 @@ func (r *PreRun) Anonymous(command *CLICommand, willAuthenticate bool) func(cmd
}

func checkCliDisable(cmd *CLICommand, cfg *v1.Config) error {
ldDisableJson := launchdarkly.Manager.JsonVariation("cli.disable", cmd.Config.Context(), v1.CliLaunchDarklyClient, true, nil)
ldDisableJson := featureflags.Manager.JsonVariation("cli.disable", cmd.Config.Context(), v1.CliLaunchDarklyClient, true, nil)
ldDisable, ok := ldDisableJson.(map[string]interface{})
if !ok {
return nil
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/cmd/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/spf13/cobra"

launchdarkly "github.com/confluentinc/cli/internal/pkg/featureflags"
"github.com/confluentinc/cli/internal/pkg/featureflags"
)

// ExecuteCommand runs the root command with the given args, and returns the output string or an error.
Expand All @@ -23,7 +23,7 @@ func ExecuteCommandC(root *cobra.Command, args ...string) (c *cobra.Command, out
root.SetOut(buf)
root.SetArgs(args)

launchdarkly.Init(nil, true)
featureflags.Init(nil, true)

c, err = root.ExecuteC()

Expand Down