watcher_auth_request.go 2.2 KB

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