MCPcopy
hub / github.com/cloudfoundry/cli / ValidateFlags

Method ValidateFlags

command/v7/restage_command.go:122–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

ExecuteMethod · 0.95

Calls 3

MinimumCCAPIVersionCheckFunction · 0.92
validateInstanceStepsFunction · 0.85
APIVersionMethod · 0.65

Tested by

no test coverage detected