From 03159c667e344f57f1dee4b152e0e1221f2e889e Mon Sep 17 00:00:00 2001 From: Kazumichi Yamamoto Date: Thu, 31 Aug 2023 09:02:20 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20mapconv=E3=81=A7=E3=83=9D=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=BF=E3=82=92=E5=8F=97=E3=81=91=E5=8F=96=E3=82=8B?= =?UTF-8?q?=E7=AE=87=E6=89=80=E3=81=A7=E3=81=AEdereference=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=AB=E3=82=BF=E6=8C=87=E5=AE=9A=E8=AA=A4=E3=82=8A?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/commands/iaas/autobackup/update.go | 2 +- pkg/commands/iaas/autoscale/update.go | 2 +- pkg/commands/iaas/database/update.go | 2 +- pkg/commands/iaas/proxylb/update.go | 2 +- pkg/commands/iaas/server/update.go | 6 +++--- pkg/commands/iaas/server/zz_update_gen.go | 4 ++-- pkg/commands/iaas/simplemonitor/update.go | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/commands/iaas/autobackup/update.go b/pkg/commands/iaas/autobackup/update.go index f5362788f..e856a7fed 100644 --- a/pkg/commands/iaas/autobackup/update.go +++ b/pkg/commands/iaas/autobackup/update.go @@ -47,7 +47,7 @@ type updateParameter struct { cflag.TagsUpdateParameter `cli:",squash" mapconv:",omitempty,squash"` cflag.IconIDUpdateParameter `cli:",squash" mapconv:",omitempty,squash"` - Weekdays *[]string `cli:",options=weekdays" mapconv:"BackupSpanWeekdays,omitempty,filters=weekdays" validate:"omitempty,weekdays"` + Weekdays *[]string `cli:",options=weekdays" mapconv:"BackupSpanWeekdays,omitempty,filters=dereference weekdays" validate:"omitempty,weekdays"` MaxNumOfArchives *int `cli:"max-backup-num" mapconv:"MaximumNumberOfArchives" validate:"omitempty,min=1,max=10"` } diff --git a/pkg/commands/iaas/autoscale/update.go b/pkg/commands/iaas/autoscale/update.go index ccdb172d7..ac07a2306 100644 --- a/pkg/commands/iaas/autoscale/update.go +++ b/pkg/commands/iaas/autoscale/update.go @@ -48,7 +48,7 @@ type updateParameter struct { cflag.IconIDUpdateParameter `cli:",squash" mapconv:",omitempty,squash"` Zones *[]string `validate:"omitempty,required"` - Config *string `validate:"omitempty,required" mapconv:",omitempty,filters=path_or_content"` + Config *string `validate:"omitempty,required" mapconv:",omitempty,filters=dereference path_or_content"` Disabled bool TriggerType *string `cli:"trigger-type,options=cpu router schedule" validate:"omitempty,oneof=cpu router schedule" mapconv:",omitempty"` diff --git a/pkg/commands/iaas/database/update.go b/pkg/commands/iaas/database/update.go index d3c589fe3..9b6c96b3f 100644 --- a/pkg/commands/iaas/database/update.go +++ b/pkg/commands/iaas/database/update.go @@ -59,7 +59,7 @@ type updateParameter struct { ReplicaUserPassword *string `cli:",category=replication,order=20,desc=(*required when --enable-replication is specified)" validate:"omitempty,required_with=EnableReplication"` EnableWebUI *bool `cli:",category=WebUI"` EnableBackup *bool `cli:",category=backup,order=10"` - BackupWeekdays *[]string `cli:",options=weekdays,category=backup,order=20" mapconv:",omitempty,filters=weekdays" validate:"omitempty,max=7,weekdays"` + BackupWeekdays *[]string `cli:",options=weekdays,category=backup,order=20" mapconv:",omitempty,filters=dereference weekdays" validate:"omitempty,max=7,weekdays"` BackupStartTimeHour *int `cli:",category=backup,order=30" mapconv:",omitempty" validate:"omitempty,min=0,max=23"` BackupStartTimeMinute *int `cli:",category=backup,order=40" mapconv:",omitempty" validate:"omitempty,oneof=0 15 30 45"` diff --git a/pkg/commands/iaas/proxylb/update.go b/pkg/commands/iaas/proxylb/update.go index 74ab394ef..2713302e1 100644 --- a/pkg/commands/iaas/proxylb/update.go +++ b/pkg/commands/iaas/proxylb/update.go @@ -53,7 +53,7 @@ type updateParameter struct { cflag.TagsUpdateParameter `cli:",squash" mapconv:",omitempty,squash"` cflag.IconIDUpdateParameter `cli:",squash" mapconv:",omitempty,squash"` - Plan *string `cli:",options=proxylb_plan" mapconv:",omitempty,filters=proxylb_plan_to_value" validate:"omitempty,proxylb_plan"` + Plan *string `cli:",options=proxylb_plan" mapconv:",omitempty,filters=dereference proxylb_plan_to_value" validate:"omitempty,proxylb_plan"` HealthCheck updateParameterHealthCheck `mapconv:",omitempty"` SorryServer updateParameterSorryServer `mapconv:",omitempty"` diff --git a/pkg/commands/iaas/server/update.go b/pkg/commands/iaas/server/update.go index 5bb73450b..a418dfbac 100644 --- a/pkg/commands/iaas/server/update.go +++ b/pkg/commands/iaas/server/update.go @@ -56,10 +56,10 @@ type updateParameter struct { Memory *int `cli:"memory,category=plan,order=20" mapconv:"MemoryGB"` GPU *int `cli:"gpu,category=plan,order=30"` CPUModel *string `cli:"cpu-model,category=plan,order=40"` - Commitment *string `cli:",options=server_plan_commitment,category=plan,order=50" mapconv:",omitempty,filters=server_plan_commitment_to_value" validate:"omitempty,server_plan_commitment"` - Generation *string `cli:",options=server_plan_generation,category=plan,order=60" mapconv:",omitempty,filters=server_plan_generation_to_value" validate:"omitempty,server_plan_generation"` + Commitment *string `cli:",options=server_plan_commitment,category=plan,order=50" mapconv:",omitempty,filters=dereference server_plan_commitment_to_value" validate:"omitempty,server_plan_commitment"` + Generation *string `cli:",options=server_plan_generation,category=plan,order=60" mapconv:",omitempty,filters=dereference server_plan_generation_to_value" validate:"omitempty,server_plan_generation"` - InterfaceDriver *string `cli:",options=interface_dirver" mapconv:",omitempty,filters=interface_driver_to_value" validate:"omitempty,interface_driver"` + InterfaceDriver *string `cli:",options=interface_driver" mapconv:",omitempty,filters=dereference interface_driver_to_value" validate:"omitempty,interface_driver"` CDROMID *types.ID `cli:"cdrom-id,aliases=iso-image-id"` PrivateHostID *types.ID diff --git a/pkg/commands/iaas/server/zz_update_gen.go b/pkg/commands/iaas/server/zz_update_gen.go index 924d64975..0ecd450bd 100644 --- a/pkg/commands/iaas/server/zz_update_gen.go +++ b/pkg/commands/iaas/server/zz_update_gen.go @@ -130,7 +130,7 @@ func (p *updateParameter) buildFlags(fs *pflag.FlagSet) { fs.StringVarP(p.CPUModel, "cpu-model", "", "", "") fs.StringVarP(p.Commitment, "commitment", "", "", "options: [standard/dedicatedcpu]") fs.StringVarP(p.Generation, "generation", "", "", "options: [default/g100/g200]") - fs.StringVarP(p.InterfaceDriver, "interface-driver", "", "", "options: [interface_dirver]") + fs.StringVarP(p.InterfaceDriver, "interface-driver", "", "", "options: [virtio/e1000]") fs.VarP(core.NewIDFlag(p.CDROMID, p.CDROMID), "cdrom-id", "", "(aliases: --iso-image-id)") fs.VarP(core.NewIDFlag(p.PrivateHostID, p.PrivateHostID), "private-host-id", "", "") fs.StringVarP(&p.NetworkInterfaceData, "network-interfaces", "", p.NetworkInterfaceData, "") @@ -264,7 +264,7 @@ func (p *updateParameter) buildFlagsUsage(cmd *cobra.Command) { func (p *updateParameter) setCompletionFunc(cmd *cobra.Command) { cmd.RegisterFlagCompletionFunc("commitment", util.FlagCompletionFunc("standard", "dedicatedcpu")) cmd.RegisterFlagCompletionFunc("generation", util.FlagCompletionFunc("default", "g100", "g200")) - cmd.RegisterFlagCompletionFunc("interface-driver", util.FlagCompletionFunc("interface_dirver")) + cmd.RegisterFlagCompletionFunc("interface-driver", util.FlagCompletionFunc("virtio", "e1000")) } diff --git a/pkg/commands/iaas/simplemonitor/update.go b/pkg/commands/iaas/simplemonitor/update.go index 8404482a3..83e2b9090 100644 --- a/pkg/commands/iaas/simplemonitor/update.go +++ b/pkg/commands/iaas/simplemonitor/update.go @@ -62,7 +62,7 @@ type updateParameter struct { } type updateParameterHealthCheck struct { - Protocol *string `cli:",options=simple_monitor_protocol" mapconv:",omitempty,filters=simple_monitor_protocol_to_value" validate:"omitempty,simple_monitor_protocol" json:",omitempty"` + Protocol *string `cli:",options=simple_monitor_protocol" mapconv:",omitempty,filters=dereference simple_monitor_protocol_to_value" validate:"omitempty,simple_monitor_protocol" json:",omitempty"` Port *int `json:",omitempty"` Path *string `json:",omitempty"` Status *int `json:",omitempty"` @@ -78,7 +78,7 @@ type updateParameterHealthCheck struct { OID *string `json:",omitempty"` RemainingDays *int `json:",omitempty"` HTTP2 *bool `cli:"http2" json:",omitempty"` - FTPS *string `cli:",options=simple_monitor_ftps" mapconv:",omitempty,filters=simple_monitor_ftps_to_value" validate:"omitempty,simple_monitor_ftps" json:",omitempty"` + FTPS *string `cli:",options=simple_monitor_ftps" mapconv:",omitempty,filters=dereference simple_monitor_ftps_to_value" validate:"omitempty,simple_monitor_ftps" json:",omitempty"` VerifySNI *bool `cli:"verify-sni" json:",omitempty"` }