...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package silence
18
19
20
21
22 import (
23 "net/http"
24
25 "github.com/go-openapi/errors"
26 "github.com/go-openapi/runtime/middleware"
27 "github.com/go-openapi/strfmt"
28 "github.com/go-openapi/validate"
29 )
30
31
32
33
34 func NewGetSilenceParams() GetSilenceParams {
35
36 return GetSilenceParams{}
37 }
38
39
40
41
42
43 type GetSilenceParams struct {
44
45
46 HTTPRequest *http.Request `json:"-"`
47
48
52 SilenceID strfmt.UUID
53 }
54
55
56
57
58
59 func (o *GetSilenceParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
60 var res []error
61
62 o.HTTPRequest = r
63
64 rSilenceID, rhkSilenceID, _ := route.Params.GetOK("silenceID")
65 if err := o.bindSilenceID(rSilenceID, rhkSilenceID, route.Formats); err != nil {
66 res = append(res, err)
67 }
68 if len(res) > 0 {
69 return errors.CompositeValidationError(res...)
70 }
71 return nil
72 }
73
74
75 func (o *GetSilenceParams) bindSilenceID(rawData []string, hasKey bool, formats strfmt.Registry) error {
76 var raw string
77 if len(rawData) > 0 {
78 raw = rawData[len(rawData)-1]
79 }
80
81
82
83
84
85 value, err := formats.Parse("uuid", raw)
86 if err != nil {
87 return errors.InvalidType("silenceID", "path", "strfmt.UUID", raw)
88 }
89 o.SilenceID = *(value.(*strfmt.UUID))
90
91 if err := o.validateSilenceID(formats); err != nil {
92 return err
93 }
94
95 return nil
96 }
97
98
99 func (o *GetSilenceParams) validateSilenceID(formats strfmt.Registry) error {
100
101 if err := validate.FormatOf("silenceID", "path", "uuid", o.SilenceID.String(), formats); err != nil {
102 return err
103 }
104 return nil
105 }
106
View as plain text