github.com/percona/percona-xtradb-cluster-operator@v1.14.0/version/client/models/version_version.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package models
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/go-openapi/swag"
    14  )
    15  
    16  // VersionVersion Version represents product version information.
    17  //
    18  // swagger:model versionVersion
    19  type VersionVersion struct {
    20  
    21  	// critical
    22  	Critical bool `json:"critical,omitempty"`
    23  
    24  	// image hash
    25  	ImageHash string `json:"imageHash,omitempty"`
    26  
    27  	// image path
    28  	ImagePath string `json:"imagePath,omitempty"`
    29  
    30  	// status
    31  	Status *VersionStatus `json:"status,omitempty"`
    32  }
    33  
    34  // Validate validates this version version
    35  func (m *VersionVersion) Validate(formats strfmt.Registry) error {
    36  	var res []error
    37  
    38  	if err := m.validateStatus(formats); err != nil {
    39  		res = append(res, err)
    40  	}
    41  
    42  	if len(res) > 0 {
    43  		return errors.CompositeValidationError(res...)
    44  	}
    45  	return nil
    46  }
    47  
    48  func (m *VersionVersion) validateStatus(formats strfmt.Registry) error {
    49  	if swag.IsZero(m.Status) { // not required
    50  		return nil
    51  	}
    52  
    53  	if m.Status != nil {
    54  		if err := m.Status.Validate(formats); err != nil {
    55  			if ve, ok := err.(*errors.Validation); ok {
    56  				return ve.ValidateName("status")
    57  			} else if ce, ok := err.(*errors.CompositeError); ok {
    58  				return ce.ValidateName("status")
    59  			}
    60  			return err
    61  		}
    62  	}
    63  
    64  	return nil
    65  }
    66  
    67  // ContextValidate validate this version version based on the context it is used
    68  func (m *VersionVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    69  	var res []error
    70  
    71  	if err := m.contextValidateStatus(ctx, formats); err != nil {
    72  		res = append(res, err)
    73  	}
    74  
    75  	if len(res) > 0 {
    76  		return errors.CompositeValidationError(res...)
    77  	}
    78  	return nil
    79  }
    80  
    81  func (m *VersionVersion) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error {
    82  
    83  	if m.Status != nil {
    84  		if err := m.Status.ContextValidate(ctx, formats); err != nil {
    85  			if ve, ok := err.(*errors.Validation); ok {
    86  				return ve.ValidateName("status")
    87  			} else if ce, ok := err.(*errors.CompositeError); ok {
    88  				return ce.ValidateName("status")
    89  			}
    90  			return err
    91  		}
    92  	}
    93  
    94  	return nil
    95  }
    96  
    97  // MarshalBinary interface implementation
    98  func (m *VersionVersion) MarshalBinary() ([]byte, error) {
    99  	if m == nil {
   100  		return nil, nil
   101  	}
   102  	return swag.WriteJSON(m)
   103  }
   104  
   105  // UnmarshalBinary interface implementation
   106  func (m *VersionVersion) UnmarshalBinary(b []byte) error {
   107  	var res VersionVersion
   108  	if err := swag.ReadJSON(b, &res); err != nil {
   109  		return err
   110  	}
   111  	*m = res
   112  	return nil
   113  }