Skip to content

Commit b536284

Browse files
authored
feat(fip): add support for MoveMACAddr on CLI (#2908)
1 parent 06de920 commit b536284

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func GetGeneratedCommands() *core.Commands {
3131
fipIPDetach(),
3232
fipMacCreate(),
3333
fipMacDuplicate(),
34+
fipMacMove(),
3435
fipMacDelete(),
3536
)
3637
}
@@ -491,6 +492,41 @@ func fipMacDuplicate() *core.Command {
491492
}
492493
}
493494

495+
func fipMacMove() *core.Command {
496+
return &core.Command{
497+
Short: `Move a virtual MAC`,
498+
Long: `Move a Virtual MAC from a given Flexible IP onto another Flexible IP.`,
499+
Namespace: "fip",
500+
Resource: "mac",
501+
Verb: "move",
502+
// Deprecated: false,
503+
ArgsType: reflect.TypeOf(flexibleip.MoveMACAddrRequest{}),
504+
ArgSpecs: core.ArgSpecs{
505+
{
506+
Name: "fip-id",
507+
Required: true,
508+
Deprecated: false,
509+
Positional: false,
510+
},
511+
{
512+
Name: "dst-fip-id",
513+
Required: false,
514+
Deprecated: false,
515+
Positional: false,
516+
},
517+
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1),
518+
},
519+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
520+
request := args.(*flexibleip.MoveMACAddrRequest)
521+
522+
client := core.ExtractClient(ctx)
523+
api := flexibleip.NewAPI(client)
524+
return api.MoveMACAddr(request)
525+
526+
},
527+
}
528+
}
529+
494530
func fipMacDelete() *core.Command {
495531
return &core.Command{
496532
Short: `Remove a virtual MAC from a Flexible IP`,

0 commit comments

Comments
 (0)