add_signals_request_item_source.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Code generated by go-swagger; DO NOT EDIT.
  2. package models
  3. // This file was generated by the swagger tool.
  4. // Editing this file might prove futile when you re-run the swagger generate command
  5. import (
  6. "context"
  7. "github.com/go-openapi/errors"
  8. "github.com/go-openapi/strfmt"
  9. "github.com/go-openapi/swag"
  10. "github.com/go-openapi/validate"
  11. )
  12. // AddSignalsRequestItemSource Source
  13. //
  14. // swagger:model AddSignalsRequestItemSource
  15. type AddSignalsRequestItemSource struct {
  16. // provided as a convenience when the source is an IP
  17. AsName string `json:"as_name,omitempty"`
  18. // provided as a convenience when the source is an IP
  19. AsNumber string `json:"as_number,omitempty"`
  20. // cn
  21. Cn string `json:"cn,omitempty"`
  22. // provided as a convenience when the source is an IP
  23. IP string `json:"ip,omitempty"`
  24. // latitude
  25. Latitude float32 `json:"latitude,omitempty"`
  26. // longitude
  27. Longitude float32 `json:"longitude,omitempty"`
  28. // provided as a convenience when the source is an IP
  29. Range string `json:"range,omitempty"`
  30. // the scope of a source : ip,range,username,etc
  31. // Required: true
  32. Scope *string `json:"scope"`
  33. // the value of a source : the ip, the range, the username,etc
  34. // Required: true
  35. Value *string `json:"value"`
  36. }
  37. // Validate validates this add signals request item source
  38. func (m *AddSignalsRequestItemSource) Validate(formats strfmt.Registry) error {
  39. var res []error
  40. if err := m.validateScope(formats); err != nil {
  41. res = append(res, err)
  42. }
  43. if err := m.validateValue(formats); err != nil {
  44. res = append(res, err)
  45. }
  46. if len(res) > 0 {
  47. return errors.CompositeValidationError(res...)
  48. }
  49. return nil
  50. }
  51. func (m *AddSignalsRequestItemSource) validateScope(formats strfmt.Registry) error {
  52. if err := validate.Required("scope", "body", m.Scope); err != nil {
  53. return err
  54. }
  55. return nil
  56. }
  57. func (m *AddSignalsRequestItemSource) validateValue(formats strfmt.Registry) error {
  58. if err := validate.Required("value", "body", m.Value); err != nil {
  59. return err
  60. }
  61. return nil
  62. }
  63. // ContextValidate validates this add signals request item source based on context it is used
  64. func (m *AddSignalsRequestItemSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
  65. return nil
  66. }
  67. // MarshalBinary interface implementation
  68. func (m *AddSignalsRequestItemSource) MarshalBinary() ([]byte, error) {
  69. if m == nil {
  70. return nil, nil
  71. }
  72. return swag.WriteJSON(m)
  73. }
  74. // UnmarshalBinary interface implementation
  75. func (m *AddSignalsRequestItemSource) UnmarshalBinary(b []byte) error {
  76. var res AddSignalsRequestItemSource
  77. if err := swag.ReadJSON(b, &res); err != nil {
  78. return err
  79. }
  80. *m = res
  81. return nil
  82. }