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

Method ValidateFlags

command/v7/restart_command.go:125–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

123}
124
125func (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}

Callers 1

ExecuteMethod · 0.95

Calls 3

MinimumCCAPIVersionCheckFunction · 0.92
validateInstanceStepsFunction · 0.85
APIVersionMethod · 0.65

Tested by

no test coverage detected