forked from opsgenie/opsgenie-go-sdk-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.go
63 lines (47 loc) · 1.12 KB
/
request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package logs
import (
"net/http"
"strconv"
"github.com/antoniou/opsgenie-go-sdk-v2/client"
"github.com/pkg/errors"
)
type ListLogFilesRequest struct {
client.BaseRequest
Marker string
Limit int
}
func (r *ListLogFilesRequest) Validate() error {
if len(r.Marker) == 0 {
return errors.New("marker cannot be empty")
}
return nil
}
func (r *ListLogFilesRequest) ResourcePath() string {
return "/v2/logs/list/" + r.Marker
}
func (r *ListLogFilesRequest) Method() string {
return http.MethodGet
}
func (r *ListLogFilesRequest) RequestParams() map[string]string {
params := make(map[string]string)
if r.Limit >= 0 {
params["limit"] = strconv.Itoa(r.Limit)
}
return params
}
type GenerateLogFileDownloadLinkRequest struct {
client.BaseRequest
FileName string
}
func (r *GenerateLogFileDownloadLinkRequest) Validate() error {
if len(r.FileName) == 0 {
return errors.New("fileName cannot be empty")
}
return nil
}
func (r *GenerateLogFileDownloadLinkRequest) ResourcePath() string {
return "/v2/logs/download/" + r.FileName
}
func (r *GenerateLogFileDownloadLinkRequest) Method() string {
return http.MethodGet
}