watcher_registration_request.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. // WatcherRegistrationRequest WatcherRegistrationRequest
  13. //
  14. // swagger:model WatcherRegistrationRequest
  15. type WatcherRegistrationRequest struct {
  16. // machine id
  17. // Required: true
  18. MachineID *string `json:"machine_id"`
  19. // password
  20. // Required: true
  21. // Format: password
  22. Password *strfmt.Password `json:"password"`
  23. }
  24. // Validate validates this watcher registration request
  25. func (m *WatcherRegistrationRequest) Validate(formats strfmt.Registry) error {
  26. var res []error
  27. if err := m.validateMachineID(formats); err != nil {
  28. res = append(res, err)
  29. }
  30. if err := m.validatePassword(formats); err != nil {
  31. res = append(res, err)
  32. }
  33. if len(res) > 0 {
  34. return errors.CompositeValidationError(res...)
  35. }
  36. return nil
  37. }
  38. func (m *WatcherRegistrationRequest) validateMachineID(formats strfmt.Registry) error {
  39. if err := validate.Required("machine_id", "body", m.MachineID); err != nil {
  40. return err
  41. }
  42. return nil
  43. }
  44. func (m *WatcherRegistrationRequest) validatePassword(formats strfmt.Registry) error {
  45. if err := validate.Required("password", "body", m.Password); err != nil {
  46. return err
  47. }
  48. if err := validate.FormatOf("password", "body", "password", m.Password.String(), formats); err != nil {
  49. return err
  50. }
  51. return nil
  52. }
  53. // ContextValidate validates this watcher registration request based on context it is used
  54. func (m *WatcherRegistrationRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
  55. return nil
  56. }
  57. // MarshalBinary interface implementation
  58. func (m *WatcherRegistrationRequest) MarshalBinary() ([]byte, error) {
  59. if m == nil {
  60. return nil, nil
  61. }
  62. return swag.WriteJSON(m)
  63. }
  64. // UnmarshalBinary interface implementation
  65. func (m *WatcherRegistrationRequest) UnmarshalBinary(b []byte) error {
  66. var res WatcherRegistrationRequest
  67. if err := swag.ReadJSON(b, &res); err != nil {
  68. return err
  69. }
  70. *m = res
  71. return nil
  72. }