...

Source file src/github.com/redhat-developer/odo/pkg/apiserver-gen/go/model_endpoint.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 Endpoint struct {
    13  	Name string `json:"name"`
    14  
    15  	Exposure string `json:"exposure,omitempty"`
    16  
    17  	Path string `json:"path,omitempty"`
    18  
    19  	Protocol string `json:"protocol,omitempty"`
    20  
    21  	Secure bool `json:"secure,omitempty"`
    22  
    23  	TargetPort int32 `json:"targetPort"`
    24  }
    25  
    26  // AssertEndpointRequired checks if the required fields are not zero-ed
    27  func AssertEndpointRequired(obj Endpoint) error {
    28  	elements := map[string]interface{}{
    29  		"name":       obj.Name,
    30  		"targetPort": obj.TargetPort,
    31  	}
    32  	for name, el := range elements {
    33  		if isZero := IsZeroValue(el); isZero {
    34  			return &RequiredError{Field: name}
    35  		}
    36  	}
    37  
    38  	return nil
    39  }
    40  
    41  // AssertRecurseEndpointRequired recursively checks if required fields are not zero-ed in a nested slice.
    42  // Accepts only nested slice of Endpoint (e.g. [][]Endpoint), otherwise ErrTypeAssertionError is thrown.
    43  func AssertRecurseEndpointRequired(objSlice interface{}) error {
    44  	return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
    45  		aEndpoint, ok := obj.(Endpoint)
    46  		if !ok {
    47  			return ErrTypeAssertionError
    48  		}
    49  		return AssertEndpointRequired(aEndpoint)
    50  	})
    51  }
    52  

View as plain text