bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/pkg/models/watcher_registration_request.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  	"github.com/go-openapi/errors"
    10  	"github.com/go-openapi/strfmt"
    11  	"github.com/go-openapi/swag"
    12  	"github.com/go-openapi/validate"
    13  )
    14  
    15  // WatcherRegistrationRequest WatcherRegistrationRequest
    16  //
    17  // swagger:model WatcherRegistrationRequest
    18  type WatcherRegistrationRequest struct {
    19  
    20  	// machine id
    21  	// Required: true
    22  	MachineID *string `json:"machine_id"`
    23  
    24  	// password
    25  	// Required: true
    26  	// Format: password
    27  	Password *strfmt.Password `json:"password"`
    28  }
    29  
    30  // Validate validates this watcher registration request
    31  func (m *WatcherRegistrationRequest) Validate(formats strfmt.Registry) error {
    32  	var res []error
    33  
    34  	if err := m.validateMachineID(formats); err != nil {
    35  		res = append(res, err)
    36  	}
    37  
    38  	if err := m.validatePassword(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 *WatcherRegistrationRequest) validateMachineID(formats strfmt.Registry) error {
    49  
    50  	if err := validate.Required("machine_id", "body", m.MachineID); err != nil {
    51  		return err
    52  	}
    53  
    54  	return nil
    55  }
    56  
    57  func (m *WatcherRegistrationRequest) validatePassword(formats strfmt.Registry) error {
    58  
    59  	if err := validate.Required("password", "body", m.Password); err != nil {
    60  		return err
    61  	}
    62  
    63  	if err := validate.FormatOf("password", "body", "password", m.Password.String(), formats); err != nil {
    64  		return err
    65  	}
    66  
    67  	return nil
    68  }
    69  
    70  // MarshalBinary interface implementation
    71  func (m *WatcherRegistrationRequest) MarshalBinary() ([]byte, error) {
    72  	if m == nil {
    73  		return nil, nil
    74  	}
    75  	return swag.WriteJSON(m)
    76  }
    77  
    78  // UnmarshalBinary interface implementation
    79  func (m *WatcherRegistrationRequest) UnmarshalBinary(b []byte) error {
    80  	var res WatcherRegistrationRequest
    81  	if err := swag.ReadJSON(b, &res); err != nil {
    82  		return err
    83  	}
    84  	*m = res
    85  	return nil
    86  }