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/cli/serverless/auditlog/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package auditlog
import (
"github.com/spf13/cobra"
"github.com/tidbcloud/tidbcloud-cli/internal"
"github.com/tidbcloud/tidbcloud-cli/internal/cli/serverless/auditlog/config"
"github.com/tidbcloud/tidbcloud-cli/internal/cli/serverless/auditlog/filter"
)

Expand All @@ -28,8 +29,7 @@ func AuditLoggingCmd(h *internal.Helper) *cobra.Command {
}

auditLoggingCmd.AddCommand(DownloadCmd(h))
auditLoggingCmd.AddCommand(DescribeCmd(h))
auditLoggingCmd.AddCommand(ConfigCmd(h))
auditLoggingCmd.AddCommand(config.ConfigCmd(h))
auditLoggingCmd.AddCommand(filter.FilterRuleCmd(h))

return auditLoggingCmd
Expand Down
216 changes: 0 additions & 216 deletions internal/cli/serverless/auditlog/config.go

This file was deleted.

32 changes: 32 additions & 0 deletions internal/cli/serverless/auditlog/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2025 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package config

import (
"github.com/spf13/cobra"
"github.com/tidbcloud/tidbcloud-cli/internal"
)

func ConfigCmd(h *internal.Helper) *cobra.Command {
var configCmd = &cobra.Command{
Use: "config",
Short: "Manage TiDB Cloud Serverless database audit logging configuration",
}

configCmd.AddCommand(DescribeCmd(h))
configCmd.AddCommand(UpdateCmd(h))

return configCmd
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package auditlog
package config

import (
"fmt"
Expand All @@ -24,7 +24,6 @@ import (
"github.com/tidbcloud/tidbcloud-cli/internal/flag"
"github.com/tidbcloud/tidbcloud-cli/internal/output"
"github.com/tidbcloud/tidbcloud-cli/internal/service/cloud"
"github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/cluster"
)

type DescribeOpts struct {
Expand Down Expand Up @@ -69,10 +68,10 @@ func DescribeCmd(h *internal.Helper) *cobra.Command {
Aliases: []string{"get"},
Args: cobra.NoArgs,
Example: fmt.Sprintf(` Get the database audit logging configuration in interactive mode:
$ %[1]s serverless audit-log describe
$ %[1]s serverless audit-log config describe

Get the database audit logging configuration in non-interactive mode:
$ %[1]s serverless audit-log describe -c <cluster-id> `, config.CliName),
$ %[1]s serverless audit-log config describe -c <cluster-id> `, config.CliName),
PreRunE: func(cmd *cobra.Command, args []string) error {
return opts.MarkInteractive(cmd)
},
Expand Down Expand Up @@ -104,12 +103,12 @@ func DescribeCmd(h *internal.Helper) *cobra.Command {
}
}

cluster, err := d.GetCluster(ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC)
auditlogConfig, err := d.GetAuditLogConfig(ctx, clusterID)
if err != nil {
return errors.Trace(err)
}

err = output.PrintJson(h.IOStreams.Out, cluster.AuditLogConfig)
err = output.PrintJson(h.IOStreams.Out, auditlogConfig)
return errors.Trace(err)
},
}
Expand Down
Loading
Loading