github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/inventory/inventory_models/dependency_condition.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package inventory_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  // DependencyCondition Dependency Condition
    17  //
    18  // swagger:model dependencyCondition
    19  type DependencyCondition struct {
    20  	Condition
    21  
    22  	DependencyConditionAllOf1
    23  }
    24  
    25  // UnmarshalJSON unmarshals this object from a JSON structure
    26  func (m *DependencyCondition) UnmarshalJSON(raw []byte) error {
    27  	// AO0
    28  	var aO0 Condition
    29  	if err := swag.ReadJSON(raw, &aO0); err != nil {
    30  		return err
    31  	}
    32  	m.Condition = aO0
    33  
    34  	// AO1
    35  	var aO1 DependencyConditionAllOf1
    36  	if err := swag.ReadJSON(raw, &aO1); err != nil {
    37  		return err
    38  	}
    39  	m.DependencyConditionAllOf1 = aO1
    40  
    41  	return nil
    42  }
    43  
    44  // MarshalJSON marshals this object to a JSON structure
    45  func (m DependencyCondition) MarshalJSON() ([]byte, error) {
    46  	_parts := make([][]byte, 0, 2)
    47  
    48  	aO0, err := swag.WriteJSON(m.Condition)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	_parts = append(_parts, aO0)
    53  
    54  	aO1, err := swag.WriteJSON(m.DependencyConditionAllOf1)
    55  	if err != nil {
    56  		return nil, err
    57  	}
    58  	_parts = append(_parts, aO1)
    59  	return swag.ConcatJSON(_parts...), nil
    60  }
    61  
    62  // Validate validates this dependency condition
    63  func (m *DependencyCondition) Validate(formats strfmt.Registry) error {
    64  	var res []error
    65  
    66  	// validation for a type composition with Condition
    67  	if err := m.Condition.Validate(formats); err != nil {
    68  		res = append(res, err)
    69  	}
    70  	// validation for a type composition with DependencyConditionAllOf1
    71  	if err := m.DependencyConditionAllOf1.Validate(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  // ContextValidate validate this dependency condition based on the context it is used
    82  func (m *DependencyCondition) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    83  	var res []error
    84  
    85  	// validation for a type composition with Condition
    86  	if err := m.Condition.ContextValidate(ctx, formats); err != nil {
    87  		res = append(res, err)
    88  	}
    89  	// validation for a type composition with DependencyConditionAllOf1
    90  	if err := m.DependencyConditionAllOf1.ContextValidate(ctx, formats); err != nil {
    91  		res = append(res, err)
    92  	}
    93  
    94  	if len(res) > 0 {
    95  		return errors.CompositeValidationError(res...)
    96  	}
    97  	return nil
    98  }
    99  
   100  // MarshalBinary interface implementation
   101  func (m *DependencyCondition) MarshalBinary() ([]byte, error) {
   102  	if m == nil {
   103  		return nil, nil
   104  	}
   105  	return swag.WriteJSON(m)
   106  }
   107  
   108  // UnmarshalBinary interface implementation
   109  func (m *DependencyCondition) UnmarshalBinary(b []byte) error {
   110  	var res DependencyCondition
   111  	if err := swag.ReadJSON(b, &res); err != nil {
   112  		return err
   113  	}
   114  	*m = res
   115  	return nil
   116  }