enroll_request.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Code generated by go-swagger; DO NOT EDIT.
  2. package modelscapi
  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. // EnrollRequest enroll request
  13. //
  14. // enroll request model
  15. //
  16. // swagger:model EnrollRequest
  17. type EnrollRequest struct {
  18. // attachment_key is generated in your crowdsec backoffice account and allows you to enroll your machines to your BO account
  19. // Required: true
  20. // Pattern: ^[a-zA-Z0-9]+$
  21. AttachmentKey *string `json:"attachment_key"`
  22. // The name that will be display in the console for the instance
  23. Name string `json:"name,omitempty"`
  24. // To force enroll the instance
  25. Overwrite bool `json:"overwrite,omitempty"`
  26. // Tags to apply on the console for the instance
  27. Tags []string `json:"tags"`
  28. }
  29. // Validate validates this enroll request
  30. func (m *EnrollRequest) Validate(formats strfmt.Registry) error {
  31. var res []error
  32. if err := m.validateAttachmentKey(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 *EnrollRequest) validateAttachmentKey(formats strfmt.Registry) error {
  41. if err := validate.Required("attachment_key", "body", m.AttachmentKey); err != nil {
  42. return err
  43. }
  44. if err := validate.Pattern("attachment_key", "body", *m.AttachmentKey, `^[a-zA-Z0-9]+$`); err != nil {
  45. return err
  46. }
  47. return nil
  48. }
  49. // ContextValidate validates this enroll request based on context it is used
  50. func (m *EnrollRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
  51. return nil
  52. }
  53. // MarshalBinary interface implementation
  54. func (m *EnrollRequest) MarshalBinary() ([]byte, error) {
  55. if m == nil {
  56. return nil, nil
  57. }
  58. return swag.WriteJSON(m)
  59. }
  60. // UnmarshalBinary interface implementation
  61. func (m *EnrollRequest) UnmarshalBinary(b []byte) error {
  62. var res EnrollRequest
  63. if err := swag.ReadJSON(b, &res); err != nil {
  64. return err
  65. }
  66. *m = res
  67. return nil
  68. }