bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/pkg/models/watcher_auth_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 // WatcherAuthRequest WatcherAuthRequest 16 // 17 // swagger:model WatcherAuthRequest 18 type WatcherAuthRequest 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 // the list of scenarios enabled on the watcher 30 Scenarios []string `json:"scenarios"` 31 } 32 33 // Validate validates this watcher auth request 34 func (m *WatcherAuthRequest) Validate(formats strfmt.Registry) error { 35 var res []error 36 37 if err := m.validateMachineID(formats); err != nil { 38 res = append(res, err) 39 } 40 41 if err := m.validatePassword(formats); err != nil { 42 res = append(res, err) 43 } 44 45 if len(res) > 0 { 46 return errors.CompositeValidationError(res...) 47 } 48 return nil 49 } 50 51 func (m *WatcherAuthRequest) validateMachineID(formats strfmt.Registry) error { 52 53 if err := validate.Required("machine_id", "body", m.MachineID); err != nil { 54 return err 55 } 56 57 return nil 58 } 59 60 func (m *WatcherAuthRequest) validatePassword(formats strfmt.Registry) error { 61 62 if err := validate.Required("password", "body", m.Password); err != nil { 63 return err 64 } 65 66 if err := validate.FormatOf("password", "body", "password", m.Password.String(), formats); err != nil { 67 return err 68 } 69 70 return nil 71 } 72 73 // MarshalBinary interface implementation 74 func (m *WatcherAuthRequest) MarshalBinary() ([]byte, error) { 75 if m == nil { 76 return nil, nil 77 } 78 return swag.WriteJSON(m) 79 } 80 81 // UnmarshalBinary interface implementation 82 func (m *WatcherAuthRequest) UnmarshalBinary(b []byte) error { 83 var res WatcherAuthRequest 84 if err := swag.ReadJSON(b, &res); err != nil { 85 return err 86 } 87 *m = res 88 return nil 89 }