Skip to content

Commit b73b863

Browse files
Merge remote-tracking branch 'origin/main' into CDTOOL-1219-ngwaf-lists
2 parents 4ea7d89 + 94bd43c commit b73b863

13 files changed

Lines changed: 27 additions & 24 deletions

File tree

pkg/commands/commands.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ import (
5858
"github.com/fastly/cli/pkg/commands/ngwaf"
5959
"github.com/fastly/cli/pkg/commands/ngwaf/countrylist"
6060
"github.com/fastly/cli/pkg/commands/ngwaf/iplist"
61-
"github.com/fastly/cli/pkg/commands/ngwaf/redaction"
6261
"github.com/fastly/cli/pkg/commands/ngwaf/signallist"
6362
"github.com/fastly/cli/pkg/commands/ngwaf/stringlist"
64-
"github.com/fastly/cli/pkg/commands/ngwaf/virtualpatch"
6563
"github.com/fastly/cli/pkg/commands/ngwaf/wildcardlist"
6664
"github.com/fastly/cli/pkg/commands/ngwaf/workspace"
6765
wscountrylist "github.com/fastly/cli/pkg/commands/ngwaf/workspace/countrylist"
6866
wsiplist "github.com/fastly/cli/pkg/commands/ngwaf/workspace/iplist"
67+
"github.com/fastly/cli/pkg/commands/ngwaf/workspace/redaction"
6968
wssignallistlist "github.com/fastly/cli/pkg/commands/ngwaf/workspace/signallist"
7069
wsstringlistlist "github.com/fastly/cli/pkg/commands/ngwaf/workspace/stringlist"
70+
"github.com/fastly/cli/pkg/commands/ngwaf/workspace/virtualpatch"
7171
wswildcardlistlist "github.com/fastly/cli/pkg/commands/ngwaf/workspace/wildcardlist"
7272
"github.com/fastly/cli/pkg/commands/objectstorage"
7373
"github.com/fastly/cli/pkg/commands/objectstorage/accesskeys"
@@ -408,7 +408,8 @@ func Define( // nolint:revive // function-length
408408
loggingSyslogList := syslog.NewListCommand(loggingSyslogCmdRoot.CmdClause, data)
409409
loggingSyslogUpdate := syslog.NewUpdateCommand(loggingSyslogCmdRoot.CmdClause, data)
410410
ngwafRoot := ngwaf.NewRootCommand(app, data)
411-
ngwafRedactionRoot := redaction.NewRootCommand(ngwafRoot.CmdClause, data)
411+
ngwafWorkspacesRoot := workspace.NewRootCommand(ngwafRoot.CmdClause, data)
412+
ngwafRedactionRoot := redaction.NewRootCommand(ngwafWorkspacesRoot.CmdClause, data)
412413
ngwafRedactionCreate := redaction.NewCreateCommand(ngwafRedactionRoot.CmdClause, data)
413414
ngwafRedactionDelete := redaction.NewDeleteCommand(ngwafRedactionRoot.CmdClause, data)
414415
ngwafRedactionList := redaction.NewListCommand(ngwafRedactionRoot.CmdClause, data)
@@ -480,7 +481,7 @@ func Define( // nolint:revive // function-length
480481
ngwafWorkspaceWildcardListGet := wswildcardlistlist.NewGetCommand(ngwafWorkspaceWildcardListRoot.CmdClause, data)
481482
ngwafWorkspaceWildcardListList := wswildcardlistlist.NewListCommand(ngwafWorkspaceWildcardListRoot.CmdClause, data)
482483
ngwafWorkspaceWildcardListUpdate := wswildcardlistlist.NewUpdateCommand(ngwafWorkspaceWildcardListRoot.CmdClause, data)
483-
ngwafVirtualpatchRoot := virtualpatch.NewRootCommand(ngwafRoot.CmdClause, data)
484+
ngwafVirtualpatchRoot := virtualpatch.NewRootCommand(ngwafWorkspacesRoot.CmdClause, data)
484485
ngwafVirtualpatchList := virtualpatch.NewListCommand(ngwafVirtualpatchRoot.CmdClause, data)
485486
ngwafVirtualpatchUpdate := virtualpatch.NewUpdateCommand(ngwafVirtualpatchRoot.CmdClause, data)
486487
ngwafVirtualpatchRetrieve := virtualpatch.NewRetrieveCommand(ngwafVirtualpatchRoot.CmdClause, data)

pkg/commands/ngwaf/redaction/create.go renamed to pkg/commands/ngwaf/workspace/redaction/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ type CreateCommand struct {
2424
workspaceID argparser.OptionalWorkspaceID
2525
}
2626

27-
// NewUpdateCommand returns a usable command registered under the parent.
27+
// NewCreateCommand returns a usable command registered under the parent.
2828
func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateCommand {
2929
c := CreateCommand{
3030
Base: argparser.Base{
3131
Globals: g,
3232
},
3333
}
34-
c.CmdClause = parent.Command("create", "Create a redaction")
34+
c.CmdClause = parent.Command("create", "Create a redaction").Alias("add")
3535

3636
// Required.
3737
c.CmdClause.Flag("field", "The name of the field that should be redacted.").Required().StringVar(&c.field)

pkg/commands/ngwaf/redaction/delete.go renamed to pkg/commands/ngwaf/workspace/redaction/delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/fastly/cli/pkg/text"
1616
)
1717

18-
// DeleteCommand calls the Fastly API to delete a workspace.
18+
// DeleteCommand calls the Fastly API to delete a redaction.
1919
type DeleteCommand struct {
2020
argparser.Base
2121
argparser.JSONOutput
@@ -36,7 +36,7 @@ func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteComman
3636
c.CmdClause = parent.Command("delete", "Delete a redaction")
3737

3838
// Required.
39-
c.CmdClause.Flag("redaction-id", "Workspace ID").Required().StringVar(&c.redactionID)
39+
c.CmdClause.Flag("redaction-id", "Redaction ID").Required().StringVar(&c.redactionID)
4040
c.RegisterFlag(argparser.StringFlagOpts{
4141
Name: argparser.FlagNGWAFWorkspaceID,
4242
Description: argparser.FlagNGWAFWorkspaceIDDesc,
File renamed without changes.

pkg/commands/ngwaf/redaction/redaction_test.go renamed to pkg/commands/ngwaf/workspace/redaction/redaction_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import (
99
"testing"
1010

1111
root "github.com/fastly/cli/pkg/commands/ngwaf"
12-
sub "github.com/fastly/cli/pkg/commands/ngwaf/redaction"
12+
workspace "github.com/fastly/cli/pkg/commands/ngwaf/workspace"
13+
sub "github.com/fastly/cli/pkg/commands/ngwaf/workspace/redaction"
1314
fstfmt "github.com/fastly/cli/pkg/fmt"
1415
"github.com/fastly/cli/pkg/testutil"
1516
"github.com/fastly/go-fastly/v12/fastly/ngwaf/v1/workspaces/redactions"
@@ -89,7 +90,7 @@ func TestRedactionCreate(t *testing.T) {
8990
},
9091
}
9192

92-
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "create"}, scenarios)
93+
testutil.RunCLIScenarios(t, []string{root.CommandName, workspace.CommandName, sub.CommandName, "create"}, scenarios)
9394
}
9495

9596
func TestRedactionDelete(t *testing.T) {
@@ -151,7 +152,7 @@ func TestRedactionDelete(t *testing.T) {
151152
},
152153
}
153154

154-
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "delete"}, scenarios)
155+
testutil.RunCLIScenarios(t, []string{root.CommandName, workspace.CommandName, sub.CommandName, "delete"}, scenarios)
155156
}
156157

