Skip to content

Commit 7176f79

Browse files
committed
refactor: varadic optional resource mutators in move operation
Signed-off-by: Tarun Gupta Akirala <[email protected]>
1 parent 1f4a6b0 commit 7176f79

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

cmd/clusterctl/client/cluster/mover.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type ResourceMutatorFunc func(u *unstructured.Unstructured)
4848
// ObjectMover defines methods for moving Cluster API objects to another management cluster.
4949
type ObjectMover interface {
5050
// Move moves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target management cluster.
51-
Move(namespace string, mutators []ResourceMutatorFunc, toCluster Client, dryRun bool) error
51+
Move(namespace string, toCluster Client, dryRun bool, mutators ...ResourceMutatorFunc) error
5252

5353
// ToDirectory writes all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target directory.
5454
ToDirectory(namespace string, directory string) error
@@ -67,7 +67,7 @@ type objectMover struct {
6767
// ensure objectMover implements the ObjectMover interface.
6868
var _ ObjectMover = &objectMover{}
6969

70-
func (o *objectMover) Move(namespace string, mutators []ResourceMutatorFunc, toCluster Client, dryRun bool) error {
70+
func (o *objectMover) Move(namespace string, toCluster Client, dryRun bool, mutators ...ResourceMutatorFunc) error {
7171
log := logf.Log
7272
log.Info("Performing move...")
7373
o.dryRun = dryRun

cmd/clusterctl/client/move.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (c *clusterctlClient) move(options MoveOptions) error {
9898
}
9999
}
100100

101-
return fromCluster.ObjectMover().Move(options.Namespace, options.ExperimentalResourceMutators, toCluster, options.DryRun)
101+
return fromCluster.ObjectMover().Move(options.Namespace, toCluster, options.DryRun, options.ExperimentalResourceMutators...)
102102
}
103103

104104
func (c *clusterctlClient) fromDirectory(options MoveOptions) error {

cmd/clusterctl/client/move_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ type fakeObjectMover struct {
298298
fromDirectoryErr error
299299
}
300300

301-
func (f *fakeObjectMover) Move(_ string, _ []cluster.ResourceMutatorFunc, _ cluster.Client, _ bool) error {
301+
func (f *fakeObjectMover) Move(namespace string, toCluster cluster.Client, dryRun bool, mutators ...cluster.ResourceMutatorFunc) error {
302302
return f.moveErr
303303
}
304304

0 commit comments

Comments
 (0)