...

Source file src/github.com/redhat-developer/odo/pkg/apiserver-gen/go/model_image.go

Documentation: github.com/redhat-developer/odo/pkg/apiserver-gen/go

     1  /*
     2   * odo dev
     3   *
     4   * API interface for 'odo dev'
     5   *
     6   * API version: 0.1
     7   * Generated by: OpenAPI Generator (https://openapi-generator.tech)
     8   */
     9  
    10  package openapi
    11  
    12  type Image struct {
    13  	Name string `json:"name"`
    14  
    15  	ImageName string `json:"imageName"`
    16  
    17  	Args []string `json:"args"`
    18  
    19  	BuildContext string `json:"buildContext"`
    20  
    21  	RootRequired bool `json:"rootRequired"`
    22  
    23  	Uri string `json:"uri"`
    24  
    25  	AutoBuild string `json:"autoBuild"`
    26  
    27  	// true if the image is not referenced in any command
    28  	Orphan bool `json:"orphan"`
    29  }
    30  
    31  // AssertImageRequired checks if the required fields are not zero-ed
    32  func AssertImageRequired(obj Image) error {
    33  	elements := map[string]interface{}{
    34  		"name":         obj.Name,
    35  		"imageName":    obj.ImageName,
    36  		"args":         obj.Args,
    37  		"buildContext": obj.BuildContext,
    38  		"rootRequired": obj.RootRequired,
    39  		"uri":          obj.Uri,
    40  		"autoBuild":    obj.AutoBuild,
    41  		"orphan":       obj.Orphan,
    42  	}
    43  	for name, el := range elements {
    44  		if isZero := IsZeroValue(el); isZero {
    45  			return &RequiredError{Field: name}
    46  		}
    47  	}
    48  
    49  	return nil
    50  }
    51  
    52  // AssertRecurseImageRequired recursively checks if required fields are not zero-ed in a nested slice.
    53  // Accepts only nested slice of Image (e.g. [][]Image), otherwise ErrTypeAssertionError is thrown.
    54  func AssertRecurseImageRequired(objSlice interface{}) error {
    55  	return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
    56  		aImage, ok := obj.(Image)
    57  		if !ok {
    58  			return ErrTypeAssertionError
    59  		}
    60  		return AssertImageRequired(aImage)
    61  	})
    62  }
    63  

View as plain text