parent
b7c2f2d7ed
commit
930508be60
|
@ -121,6 +121,10 @@ func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Facto
|
||||||
return errors.New("--backup-sync-period must be non-negative")
|
return errors.New("--backup-sync-period must be non-negative")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(o.Credential.Data()) > 1 {
|
||||||
|
return errors.New("--credential can only contain 1 key/value pair")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +156,6 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
|
||||||
validationFrequency = &metav1.Duration{Duration: o.ValidationFrequency}
|
validationFrequency = &metav1.Duration{Duration: o.ValidationFrequency}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(o.Credential.Data()) > 1 {
|
|
||||||
return errors.New("--credential can only contain 1 key/value pair")
|
|
||||||
}
|
|
||||||
var secretName, secretKey string
|
var secretName, secretKey string
|
||||||
for k, v := range o.Credential.Data() {
|
for k, v := range o.Credential.Data() {
|
||||||
secretName = k
|
secretName = k
|
||||||
|
|
|
@ -44,6 +44,7 @@ func NewSetCommand(f client.Factory, use string) *cobra.Command {
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
Run: func(c *cobra.Command, args []string) {
|
Run: func(c *cobra.Command, args []string) {
|
||||||
cmd.CheckError(o.Complete(args, f))
|
cmd.CheckError(o.Complete(args, f))
|
||||||
|
cmd.CheckError(o.Validate(c, args, f))
|
||||||
cmd.CheckError(o.Run(c, f))
|
cmd.CheckError(o.Run(c, f))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -72,6 +73,14 @@ func (o *SetOptions) BindFlags(flags *pflag.FlagSet) {
|
||||||
flags.BoolVar(&o.DefaultBackupStorageLocation, "default", o.DefaultBackupStorageLocation, "Sets this new location to be the new default backup storage location. Optional.")
|
flags.BoolVar(&o.DefaultBackupStorageLocation, "default", o.DefaultBackupStorageLocation, "Sets this new location to be the new default backup storage location. Optional.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *SetOptions) Validate(c *cobra.Command, args []string, f client.Factory) error {
|
||||||
|
if len(o.Credential.Data()) > 1 {
|
||||||
|
return errors.New("--credential can only contain 1 key/value pair")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (o *SetOptions) Complete(args []string, f client.Factory) error {
|
func (o *SetOptions) Complete(args []string, f client.Factory) error {
|
||||||
o.Name = args[0]
|
o.Name = args[0]
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue