Skip to content

Commit

Permalink
Update flags for mTLS (#2899)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgagniere authored Oct 4, 2024
1 parent 1ba3b46 commit 9951c52
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 17 deletions.
11 changes: 2 additions & 9 deletions cmd/docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,12 @@ func main() {
panic(err)
}

removeUnreleasedDocs()

if err := os.Setenv("HOME", home); err != nil {
panic(err)
}
}

func removeUnreleasedDocs() {
removeUnreleasedCommands("iam certificate-authority")
removeUnreleasedCommands("iam certificate-pool")
}

func removeUnreleasedCommands(command string) {
func removeUnreleasedCommands(command string) { //nolint:unused
subcommands := strings.Split(command, " ")

line := fmt.Sprintf(`\s{3}%s/index\n`, subcommands[len(subcommands)-1])
Expand All @@ -101,7 +94,7 @@ func removeUnreleasedCommands(command string) {
}
}

func removeLineFromFile(line, file string) error {
func removeLineFromFile(line, file string) error { //nolint:unused
out, err := os.ReadFile(file)
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions internal/iam/command_certificate_pool_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func (c *certificatePoolCommand) newCreateCommand() *cobra.Command {
cmd.Flags().String("description", "", "Description of the certificate pool.")
pcmd.AddFilterFlag(cmd)
pcmd.AddExternalIdentifierFlag(cmd)
pcmd.AddContextFlag(cmd, c.CLICommand)
pcmd.AddOutputFlag(cmd)

cobra.CheckErr(cmd.MarkFlagRequired("provider"))

Expand Down
1 change: 1 addition & 0 deletions internal/iam/command_certificate_pool_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func (c *certificatePoolCommand) newDeleteCommand() *cobra.Command {

c.AddProviderFlag(cmd)
pcmd.AddForceFlag(cmd)
pcmd.AddContextFlag(cmd, c.CLICommand)

cobra.CheckErr(cmd.MarkFlagRequired("provider"))

Expand Down
3 changes: 3 additions & 0 deletions internal/iam/command_certificate_pool_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func (c *certificatePoolCommand) newDescribeCommand() *cobra.Command {
}

c.AddProviderFlag(cmd)
pcmd.AddContextFlag(cmd, c.CLICommand)
pcmd.AddOutputFlag(cmd)

cobra.CheckErr(cmd.MarkFlagRequired("provider"))
return cmd
}
Expand Down
4 changes: 4 additions & 0 deletions internal/iam/command_certificate_pool_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package iam
import (
"github.com/spf13/cobra"

pcmd "github.com/confluentinc/cli/v4/pkg/cmd"
"github.com/confluentinc/cli/v4/pkg/output"
)

Expand All @@ -15,6 +16,9 @@ func (c *certificatePoolCommand) newListCommand() *cobra.Command {
}

c.AddProviderFlag(cmd)
pcmd.AddContextFlag(cmd, c.CLICommand)
pcmd.AddOutputFlag(cmd)

cobra.CheckErr(cmd.MarkFlagRequired("provider"))
return cmd
}
Expand Down
2 changes: 2 additions & 0 deletions internal/iam/command_certificate_pool_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func (c *certificatePoolCommand) newUpdateCommand() *cobra.Command {
cmd.Flags().String("name", "", "Name of the certificate pool.")
pcmd.AddFilterFlag(cmd)
pcmd.AddExternalIdentifierFlag(cmd)
pcmd.AddContextFlag(cmd, c.CLICommand)
pcmd.AddOutputFlag(cmd)

cobra.CheckErr(cmd.MarkFlagRequired("provider"))

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func AddKsqlClusterFlag(cmd *cobra.Command, c *AuthenticatedCLICommand) {
}

func AddFilterFlag(cmd *cobra.Command) {
cmd.Flags().String("filter", "true", "A supported Common Expression Language (CEL) filter expression for group mappings.")
cmd.Flags().String("filter", "true", "A supported Common Expression Language (CEL) filter expression.")
}

func AddExternalIdentifierFlag(cmd *cobra.Command) {
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/output/iam/certificate-pool/create-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ Create a certificate pool named "pool-123".
Flags:
--provider string REQUIRED: ID of this pool's certificate authority.
--description string Description of the certificate pool.
--filter string A supported Common Expression Language (CEL) filter expression for group mappings. (default "true")
--filter string A supported Common Expression Language (CEL) filter expression. (default "true")
--external-identifier string External Identifier for this pool.
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Global Flags:
-h, --help Show help for this command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Delete certificate pool "pool-123":
Flags:
--provider string REQUIRED: ID of this pool's certificate authority.
--force Skip the deletion confirmation prompt.
--context string CLI context name.

Global Flags:
-h, --help Show help for this command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Describe a certificate pool with ID "pool-123".

Flags:
--provider string REQUIRED: ID of this pool's certificate authority.
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Global Flags:
-h, --help Show help for this command.
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/output/iam/certificate-pool/list-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Usage:

Flags:
--provider string REQUIRED: ID of this pool's certificate authority.
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Global Flags:
-h, --help Show help for this command.
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/output/iam/certificate-pool/update-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ Flags:
--provider string REQUIRED: ID of this pool's certificate authority.
--description string Description of the certificate pool.
--name string Name of the certificate pool.
--filter string A supported Common Expression Language (CEL) filter expression for group mappings. (default "true")
--filter string A supported Common Expression Language (CEL) filter expression. (default "true")
--external-identifier string External Identifier for this pool.
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Global Flags:
-h, --help Show help for this command.
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/iam/group-mapping/create-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Create a group mapping named "demo-group-mapping".

Flags:
--description string Description of the group mapping.
--filter string A supported Common Expression Language (CEL) filter expression for group mappings. (default "true")
--filter string A supported Common Expression Language (CEL) filter expression. (default "true")
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/iam/group-mapping/update-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Update the description of group mapping "group-123456".
Flags:
--name string Name of the group mapping.
--description string Description of the group mapping.
--filter string A supported Common Expression Language (CEL) filter expression for group mappings. (default "true")
--filter string A supported Common Expression Language (CEL) filter expression. (default "true")
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/iam/pool/create-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Flags:
--provider string REQUIRED: ID of this pool's identity provider.
--identity-claim string REQUIRED: Claim specifying the external identity using this identity pool.
--description string Description of the identity pool.
--filter string A supported Common Expression Language (CEL) filter expression for group mappings. (default "true")
--filter string A supported Common Expression Language (CEL) filter expression. (default "true")
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/iam/pool/no-op-update.golden
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Flags:
--identity-claim string Claim specifying the external identity using this identity pool.
--name string Name of the identity pool.
--description string Description of the identity pool.
--filter string A supported Common Expression Language (CEL) filter expression for group mappings. (default "true")
--filter string A supported Common Expression Language (CEL) filter expression. (default "true")
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/iam/pool/update-help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Flags:
--identity-claim string Claim specifying the external identity using this identity pool.
--name string Name of the identity pool.
--description string Description of the identity pool.
--filter string A supported Common Expression Language (CEL) filter expression for group mappings. (default "true")
--filter string A supported Common Expression Language (CEL) filter expression. (default "true")
--context string CLI context name.
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")

Expand Down

0 comments on commit 9951c52

Please sign in to comment.