Skip to content

Commit 861ec97

Browse files
committed
move domain commands to service/domain
1 parent f0a46b9 commit 861ec97

10 files changed

Lines changed: 23 additions & 22 deletions

File tree

pkg/commands/commands.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
dashboardItem "github.com/fastly/cli/pkg/commands/dashboard/item"
1919
"github.com/fastly/cli/pkg/commands/dictionary"
2020
"github.com/fastly/cli/pkg/commands/dictionaryentry"
21-
"github.com/fastly/cli/pkg/commands/domain"
2221
"github.com/fastly/cli/pkg/commands/domainv1"
2322
"github.com/fastly/cli/pkg/commands/healthcheck"
2423
"github.com/fastly/cli/pkg/commands/imageoptimizerdefaults"
@@ -94,6 +93,7 @@ import (
9493
"github.com/fastly/cli/pkg/commands/secretstore"
9594
"github.com/fastly/cli/pkg/commands/secretstoreentry"
9695
"github.com/fastly/cli/pkg/commands/service"
96+
"github.com/fastly/cli/pkg/commands/service/domain"
9797
"github.com/fastly/cli/pkg/commands/serviceauth"
9898
"github.com/fastly/cli/pkg/commands/serviceversion"
9999
"github.com/fastly/cli/pkg/commands/shellcomplete"
@@ -221,13 +221,6 @@ func Define( // nolint:revive // function-length
221221
dictionaryEntryUpdate := dictionaryentry.NewUpdateCommand(dictionaryEntryCmdRoot.CmdClause, data)
222222
dictionaryList := dictionary.NewListCommand(dictionaryCmdRoot.CmdClause, data)
223223
dictionaryUpdate := dictionary.NewUpdateCommand(dictionaryCmdRoot.CmdClause, data)
224-
domainCmdRoot := domain.NewRootCommand(app, data)
225-
domainCreate := domain.NewCreateCommand(domainCmdRoot.CmdClause, data)
226-
domainDelete := domain.NewDeleteCommand(domainCmdRoot.CmdClause, data)
227-
domainDescribe := domain.NewDescribeCommand(domainCmdRoot.CmdClause, data)
228-
domainList := domain.NewListCommand(domainCmdRoot.CmdClause, data)
229-
domainUpdate := domain.NewUpdateCommand(domainCmdRoot.CmdClause, data)
230-
domainValidate := domain.NewValidateCommand(domainCmdRoot.CmdClause, data)
231224
domainv1CmdRoot := domainv1.NewRootCommand(app, data)
232225
domainv1Create := domainv1.NewCreateCommand(domainv1CmdRoot.CmdClause, data)
233226
domainv1Delete := domainv1.NewDeleteCommand(domainv1CmdRoot.CmdClause, data)
@@ -638,6 +631,13 @@ func Define( // nolint:revive // function-length
638631
serviceVersionStage := serviceversion.NewStageCommand(serviceVersionCmdRoot.CmdClause, data)
639632
serviceVersionUnstage := serviceversion.NewUnstageCommand(serviceVersionCmdRoot.CmdClause, data)
640633
serviceVersionUpdate := serviceversion.NewUpdateCommand(serviceVersionCmdRoot.CmdClause, data)
634+
servicedomainCmdRoot := domain.NewRootCommand(serviceCmdRoot.CmdClause, data)
635+
servicedomainCreate := domain.NewCreateCommand(servicedomainCmdRoot.CmdClause, data)
636+
servicedomainDelete := domain.NewDeleteCommand(servicedomainCmdRoot.CmdClause, data)
637+
servicedomainDescribe := domain.NewDescribeCommand(servicedomainCmdRoot.CmdClause, data)
638+
servicedomainList := domain.NewListCommand(servicedomainCmdRoot.CmdClause, data)
639+
servicedomainUpdate := domain.NewUpdateCommand(servicedomainCmdRoot.CmdClause, data)
640+
servicedomainValidate := domain.NewValidateCommand(servicedomainCmdRoot.CmdClause, data)
641641
statsCmdRoot := stats.NewRootCommand(app, data)
642642
statsHistorical := stats.NewHistoricalCommand(statsCmdRoot.CmdClause, data)
643643
statsRealtime := stats.NewRealtimeCommand(statsCmdRoot.CmdClause, data)
@@ -799,13 +799,6 @@ func Define( // nolint:revive // function-length
799799
dictionaryEntryUpdate,
800800
dictionaryList,
801801
dictionaryUpdate,
802-
domainCmdRoot,
803-
domainCreate,
804-
domainDelete,
805-
domainDescribe,
806-
domainList,
807-
domainUpdate,
808-
domainValidate,
809802
domainv1CmdRoot,
810803
domainv1Create,
811804
domainv1Delete,
@@ -1201,6 +1194,13 @@ func Define( // nolint:revive // function-length
12011194
serviceauthDescribe,
12021195
serviceauthList,
12031196
serviceauthUpdate,
1197+
servicedomainCmdRoot,
1198+
servicedomainCreate,
1199+
servicedomainDelete,
1200+
servicedomainDescribe,
1201+
servicedomainList,
1202+
servicedomainUpdate,
1203+
servicedomainValidate,
12041204
serviceVersionActivate,
12051205
serviceVersionClone,
12061206
serviceVersionCmdRoot,

pkg/commands/domain/domain_test.go renamed to pkg/commands/service/domain/domain_test.go

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

1010
"github.com/fastly/go-fastly/v12/fastly"
1111

12-
root "github.com/fastly/cli/pkg/commands/domain"
12+
root "github.com/fastly/cli/pkg/commands/service"
13+
sub "github.com/fastly/cli/pkg/commands/service/domain"
1314
"github.com/fastly/cli/pkg/mock"
1415
"github.com/fastly/cli/pkg/testutil"
1516
)
@@ -39,7 +40,7 @@ func TestDomainCreate(t *testing.T) {
3940
WantError: errTest.Error(),
4041
},
4142
}
42-
testutil.RunCLIScenarios(t, []string{root.CommandName, "create"}, scenarios)
43+
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "create"}, scenarios)
4344
}
4445

