]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/DreamItGetIT/statuscake/responses.go
update vendor and go.mod
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / DreamItGetIT / statuscake / responses.go
1 package statuscake
2
3 import (
4 "strconv"
5 "strings"
6 )
7
8 type autheticationErrorResponse struct {
9 ErrNo int
10 Error string
11 }
12
13 type updateResponse struct {
14 Issues interface{} `json:"Issues"`
15 Success bool `json:"Success"`
16 Message string `json:"Message"`
17 InsertID int `json:"InsertID"`
18 }
19
20 type deleteResponse struct {
21 Success bool `json:"Success"`
22 Error string `json:"Error"`
23 }
24
25 type contactGroupDetailResponse struct {
26 ID int `json:"ID"`
27 Name string `json:"Name"`
28 Email string `json:"Email"`
29 }
30
31 type detailResponse struct {
32 Method string `json:"Method"`
33 TestID int `json:"TestID"`
34 TestType string `json:"TestType"`
35 Paused bool `json:"Paused"`
36 WebsiteName string `json:"WebsiteName"`
37 URI string `json:"URI"`
38 ContactID int `json:"ContactID"`
39 ContactGroups []contactGroupDetailResponse `json:"ContactGroups"`
40 Status string `json:"Status"`
41 Uptime float64 `json:"Uptime"`
42 CustomHeader string `json:"CustomHeader"`
43 UserAgent string `json:"UserAgent"`
44 CheckRate int `json:"CheckRate"`
45 Timeout int `json:"Timeout"`
46 LogoImage string `json:"LogoImage"`
47 Confirmation int `json:"Confirmation,string"`
48 WebsiteHost string `json:"WebsiteHost"`
49 NodeLocations []string `json:"NodeLocations"`
50 FindString string `json:"FindString"`
51 DoNotFind bool `json:"DoNotFind"`
52 LastTested string `json:"LastTested"`
53 NextLocation string `json:"NextLocation"`
54 Port int `json:"Port"`
55 Processing bool `json:"Processing"`
56 ProcessingState string `json:"ProcessingState"`
57 ProcessingOn string `json:"ProcessingOn"`
58 DownTimes int `json:"DownTimes,string"`
59 Sensitive bool `json:"Sensitive"`
60 TriggerRate int `json:"TriggerRate,string"`
61 UseJar int `json:"UseJar"`
62 PostRaw string `json:"PostRaw"`
63 FinalEndpoint string `json:"FinalEndpoint"`
64 EnableSSLWarning bool `json:"EnableSSLWarning"`
65 FollowRedirect bool `json:"FollowRedirect"`
66 StatusCodes []string `json:"StatusCodes"`
67 Tags []string `json:"Tags"`
68 }
69
70 func (d *detailResponse) test() *Test {
71 contactGroupIds := make([]string, len(d.ContactGroups))
72 for i, v := range d.ContactGroups {
73 contactGroupIds[i] = strconv.Itoa(v.ID)
74 }
75
76 return &Test{
77 TestID: d.TestID,
78 TestType: d.TestType,
79 Paused: d.Paused,
80 WebsiteName: d.WebsiteName,
81 WebsiteURL: d.URI,
82 CustomHeader: d.CustomHeader,
83 UserAgent: d.UserAgent,
84 ContactID: d.ContactID,
85 ContactGroup: contactGroupIds,
86 Status: d.Status,
87 Uptime: d.Uptime,
88 CheckRate: d.CheckRate,
89 Timeout: d.Timeout,
90 LogoImage: d.LogoImage,
91 Confirmation: d.Confirmation,
92 WebsiteHost: d.WebsiteHost,
93 NodeLocations: d.NodeLocations,
94 FindString: d.FindString,
95 DoNotFind: d.DoNotFind,
96 Port: d.Port,
97 TriggerRate: d.TriggerRate,
98 UseJar: d.UseJar,
99 PostRaw: d.PostRaw,
100 FinalEndpoint: d.FinalEndpoint,
101 EnableSSLAlert: d.EnableSSLWarning,
102 FollowRedirect: d.FollowRedirect,
103 StatusCodes: strings.Join(d.StatusCodes[:], ","),
104 TestTags: d.Tags,
105 }
106 }