()
| 1233 | } |
| 1234 | |
| 1235 | func (b *Builder) getPresetParameterValues() ([]database.TemplateVersionPresetParameter, error) { |
| 1236 | if b.templateVersionPresetParameterValues != nil { |
| 1237 | return *b.templateVersionPresetParameterValues, nil |
| 1238 | } |
| 1239 | |
| 1240 | if b.templateVersionPresetID == uuid.Nil { |
| 1241 | return []database.TemplateVersionPresetParameter{}, nil |
| 1242 | } |
| 1243 | |
| 1244 | // Fetch and cache these, since we'll need them to override requested values if a preset was chosen |
| 1245 | presetParameters, err := b.store.GetPresetParametersByPresetID(b.ctx, b.templateVersionPresetID) |
| 1246 | if err != nil { |
| 1247 | return nil, xerrors.Errorf("failed to get preset parameters: %w", err) |
| 1248 | } |
| 1249 | b.templateVersionPresetParameterValues = ptr.Ref(presetParameters) |
| 1250 | return *b.templateVersionPresetParameterValues, nil |
| 1251 | } |
| 1252 | |
| 1253 | // authorize performs build authorization pre-checks using the provided authFunc |
| 1254 | func (b *Builder) authorize(authFunc func(action policy.Action, object rbac.Objecter) bool) error { |
no test coverage detected