cloudapi: Create a compose using the blueprint data

If the request includes a blueprint (and not customizations) it uses
that blueprint for the compose.
This commit is contained in:
Brian C. Lane 2023-10-18 16:25:37 -07:00 committed by Sanne Raymaekers
parent 5b87877109
commit 7438e29375
4 changed files with 504 additions and 13 deletions

View file

@ -160,8 +160,14 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
return HTTPError(ErrorUnsupportedDistribution)
}
// Create a blueprint from the customizations included in the request
bp, err := request.GetBlueprintWithCustomizations()
// OpenAPI enforces blueprint or customization, not both
// but check anyway
if request.Customizations != nil && request.Blueprint != nil {
return HTTPError(ErrorBlueprintOrCustomNotBoth)
}
// Create a blueprint from the request
bp, err := request.GetBlueprint()
if err != nil {
return err
}