github.com/crowdsecurity/crowdsec@v1.6.1/pkg/modelscapi/blocklist_link.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package modelscapi 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 "github.com/go-openapi/validate" 15 ) 16 17 // BlocklistLink blocklist link 18 // 19 // swagger:model BlocklistLink 20 type BlocklistLink struct { 21 22 // duration 23 // Required: true 24 Duration *string `json:"duration"` 25 26 // the name of the blocklist 27 // Required: true 28 Name *string `json:"name"` 29 30 // the remediation that should be used for the blocklist 31 // Required: true 32 Remediation *string `json:"remediation"` 33 34 // the scope of decisions in the blocklist 35 // Required: true 36 Scope *string `json:"scope"` 37 38 // the url from which the blocklist content can be downloaded 39 // Required: true 40 URL *string `json:"url"` 41 } 42 43 // Validate validates this blocklist link 44 func (m *BlocklistLink) Validate(formats strfmt.Registry) error { 45 var res []error 46 47 if err := m.validateDuration(formats); err != nil { 48 res = append(res, err) 49 } 50 51 if err := m.validateName(formats); err != nil { 52 res = append(res, err) 53 } 54 55 if err := m.validateRemediation(formats); err != nil { 56 res = append(res, err) 57 } 58 59 if err := m.validateScope(formats); err != nil { 60 res = append(res, err) 61 } 62 63 if err := m.validateURL(formats); err != nil { 64 res = append(res, err) 65 } 66 67 if len(res) > 0 { 68 return errors.CompositeValidationError(res...) 69 } 70 return nil 71 } 72 73 func (m *BlocklistLink) validateDuration(formats strfmt.Registry) error { 74 75 if err := validate.Required("duration", "body", m.Duration); err != nil { 76 return err 77 } 78 79 return nil 80 } 81 82 func (m *BlocklistLink) validateName(formats strfmt.Registry) error { 83 84 if err := validate.Required("name", "body", m.Name); err != nil { 85 return err 86 } 87 88 return nil 89 } 90 91 func (m *BlocklistLink) validateRemediation(formats strfmt.Registry) error { 92 93 if err := validate.Required("remediation", "body", m.Remediation); err != nil { 94 return err 95 } 96 97 return nil 98 } 99 100 func (m *BlocklistLink) validateScope(formats strfmt.Registry) error { 101 102 if err := validate.Required("scope", "body", m.Scope); err != nil { 103 return err 104 } 105 106 return nil 107 } 108 109 func (m *BlocklistLink) validateURL(formats strfmt.Registry) error { 110 111 if err := validate.Required("url", "body", m.URL); err != nil { 112 return err 113 } 114 115 return nil 116 } 117 118 // ContextValidate validates this blocklist link based on context it is used 119 func (m *BlocklistLink) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 120 return nil 121 } 122 123 // MarshalBinary interface implementation 124 func (m *BlocklistLink) MarshalBinary() ([]byte, error) { 125 if m == nil { 126 return nil, nil 127 } 128 return swag.WriteJSON(m) 129 } 130 131 // UnmarshalBinary interface implementation 132 func (m *BlocklistLink) UnmarshalBinary(b []byte) error { 133 var res BlocklistLink 134 if err := swag.ReadJSON(b, &res); err != nil { 135 return err 136 } 137 *m = res 138 return nil 139 }