4546
func TestDomainList(t *testing.T) {
@@ -93,7 +94,7 @@ func TestDomainList(t *testing.T) {
9394
WantError: errTest.Error(),
9495
},
9596
}
96-
testutil.RunCLIScenarios(t, []string{root.CommandName, "list"}, scenarios)
97+
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "list"}, scenarios)
9798
}
9899

99100
func TestDomainDescribe(t *testing.T) {
@@ -119,7 +120,7 @@ func TestDomainDescribe(t *testing.T) {
119120
WantOutput: describeDomainOutput,
120121
},
121122
}
122-
testutil.RunCLIScenarios(t, []string{root.CommandName, "describe"}, scenarios)
123+
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "describe"}, scenarios)
123124
}
124125

125126
func TestDomainUpdate(t *testing.T) {
@@ -156,7 +157,7 @@ func TestDomainUpdate(t *testing.T) {
156157
WantOutput: "Updated domain www.example.com (service 123 version 4)",
157158
},
158159
}
159-
testutil.RunCLIScenarios(t, []string{root.CommandName, "update"}, scenarios)
160+
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "update"}, scenarios)
160161
}
161162

162163
func TestDomainDelete(t *testing.T) {
@@ -184,7 +185,7 @@ func TestDomainDelete(t *testing.T) {
184185
WantOutput: "Deleted domain www.test.com (service 123 version 4)",
185186
},
186187
}
187-
testutil.RunCLIScenarios(t, []string{root.CommandName, "delete"}, scenarios)
188+
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "delete"}, scenarios)
188189
}
189190

190191
func TestDomainValidate(t *testing.T) {
@@ -257,7 +258,7 @@ func TestDomainValidate(t *testing.T) {
257258
},
258259
}
259260

260-
testutil.RunCLIScenarios(t, []string{root.CommandName, "validate"}, scenarios)
261+
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "validate"}, scenarios)
261262
}
262263

263264
var errTest = errors.New("fixture error")

0 commit comments

Comments
 (0)