()
| 123 | } |
| 124 | |
| 125 | func (cmd RestartCommand) ValidateFlags() error { |
| 126 | switch true { |
| 127 | case cmd.Strategy.Name == constant.DeploymentStrategyDefault && cmd.MaxInFlight != nil: |
| 128 | return translatableerror.RequiredFlagsError{Arg1: "--max-in-flight", Arg2: "--strategy"} |
| 129 | case cmd.Strategy.Name != constant.DeploymentStrategyDefault && cmd.MaxInFlight != nil && *cmd.MaxInFlight < 1: |
| 130 | return translatableerror.IncorrectUsageError{Message: "--max-in-flight must be greater than or equal to 1"} |
| 131 | case cmd.Strategy.Name != constant.DeploymentStrategyCanary && cmd.InstanceSteps != "": |
| 132 | return translatableerror.RequiredFlagsError{Arg1: "--instance-steps", Arg2: "--strategy=canary"} |
| 133 | case len(cmd.InstanceSteps) > 0 && !validateInstanceSteps(cmd.InstanceSteps): |
| 134 | return translatableerror.ParseArgumentError{ArgumentName: "--instance-steps", ExpectedType: "list of weights"} |
| 135 | } |
| 136 | |
| 137 | if len(cmd.InstanceSteps) > 0 { |
| 138 | return command.MinimumCCAPIVersionCheck(cmd.Config.APIVersion(), ccversion.MinVersionCanarySteps, "--instance-steps") |
| 139 | } |
| 140 | |
| 141 | return nil |
| 142 | } |
no test coverage detected