mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* [api/devstate] Add volumes to Devfile content * Add Volume related endpoints to API * Create/Delete volumes from the Volumes Tab * Update UI static files * API Devstate returns VolumeMounts * Display volume mounts in containers * [api] Add VolumeMounts to containers * [ui] Define container's volume mounts * [ui] e2e tests * Update UI static files * [ui] create volumes from container / exec command creation * Update UI static files * Update container display * Update UI static files * Regenerate UI static files
70 lines
1.7 KiB
Go
Generated
70 lines
1.7 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"`
|
|
}
|
|
|
|
// 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,
|
|
}
|
|
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
|
|
}
|
|
}
|
|
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)
|
|
})
|
|
}
|