feat(recording): Delete Session Recording

This commit is contained in:
Louis Ruch committed 2024-01-16 13:53:44 -08:00
1 parent 0a853c2262
commit f26243e9af
17 files changed
+641 -138

No files matched your search

+5
View File
@@ -1000,6 +1000,11 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
&sessionrecordingscmd.DownloadCommand{
Command: base.NewCommand(ui),
}),
"session-recordings delete": clientCacheWrapper(
&sessionrecordingscmd.Command{
Command: base.NewCommand(ui),
Func: "delete",
}),
"storage-buckets": func() (cli.Command, error) {
return &storagebucketscmd.Command{
@@ -70,6 +70,9 @@ func (c *Command) Help() string {
switch c.Func {
case "delete":
helpStr = helpMap[c.Func]() + c.Flags().Help()
case "read":
helpStr = helpMap[c.Func]() + c.Flags().Help()
@@ -89,6 +92,8 @@ func (c *Command) Help() string {
var flagsMap = map[string][]string{
"delete": {"id"},
"read": {"id"},
"list": {"scope-id", "recursive"},
@@ -185,12 +190,21 @@ func (c *Command) Run(args []string) int {
var items []*sessionrecordings.SessionRecording
var deleteResult *sessionrecordings.SessionRecordingDeleteResult
var readResult *sessionrecordings.SessionRecordingReadResult
var listResult *sessionrecordings.SessionRecordingListResult
switch c.Func {
case "delete":
deleteResult, err = sessionrecordingsClient.Delete(c.Context, c.FlagId, opts...)
if exitCode := c.checkFuncError(err); exitCode > 0 {
return exitCode
}
resp = deleteResult.GetResponse()
case "read":
readResult, err = sessionrecordingsClient.Read(c.Context, c.FlagId, opts...)
if exitCode := c.checkFuncError(err); exitCode > 0 {
@@ -225,6 +239,19 @@ func (c *Command) Run(args []string) int {
switch c.Func {
case "delete":
switch base.Format(c.UI) {
case "json":
if ok := c.PrintJsonItem(resp); !ok {
return base.CommandCliError
}
case "table":
c.UI.Output("The delete operation completed successfully.")
}
return base.CommandSuccess
case "list":
switch base.Format(c.UI) {
case "json":
+1 -1
View File
@@ -599,7 +599,7 @@ var inputStructs = map[string][]*cmdInfo{
{
ResourceType: resource.SessionRecording.String(),
Pkg: "sessionrecordings",
StdActions: []string{"read", "list"},
StdActions: []string{"delete", "read", "list"},
Container: "Scope",
HasExtraCommandVars: true,
HasExtraHelpFunc: true,