Skip to content

Commit

Permalink
refactor: move assign/unassign actions to reserved-ipv6 command (#1630)
Browse files Browse the repository at this point in the history
* vendor: update godo dependency to v1.131.1

* refactor: move assign/unassign actions to reserved-ipv6 command

* test: add assign and unassign commands to reserved IPv6 tests
  • Loading branch information
amanoj-do authored Dec 11, 2024
1 parent 7935b48 commit 0022e58
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 355 deletions.
74 changes: 36 additions & 38 deletions commands/command_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,42 @@ type CmdConfig struct {
componentBuilderFactory builder.ComponentBuilderFactory

// services
Keys func() do.KeysService
Sizes func() do.SizesService
Regions func() do.RegionsService
Images func() do.ImagesService
ImageActions func() do.ImageActionsService
LoadBalancers func() do.LoadBalancersService
ReservedIPs func() do.ReservedIPsService
ReservedIPv6s func() do.ReservedIPv6sService
ReservedIPv6Actions func() do.ReservedIPv6ActionsService
ReservedIPActions func() do.ReservedIPActionsService
Droplets func() do.DropletsService
DropletActions func() do.DropletActionsService
DropletAutoscale func() do.DropletAutoscaleService
Domains func() do.DomainsService
Actions func() do.ActionsService
Account func() do.AccountService
Balance func() do.BalanceService
BillingHistory func() do.BillingHistoryService
Invoices func() do.InvoicesService
Tags func() do.TagsService
UptimeChecks func() do.UptimeChecksService
Volumes func() do.VolumesService
VolumeActions func() do.VolumeActionsService
Snapshots func() do.SnapshotsService
Certificates func() do.CertificatesService
Firewalls func() do.FirewallsService
CDNs func() do.CDNsService
Projects func() do.ProjectsService
Kubernetes func() do.KubernetesService
Databases func() do.DatabasesService
Registry func() do.RegistryService
VPCs func() do.VPCsService
OneClicks func() do.OneClickService
Apps func() do.AppsService
Monitoring func() do.MonitoringService
Serverless func() do.ServerlessService
OAuth func() do.OAuthService
Keys func() do.KeysService
Sizes func() do.SizesService
Regions func() do.RegionsService
Images func() do.ImagesService
ImageActions func() do.ImageActionsService
LoadBalancers func() do.LoadBalancersService
ReservedIPs func() do.ReservedIPsService
ReservedIPActions func() do.ReservedIPActionsService
ReservedIPv6s func() do.ReservedIPv6sService
Droplets func() do.DropletsService
DropletActions func() do.DropletActionsService
DropletAutoscale func() do.DropletAutoscaleService
Domains func() do.DomainsService
Actions func() do.ActionsService
Account func() do.AccountService
Balance func() do.BalanceService
BillingHistory func() do.BillingHistoryService
Invoices func() do.InvoicesService
Tags func() do.TagsService
UptimeChecks func() do.UptimeChecksService
Volumes func() do.VolumesService
VolumeActions func() do.VolumeActionsService
Snapshots func() do.SnapshotsService
Certificates func() do.CertificatesService
Firewalls func() do.FirewallsService
CDNs func() do.CDNsService
Projects func() do.ProjectsService
Kubernetes func() do.KubernetesService
Databases func() do.DatabasesService
Registry func() do.RegistryService
VPCs func() do.VPCsService
OneClicks func() do.OneClickService
Apps func() do.AppsService
Monitoring func() do.MonitoringService
Serverless func() do.ServerlessService
OAuth func() do.OAuthService
}

// NewCmdConfig creates an instance of a CmdConfig.
Expand All @@ -101,7 +100,6 @@ func NewCmdConfig(ns string, dc doctl.Config, out io.Writer, args []string, init
c.ReservedIPs = func() do.ReservedIPsService { return do.NewReservedIPsService(godoClient) }
c.ReservedIPActions = func() do.ReservedIPActionsService { return do.NewReservedIPActionsService(godoClient) }
c.ReservedIPv6s = func() do.ReservedIPv6sService { return do.NewReservedIPv6sService(godoClient) }
c.ReservedIPv6Actions = func() do.ReservedIPv6ActionsService { return do.NewReservedIPv6ActionsService(godoClient) }
c.Droplets = func() do.DropletsService { return do.NewDropletsService(godoClient) }
c.DropletActions = func() do.DropletActionsService { return do.NewDropletActionsService(godoClient) }
c.DropletAutoscale = func() do.DropletAutoscaleService { return do.NewDropletAutoscaleService(godoClient) }
Expand Down
75 changes: 36 additions & 39 deletions commands/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ type tcMocks struct {
reservedIPs *domocks.MockReservedIPsService
reservedIPActions *domocks.MockReservedIPActionsService
reservedIPv6s *domocks.MockReservedIPv6sService
reservedIPv6Actions *domocks.MockReservedIPv6ActionsService
domains *domocks.MockDomainsService
uptimeChecks *domocks.MockUptimeChecksService
volumes *domocks.MockVolumesService
Expand Down Expand Up @@ -276,7 +275,6 @@ func withTestClient(t *testing.T, tFn testFn) {
reservedIPs: domocks.NewMockReservedIPsService(ctrl),
reservedIPActions: domocks.NewMockReservedIPActionsService(ctrl),
reservedIPv6s: domocks.NewMockReservedIPv6sService(ctrl),
reservedIPv6Actions: domocks.NewMockReservedIPv6ActionsService(ctrl),
droplets: domocks.NewMockDropletsService(ctrl),
dropletActions: domocks.NewMockDropletActionsService(ctrl),
dropletAutoscale: domocks.NewMockDropletAutoscaleService(ctrl),
Expand Down Expand Up @@ -326,43 +324,42 @@ func withTestClient(t *testing.T, tFn testFn) {

componentBuilderFactory: tm.appBuilderFactory,

Keys: func() do.KeysService { return tm.keys },
Sizes: func() do.SizesService { return tm.sizes },
Regions: func() do.RegionsService { return tm.regions },
Images: func() do.ImagesService { return tm.images },
ImageActions: func() do.ImageActionsService { return tm.imageActions },
ReservedIPs: func() do.ReservedIPsService { return tm.reservedIPs },
ReservedIPActions: func() do.ReservedIPActionsService { return tm.reservedIPActions },
ReservedIPv6s: func() do.ReservedIPv6sService { return tm.reservedIPv6s },
ReservedIPv6Actions: func() do.ReservedIPv6ActionsService { return tm.reservedIPv6Actions },
Droplets: func() do.DropletsService { return tm.droplets },
DropletActions: func() do.DropletActionsService { return tm.dropletActions },
DropletAutoscale: func() do.DropletAutoscaleService { return tm.dropletAutoscale },
Domains: func() do.DomainsService { return tm.domains },
Actions: func() do.ActionsService { return tm.actions },
Account: func() do.AccountService { return tm.account },
Balance: func() do.BalanceService { return tm.balance },
BillingHistory: func() do.BillingHistoryService { return tm.billingHistory },
Invoices: func() do.InvoicesService { return tm.invoices },
Tags: func() do.TagsService { return tm.tags },
UptimeChecks: func() do.UptimeChecksService { return tm.uptimeChecks },
Volumes: func() do.VolumesService { return tm.volumes },
VolumeActions: func() do.VolumeActionsService { return tm.volumeActions },
Snapshots: func() do.SnapshotsService { return tm.snapshots },
Certificates: func() do.CertificatesService { return tm.certificates },
LoadBalancers: func() do.LoadBalancersService { return tm.loadBalancers },
Firewalls: func() do.FirewallsService { return tm.firewalls },
CDNs: func() do.CDNsService { return tm.cdns },
Projects: func() do.ProjectsService { return tm.projects },
Kubernetes: func() do.KubernetesService { return tm.kubernetes },
Databases: func() do.DatabasesService { return tm.databases },
Registry: func() do.RegistryService { return tm.registry },
VPCs: func() do.VPCsService { return tm.vpcs },
OneClicks: func() do.OneClickService { return tm.oneClick },
Apps: func() do.AppsService { return tm.apps },
Monitoring: func() do.MonitoringService { return tm.monitoring },
Serverless: func() do.ServerlessService { return tm.serverless },
OAuth: func() do.OAuthService { return tm.oauth },
Keys: func() do.KeysService { return tm.keys },
Sizes: func() do.SizesService { return tm.sizes },
Regions: func() do.RegionsService { return tm.regions },
Images: func() do.ImagesService { return tm.images },
ImageActions: func() do.ImageActionsService { return tm.imageActions },
ReservedIPs: func() do.ReservedIPsService { return tm.reservedIPs },
ReservedIPActions: func() do.ReservedIPActionsService { return tm.reservedIPActions },
ReservedIPv6s: func() do.ReservedIPv6sService { return tm.reservedIPv6s },
Droplets: func() do.DropletsService { return tm.droplets },
DropletActions: func() do.DropletActionsService { return tm.dropletActions },
DropletAutoscale: func() do.DropletAutoscaleService { return tm.dropletAutoscale },
Domains: func() do.DomainsService { return tm.domains },
Actions: func() do.ActionsService { return tm.actions },
Account: func() do.AccountService { return tm.account },
Balance: func() do.BalanceService { return tm.balance },
BillingHistory: func() do.BillingHistoryService { return tm.billingHistory },
Invoices: func() do.InvoicesService { return tm.invoices },
Tags: func() do.TagsService { return tm.tags },
UptimeChecks: func() do.UptimeChecksService { return tm.uptimeChecks },
Volumes: func() do.VolumesService { return tm.volumes },
VolumeActions: func() do.VolumeActionsService { return tm.volumeActions },
Snapshots: func() do.SnapshotsService { return tm.snapshots },
Certificates: func() do.CertificatesService { return tm.certificates },
LoadBalancers: func() do.LoadBalancersService { return tm.loadBalancers },
Firewalls: func() do.FirewallsService { return tm.firewalls },
CDNs: func() do.CDNsService { return tm.cdns },
Projects: func() do.ProjectsService { return tm.projects },
Kubernetes: func() do.KubernetesService { return tm.kubernetes },
Databases: func() do.DatabasesService { return tm.databases },
Registry: func() do.RegistryService { return tm.registry },
VPCs: func() do.VPCsService { return tm.vpcs },
OneClicks: func() do.OneClickService { return tm.oneClick },
Apps: func() do.AppsService { return tm.apps },
Monitoring: func() do.MonitoringService { return tm.monitoring },
Serverless: func() do.ServerlessService { return tm.serverless },
OAuth: func() do.OAuthService { return tm.oauth },
}

tFn(config, tm)
Expand Down
1 change: 0 additions & 1 deletion commands/doit.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ func computeCmd() *Command {
cmd.AddCommand(ReservedIP())
cmd.AddCommand(ReservedIPAction())
cmd.AddCommand(ReservedIPv6())
cmd.AddCommand(ReservedIPv6Action())
cmd.AddCommand(Images())
cmd.AddCommand(ImageAction())
cmd.AddCommand(LoadBalancer())
Expand Down
93 changes: 0 additions & 93 deletions commands/reserved_ipv6_actions.go

This file was deleted.

48 changes: 0 additions & 48 deletions commands/reserved_ipv6_actions_test.go

This file was deleted.

Loading

0 comments on commit 0022e58

Please sign in to comment.