debian-forge-composer/internal/osbuild/containers_input.go
Achilleas Koutsou ad2a5bff7c osbuild: name in containers input is not optional
Remove the `omitempty` from the name field in the containers input.  It is
required.
2023-04-17 18:30:41 +02:00

46 lines
1 KiB
Go

package osbuild
import (
"github.com/osbuild/osbuild-composer/internal/container"
)
type ContainersInputReferences interface {
isContainersInputReferences()
}
type ContainersInputSourceRef struct {
Name string `json:"name"`
}
type ContainersInputSourceMap map[string]ContainersInputSourceRef
func (ContainersInputSourceMap) isContainersInputReferences() {}
type ContainersInput struct {
inputCommon
References ContainersInputReferences `json:"references"`
}
const InputTypeContainers string = "org.osbuild.containers"
func NewContainersInputForSources(containers []container.Spec) ContainersInput {
refs := make(ContainersInputSourceMap, len(containers))
for _, c := range containers {
ref := ContainersInputSourceRef{
Name: c.LocalName,
}
refs[c.ImageID] = ref
}
return ContainersInput{
References: refs,
inputCommon: inputCommon{
Type: InputTypeContainers,
Origin: InputOriginSource,
},
}
}
type ContainersInputs map[string]ContainersInput
func (c ContainersInputs) isStageInputs() {}