Skip to content

Commit 71527dd

Browse files
[CLI-3059,CLI-3464,CLI-3360,CPSEC-342] CLI On-Prem Updates (#3059)
Co-authored-by: tmalik <167480759+tmalikconfluent@users.noreply.github.com>
1 parent a6b2c4e commit 71527dd

File tree

203 files changed

+1848
-1369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+1848
-1369
lines changed

internal/asyncapi/command_export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func (c *command) getMessageExamples(consumer *ckgo.Consumer, topicName, content
306306
return nil, err
307307
}
308308

309-
err = deserializationProvider.InitDeserializer(srEndpoint, srClusterId, "value", "", "", token, nil)
309+
err = deserializationProvider.InitDeserializer(srEndpoint, srClusterId, "value", serdes.SchemaRegistryAuth{Token: token}, nil)
310310
if err != nil {
311311
return nil, err
312312
}

internal/audit-log/command_config_describe.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ func (c *configCommand) newDescribeCommand() *cobra.Command {
1717
RunE: c.describe,
1818
}
1919

20+
pcmd.AddMDSOnPremMTLSFlags(cmd)
2021
pcmd.AddContextFlag(cmd, c.CLICommand)
2122

2223
return cmd
2324
}
2425

25-
func (c *configCommand) describe(_ *cobra.Command, _ []string) error {
26-
spec, response, err := c.MDSClient.AuditLogConfigurationApi.GetConfig(c.createContext())
26+
func (c *configCommand) describe(cmd *cobra.Command, _ []string) error {
27+
client, err := c.GetMDSClient(cmd)
28+
if err != nil {
29+
return err
30+
}
31+
32+
spec, response, err := client.AuditLogConfigurationApi.GetConfig(c.createContext())
2733
if err != nil {
2834
return HandleMdsAuditLogApiError(err, response)
2935
}

internal/audit-log/command_config_edit.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,19 @@ func (c *configCommand) newEditCommand() *cobra.Command {
2323
RunE: c.edit,
2424
}
2525

26+
pcmd.AddMDSOnPremMTLSFlags(cmd)
2627
pcmd.AddContextFlag(cmd, c.CLICommand)
2728

2829
return cmd
2930
}
3031

31-
func (c *configCommand) edit(_ *cobra.Command, _ []string) error {
32-
gotSpec, response, err := c.MDSClient.AuditLogConfigurationApi.GetConfig(c.createContext())
32+
func (c *configCommand) edit(cmd *cobra.Command, _ []string) error {
33+
client, err := c.GetMDSClient(cmd)
34+
if err != nil {
35+
return err
36+
}
37+
38+
gotSpec, response, err := client.AuditLogConfigurationApi.GetConfig(c.createContext())
3339
if err != nil {
3440
return HandleMdsAuditLogApiError(err, response)
3541
}
@@ -49,7 +55,7 @@ func (c *configCommand) edit(_ *cobra.Command, _ []string) error {
4955
}
5056
enc := json.NewEncoder(c.OutOrStdout())
5157
enc.SetIndent("", " ")
52-
result, httpResp, err := c.MDSClient.AuditLogConfigurationApi.PutConfig(c.createContext(), putSpec)
58+
result, httpResp, err := client.AuditLogConfigurationApi.PutConfig(c.createContext(), putSpec)
5359
if err != nil {
5460
if httpResp.StatusCode == http.StatusConflict {
5561
_ = enc.Encode(result)

internal/audit-log/command_config_update.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func (c *configCommand) newUpdateCommand() *cobra.Command {
2424

2525
cmd.Flags().String("file", "", "A local file path to the JSON configuration file, read as input. Otherwise the command will read from standard input.")
2626
cmd.Flags().Bool("force", false, "Updates the configuration, overwriting any concurrent modifications.")
27+
pcmd.AddMDSOnPremMTLSFlags(cmd)
2728
pcmd.AddContextFlag(cmd, c.CLICommand)
2829

2930
cobra.CheckErr(cmd.MarkFlagFilename("file", "json"))
@@ -32,8 +33,12 @@ func (c *configCommand) newUpdateCommand() *cobra.Command {
3233
}
3334

3435
func (c *configCommand) update(cmd *cobra.Command, _ []string) error {
36+
client, err := c.GetMDSClient(cmd)
37+
if err != nil {
38+
return err
39+
}
40+
3541
var data []byte
36-
var err error
3742
if cmd.Flags().Changed("file") {
3843
file, err := cmd.Flags().GetString("file")
3944
if err != nil {
@@ -62,7 +67,7 @@ func (c *configCommand) update(cmd *cobra.Command, _ []string) error {
6267
return err
6368
}
6469
if force {
65-
gotSpec, response, err := c.MDSClient.AuditLogConfigurationApi.GetConfig(c.createContext())
70+
gotSpec, response, err := client.AuditLogConfigurationApi.GetConfig(c.createContext())
6671
if err != nil {
6772
return HandleMdsAuditLogApiError(err, response)
6873
}
@@ -80,7 +85,7 @@ func (c *configCommand) update(cmd *cobra.Command, _ []string) error {
8085

8186
enc := json.NewEncoder(c.OutOrStdout())
8287
enc.SetIndent("", " ")
83-
result, httpResp, err := c.MDSClient.AuditLogConfigurationApi.PutConfig(c.createContext(), *putSpec)
88+
result, httpResp, err := client.AuditLogConfigurationApi.PutConfig(c.createContext(), *putSpec)
8489
if err != nil {
8590
if httpResp != nil && httpResp.StatusCode == http.StatusConflict {
8691
if apiError, ok := err.(mdsv1.GenericOpenAPIError); ok {

internal/audit-log/command_route_list.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func (c *routeCommand) newListCommand() *cobra.Command {
2121
}
2222

2323
cmd.Flags().String("resource", "", "The Confluent resource name (CRN) that is the subject of the query.")
24+
pcmd.AddMDSOnPremMTLSFlags(cmd)
2425
pcmd.AddContextFlag(cmd, c.CLICommand)
2526

2627
cobra.CheckErr(cmd.MarkFlagRequired("resource"))
@@ -29,6 +30,11 @@ func (c *routeCommand) newListCommand() *cobra.Command {
2930
}
3031

3132
func (c *routeCommand) list(cmd *cobra.Command, _ []string) error {
33+
client, err := c.GetMDSClient(cmd)
34+
if err != nil {
35+
return err
36+
}
37+
3238
var opts *mdsv1.ListRoutesOpts
3339
if cmd.Flags().Changed("resource") {
3440
resource, err := cmd.Flags().GetString("resource")
@@ -39,7 +45,7 @@ func (c *routeCommand) list(cmd *cobra.Command, _ []string) error {
3945
} else {
4046
opts = &mdsv1.ListRoutesOpts{Q: optional.EmptyString()}
4147
}
42-
result, response, err := c.MDSClient.AuditLogConfigurationApi.ListRoutes(c.createContext(), opts)
48+
result, response, err := client.AuditLogConfigurationApi.ListRoutes(c.createContext(), opts)
4349
if err != nil {
4450
return HandleMdsAuditLogApiError(err, response)
4551
}

internal/audit-log/command_route_lookup.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,21 @@ func (c *routeCommand) newLookupCommand() *cobra.Command {
2020
RunE: c.lookup,
2121
}
2222

23+
pcmd.AddMDSOnPremMTLSFlags(cmd)
2324
pcmd.AddContextFlag(cmd, c.CLICommand)
2425

2526
return cmd
2627
}
2728

28-
func (c *routeCommand) lookup(_ *cobra.Command, args []string) error {
29+
func (c *routeCommand) lookup(cmd *cobra.Command, args []string) error {
30+
client, err := c.GetMDSClient(cmd)
31+
if err != nil {
32+
return err
33+
}
34+
2935
resource := args[0]
3036
opts := &mdsv1.ResolveResourceRouteOpts{Crn: optional.NewString(resource)}
31-
result, response, err := c.MDSClient.AuditLogConfigurationApi.ResolveResourceRoute(c.createContext(), opts)
37+
result, response, err := client.AuditLogConfigurationApi.ResolveResourceRoute(c.createContext(), opts)
3238
if err != nil {
3339
return HandleMdsAuditLogApiError(err, response)
3440
}

0 commit comments

Comments
 (0)