157158
func TestRedactionRetrieve(t *testing.T) {
@@ -215,7 +216,7 @@ func TestRedactionRetrieve(t *testing.T) {
215216
},
216217
}
217218

218-
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "retrieve"}, scenarios)
219+
testutil.RunCLIScenarios(t, []string{root.CommandName, workspace.CommandName, sub.CommandName, "retrieve"}, scenarios)
219220
}
220221

221222
func TestRedactionList(t *testing.T) {
@@ -303,7 +304,7 @@ func TestRedactionList(t *testing.T) {
303304
},
304305
}
305306

306-
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "list"}, scenarios)
307+
testutil.RunCLIScenarios(t, []string{root.CommandName, workspace.CommandName, sub.CommandName, "list"}, scenarios)
307308
}
308309

309310
func TestRedactionUpdate(t *testing.T) {
@@ -354,7 +355,7 @@ func TestRedactionUpdate(t *testing.T) {
354355
WantOutput: fstfmt.EncodeJSON(redaction),
355356
},
356357
}
357-
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "update"}, scenarios)
358+
testutil.RunCLIScenarios(t, []string{root.CommandName, workspace.CommandName, sub.CommandName, "update"}, scenarios)
358359
}
359360

360361
var listRedactionString = strings.TrimSpace(`

pkg/commands/ngwaf/redaction/retrieve.go renamed to pkg/commands/ngwaf/workspace/redaction/retrieve.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/fastly/cli/pkg/text"
1515
)
1616

17-
// GetCommand calls the Fastly API to get a workspace.
17+
// GetCommand calls the Fastly API to get a redaction.
1818
type GetCommand struct {
1919
argparser.Base
2020
argparser.JSONOutput
@@ -32,7 +32,7 @@ func NewRetrieveCommand(parent argparser.Registerer, g *global.Data) *GetCommand
3232
},
3333
}
3434

35-
c.CmdClause = parent.Command("retrieve", "Retrieve a redaction")
35+
c.CmdClause = parent.Command("retrieve", "Retrieve a redaction").Alias("get")
3636

3737
// Required.
3838
c.CmdClause.Flag("redaction-id", "Redaction ID").Required().StringVar(&c.redactionID)
File renamed without changes.
File renamed without changes.

pkg/commands/ngwaf/virtualpatch/list.go renamed to pkg/commands/ngwaf/workspace/virtualpatch/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func NewListCommand(parent argparser.Registerer, g *global.Data) *ListCommand {
3131
},
3232
}
3333

34-
c.CmdClause = parent.Command("list", "List vitual patches in a workspace")
34+
c.CmdClause = parent.Command("list", "List virtual patches in a workspace")
3535

3636
// Required.
3737
c.CmdClause.Flag("workspace-id", "Workspace ID").Required().StringVar(&c.workspaceID)

pkg/commands/ngwaf/virtualpatch/retrieve.go renamed to pkg/commands/ngwaf/workspace/virtualpatch/retrieve.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/fastly/cli/pkg/text"
1515
)
1616

17-
// GetCommand calls the Fastly API to get a workspace.
17+
// GetCommand calls the Fastly API to get a virtual patch.
1818
type GetCommand struct {
1919
argparser.Base
2020
argparser.JSONOutput
@@ -32,7 +32,7 @@ func NewRetrieveCommand(parent argparser.Registerer, g *global.Data) *GetCommand
3232
},
3333
}
3434

35-
c.CmdClause = parent.Command("retrieve", "Retrieve a vitual patch")
35+
c.CmdClause = parent.Command("retrieve", "Retrieve a virtual patch").Alias("get")
3636

3737
// Required.
3838
c.CmdClause.Flag("virtual-patch-id", "Virtual Patch ID").Required().StringVar(&c.virtualpatchID)

0 commit comments

Comments
 (0)