...
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 "errors"
24 "net/url"
25 golangswaggerpaths "path"
26 "strings"
27
28 "github.com/go-openapi/strfmt"
29 )
30
31
32 type DeleteSilenceURL struct {
33 SilenceID strfmt.UUID
34
35 _basePath string
36
37 _ struct{}
38 }
39
40
41
42
43 func (o *DeleteSilenceURL) WithBasePath(bp string) *DeleteSilenceURL {
44 o.SetBasePath(bp)
45 return o
46 }
47
48
49
50
51 func (o *DeleteSilenceURL) SetBasePath(bp string) {
52 o._basePath = bp
53 }
54
55
56 func (o *DeleteSilenceURL) Build() (*url.URL, error) {
57 var _result url.URL
58
59 var _path = "/silence/{silenceID}"
60
61 silenceID := o.SilenceID.String()
62 if silenceID != "" {
63 _path = strings.Replace(_path, "{silenceID}", silenceID, -1)
64 } else {
65 return nil, errors.New("silenceId is required on DeleteSilenceURL")
66 }
67
68 _basePath := o._basePath
69 if _basePath == "" {
70 _basePath = "/api/v2/"
71 }
72 _result.Path = golangswaggerpaths.Join(_basePath, _path)
73
74 return &_result, nil
75 }
76
77
78 func (o *DeleteSilenceURL) Must(u *url.URL, err error) *url.URL {
79 if err != nil {
80 panic(err)
81 }
82 if u == nil {
83 panic("url can't be nil")
84 }
85 return u
86 }
87
88
89 func (o *DeleteSilenceURL) String() string {
90 return o.Must(o.Build()).String()
91 }
92
93
94 func (o *DeleteSilenceURL) BuildFull(scheme, host string) (*url.URL, error) {
95 if scheme == "" {
96 return nil, errors.New("scheme is required for a full url on DeleteSilenceURL")
97 }
98 if host == "" {
99 return nil, errors.New("host is required for a full url on DeleteSilenceURL")
100 }
101
102 base, err := o.Build()
103 if err != nil {
104 return nil, err
105 }
106
107 base.Scheme = scheme
108 base.Host = host
109 return base, nil
110 }
111
112
113 func (o *DeleteSilenceURL) StringFull(scheme, host string) string {
114 return o.Must(o.BuildFull(scheme, host)).String()
115 }
116
View as plain text