build derives the estimation and tracking options. A cost.ModelOption serves both, so the two lists hold the same options.
()
| 213 | // build derives the estimation and tracking options. A cost.ModelOption serves both, so the two |
| 214 | // lists hold the same options. |
| 215 | func (c *costConfig) build() costModelOptions { |
| 216 | var opts []cost.ModelOption |
| 217 | if len(c.models) > 0 { |
| 218 | opts = append(opts, cost.Model(c.models...)) |
| 219 | } |
| 220 | if c.strategy != nil { |
| 221 | opts = append(opts, cost.WithSizingStrategy(c.strategy)) |
| 222 | } |
| 223 | if c.version != nil { |
| 224 | opts = append(opts, cost.ModelVersion(*c.version)) |
| 225 | } |
| 226 | built := costModelOptions{ |
| 227 | estimate: make([]cost.Option, len(opts)), |
| 228 | tracker: make([]cost.TrackerOption, len(opts)), |
| 229 | } |
| 230 | for i, opt := range opts { |
| 231 | built.estimate[i] = opt |
| 232 | built.tracker[i] = opt |
| 233 | } |
| 234 | return built |
| 235 | } |
| 236 | |
| 237 | // costModelOptions are the options which apply the environment's cost models, sizing strategy, and |
| 238 | // revision to estimation and tracking. They precede the caller's options so the caller may |
no test coverage detected