mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* API returns more info about container * Display more info about containers * Update UI static files * Fix unit tests * Get/Set sources configuration * [ui] create container with sources mount configuration * e2e tests + ui static files * Set containers's envvars * Regenerate UI static files * Add Annotation to POST /container * [api] Create Container with Annotations * [ui] Annotations when creating container * Regenerate UI static files * [api] Endpoints when adding container * [ui] Endpoints when adding container * Regenerate UI static files
101 lines
2.5 KiB
Go
Generated
101 lines
2.5 KiB
Go
Generated
/*
|
|
* odo dev
|
|
*
|
|
* API interface for 'odo dev'
|
|
*
|
|
* API version: 0.1
|
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
*/
|
|
|
|
package openapi
|
|
|
|
type Container struct {
|
|
Name string `json:"name"`
|
|
|
|
Image string `json:"image"`
|
|
|
|
Command []string `json:"command"`
|
|
|
|
Args []string `json:"args"`
|
|
|
|
MemoryRequest string `json:"memoryRequest"`
|
|
|
|
MemoryLimit string `json:"memoryLimit"`
|
|
|
|
CpuRequest string `json:"cpuRequest"`
|
|
|
|
CpuLimit string `json:"cpuLimit"`
|
|
|
|
VolumeMounts []VolumeMount `json:"volumeMounts"`
|
|
|
|
Annotation Annotation `json:"annotation"`
|
|
|
|
Endpoints []Endpoint `json:"endpoints"`
|
|
|
|
Env []Env `json:"env"`
|
|
|
|
ConfigureSources bool `json:"configureSources"`
|
|
|
|
MountSources bool `json:"mountSources"`
|
|
|
|
SourceMapping string `json:"sourceMapping"`
|
|
}
|
|
|
|
// AssertContainerRequired checks if the required fields are not zero-ed
|
|
func AssertContainerRequired(obj Container) error {
|
|
elements := map[string]interface{}{
|
|
"name": obj.Name,
|
|
"image": obj.Image,
|
|
"command": obj.Command,
|
|
"args": obj.Args,
|
|
"memoryRequest": obj.MemoryRequest,
|
|
"memoryLimit": obj.MemoryLimit,
|
|
"cpuRequest": obj.CpuRequest,
|
|
"cpuLimit": obj.CpuLimit,
|
|
"volumeMounts": obj.VolumeMounts,
|
|
"annotation": obj.Annotation,
|
|
"endpoints": obj.Endpoints,
|
|
"env": obj.Env,
|
|
"configureSources": obj.ConfigureSources,
|
|
"mountSources": obj.MountSources,
|
|
"sourceMapping": obj.SourceMapping,
|
|
}
|
|
for name, el := range elements {
|
|
if isZero := IsZeroValue(el); isZero {
|
|
return &RequiredError{Field: name}
|
|
}
|
|
}
|
|
|
|
for _, el := range obj.VolumeMounts {
|
|
if err := AssertVolumeMountRequired(el); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
if err := AssertAnnotationRequired(obj.Annotation); err != nil {
|
|
return err
|
|
}
|
|
for _, el := range obj.Endpoints {
|
|
if err := AssertEndpointRequired(el); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
for _, el := range obj.Env {
|
|
if err := AssertEnvRequired(el); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// AssertRecurseContainerRequired recursively checks if required fields are not zero-ed in a nested slice.
|
|
// Accepts only nested slice of Container (e.g. [][]Container), otherwise ErrTypeAssertionError is thrown.
|
|
func AssertRecurseContainerRequired(objSlice interface{}) error {
|
|
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
|
aContainer, ok := obj.(Container)
|
|
if !ok {
|
|
return ErrTypeAssertionError
|
|
}
|
|
return AssertContainerRequired(aContainer)
|
|
})
|
|
}
|