Files
odo/pkg/apiserver-gen/go/model_resource.go
Philippe Martin e9dbded83b [ui] Set AutoBuild and DeployByDefault (#7051)
* Get and display autoBuild / deployByDefault

* Set autoBuild / deployByDefault

* Update ui static files

* [api] Add orpahn field to Image/Resource

* Display more info about Build / Deploy at startup

* Update ui static files

* e2e tests

* Update ui static files

* Fix unit tests

* 3-states button for AutoBuild

* 3-states button for DeployByDefault

* static ui files
2023-09-01 10:18:49 +02:00

52 lines
1.3 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 Resource struct {
Name string `json:"name"`
Inlined string `json:"inlined,omitempty"`
Uri string `json:"uri,omitempty"`
DeployByDefault string `json:"deployByDefault"`
// true if the resource is not referenced in any command
Orphan bool `json:"orphan"`
}
// AssertResourceRequired checks if the required fields are not zero-ed
func AssertResourceRequired(obj Resource) error {
elements := map[string]interface{}{
"name": obj.Name,
"deployByDefault": obj.DeployByDefault,
"orphan": obj.Orphan,
}
for name, el := range elements {
if isZero := IsZeroValue(el); isZero {
return &RequiredError{Field: name}
}
}
return nil
}
// AssertRecurseResourceRequired recursively checks if required fields are not zero-ed in a nested slice.
// Accepts only nested slice of Resource (e.g. [][]Resource), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseResourceRequired(objSlice interface{}) error {
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
aResource, ok := obj.(Resource)
if !ok {
return ErrTypeAssertionError
}
return AssertResourceRequired(aResource)
})
}