bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/pkg/models/add_signals_request_item.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 // AddSignalsRequestItem Signal 16 // 17 // swagger:model AddSignalsRequestItem 18 type AddSignalsRequestItem struct { 19 20 // created at 21 CreatedAt string `json:"created_at,omitempty"` 22 23 // machine id 24 MachineID string `json:"machine_id,omitempty"` 25 26 // a human readable message 27 // Required: true 28 Message *string `json:"message"` 29 30 // scenario 31 // Required: true 32 Scenario *string `json:"scenario"` 33 34 // scenario hash 35 // Required: true 36 ScenarioHash *string `json:"scenario_hash"` 37 38 // scenario version 39 // Required: true 40 ScenarioVersion *string `json:"scenario_version"` 41 42 // source 43 // Required: true 44 Source *Source `json:"source"` 45 46 // start at 47 // Required: true 48 StartAt *string `json:"start_at"` 49 50 // stop at 51 // Required: true 52 StopAt *string `json:"stop_at"` 53 } 54 55 // Validate validates this add signals request item 56 func (m *AddSignalsRequestItem) Validate(formats strfmt.Registry) error { 57 var res []error 58 59 if err := m.validateMessage(formats); err != nil { 60 res = append(res, err) 61 } 62 63 if err := m.validateScenario(formats); err != nil { 64 res = append(res, err) 65 } 66 67 if err := m.validateScenarioHash(formats); err != nil { 68 res = append(res, err) 69 } 70 71 if err := m.validateScenarioVersion(formats); err != nil { 72 res = append(res, err) 73 } 74 75 if err := m.validateSource(formats); err != nil { 76 res = append(res, err) 77 } 78 79 if err := m.validateStartAt(formats); err != nil { 80 res = append(res, err) 81 } 82 83 if err := m.validateStopAt(formats); err != nil { 84 res = append(res, err) 85 } 86 87 if len(res) > 0 { 88 return errors.CompositeValidationError(res...) 89 } 90 return nil 91 } 92 93 func (m *AddSignalsRequestItem) validateMessage(formats strfmt.Registry) error { 94 95 if err := validate.Required("message", "body", m.Message); err != nil { 96 return err 97 } 98 99 return nil 100 } 101 102 func (m *AddSignalsRequestItem) validateScenario(formats strfmt.Registry) error { 103 104 if err := validate.Required("scenario", "body", m.Scenario); err != nil { 105 return err 106 } 107 108 return nil 109 } 110 111 func (m *AddSignalsRequestItem) validateScenarioHash(formats strfmt.Registry) error { 112 113 if err := validate.Required("scenario_hash", "body", m.ScenarioHash); err != nil { 114 return err 115 } 116 117 return nil 118 } 119 120 func (m *AddSignalsRequestItem) validateScenarioVersion(formats strfmt.Registry) error { 121 122 if err := validate.Required("scenario_version", "body", m.ScenarioVersion); err != nil { 123 return err 124 } 125 126 return nil 127 } 128 129 func (m *AddSignalsRequestItem) validateSource(formats strfmt.Registry) error { 130 131 if err := validate.Required("source", "body", m.Source); err != nil { 132 return err 133 } 134 135 if m.Source != nil { 136 if err := m.Source.Validate(formats); err != nil { 137 if ve, ok := err.(*errors.Validation); ok { 138 return ve.ValidateName("source") 139 } 140 return err 141 } 142 } 143 144 return nil 145 } 146 147 func (m *AddSignalsRequestItem) validateStartAt(formats strfmt.Registry) error { 148 149 if err := validate.Required("start_at", "body", m.StartAt); err != nil { 150 return err 151 } 152 153 return nil 154 } 155 156 func (m *AddSignalsRequestItem) validateStopAt(formats strfmt.Registry) error { 157 158 if err := validate.Required("stop_at", "body", m.StopAt); err != nil { 159 return err 160 } 161 162 return nil 163 } 164 165 // MarshalBinary interface implementation 166 func (m *AddSignalsRequestItem) MarshalBinary() ([]byte, error) { 167 if m == nil { 168 return nil, nil 169 } 170 return swag.WriteJSON(m) 171 } 172 173 // UnmarshalBinary interface implementation 174 func (m *AddSignalsRequestItem) UnmarshalBinary(b []byte) error { 175 var res AddSignalsRequestItem 176 if err := swag.ReadJSON(b, &res); err != nil { 177 return err 178 } 179 *m = res 180 return nil 181 }