github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/models/partial_drive.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  	strfmt "github.com/go-openapi/strfmt"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/swag"
    13  	"github.com/go-openapi/validate"
    14  )
    15  
    16  // PartialDrive partial drive
    17  // swagger:model PartialDrive
    18  type PartialDrive struct {
    19  
    20  	// drive id
    21  	// Required: true
    22  	DriveID *string `json:"drive_id"`
    23  
    24  	// Host level path for the guest drive
    25  	// Required: true
    26  	PathOnHost *string `json:"path_on_host"`
    27  }
    28  
    29  // Validate validates this partial drive
    30  func (m *PartialDrive) Validate(formats strfmt.Registry) error {
    31  	var res []error
    32  
    33  	if err := m.validateDriveID(formats); err != nil {
    34  		res = append(res, err)
    35  	}
    36  
    37  	if err := m.validatePathOnHost(formats); err != nil {
    38  		res = append(res, err)
    39  	}
    40  
    41  	if len(res) > 0 {
    42  		return errors.CompositeValidationError(res...)
    43  	}
    44  	return nil
    45  }
    46  
    47  func (m *PartialDrive) validateDriveID(formats strfmt.Registry) error {
    48  
    49  	if err := validate.Required("drive_id", "body", m.DriveID); err != nil {
    50  		return err
    51  	}
    52  
    53  	return nil
    54  }
    55  
    56  func (m *PartialDrive) validatePathOnHost(formats strfmt.Registry) error {
    57  
    58  	if err := validate.Required("path_on_host", "body", m.PathOnHost); err != nil {
    59  		return err
    60  	}
    61  
    62  	return nil
    63  }
    64  
    65  // MarshalBinary interface implementation
    66  func (m *PartialDrive) MarshalBinary() ([]byte, error) {
    67  	if m == nil {
    68  		return nil, nil
    69  	}
    70  	return swag.WriteJSON(m)
    71  }
    72  
    73  // UnmarshalBinary interface implementation
    74  func (m *PartialDrive) UnmarshalBinary(b []byte) error {
    75  	var res PartialDrive
    76  	if err := swag.ReadJSON(b, &res); err != nil {
    77  		return err
    78  	}
    79  	*m = res
    80  	return nil
    81  }