diff options
author | Mat Schaffer <mat@schaffer.me> | 2018-08-20 11:45:48 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-20 11:45:48 +0900 |
commit | 7f6f2d1fae833992b11500248d537e0ba3fa48ff (patch) | |
tree | 59ede0e309433fc5796c568e5e4e60a8c1a762c9 | |
parent | a6ddc0c931c22051c2f072877a1e0b18a939ef2e (diff) | |
parent | 65c668b059fb4da3f52a461be2e5c77ac0bcf2a7 (diff) | |
download | terraform-provider-statuscake-7f6f2d1fae833992b11500248d537e0ba3fa48ff.tar.gz terraform-provider-statuscake-7f6f2d1fae833992b11500248d537e0ba3fa48ff.tar.zst terraform-provider-statuscake-7f6f2d1fae833992b11500248d537e0ba3fa48ff.zip |
Merge pull request #18 from matschaffer/contact-groups-support
Add test contact group support
-rw-r--r-- | statuscake/resource_statuscaketest.go | 23 | ||||
-rw-r--r-- | statuscake/resource_statuscaketest_test.go | 25 | ||||
-rw-r--r-- | vendor/github.com/DreamItGetIT/statuscake/errors.go | 8 | ||||
-rw-r--r-- | vendor/github.com/DreamItGetIT/statuscake/responses.go | 80 | ||||
-rw-r--r-- | vendor/github.com/DreamItGetIT/statuscake/tests.go | 15 | ||||
-rw-r--r-- | vendor/vendor.json | 6 | ||||
-rw-r--r-- | website/docs/r/test.html.markdown | 14 |
7 files changed, 100 insertions, 71 deletions
diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go index d7d3f36..b0dc84f 100644 --- a/statuscake/resource_statuscaketest.go +++ b/statuscake/resource_statuscaketest.go | |||
@@ -51,9 +51,11 @@ func resourceStatusCakeTest() *schema.Resource { | |||
51 | Required: true, | 51 | Required: true, |
52 | }, | 52 | }, |
53 | 53 | ||
54 | "contact_id": { | 54 | "contact_group": { |
55 | Type: schema.TypeInt, | 55 | Type: schema.TypeSet, |
56 | Elem: &schema.Schema{Type: schema.TypeString}, | ||
56 | Optional: true, | 57 | Optional: true, |
58 | Set: schema.HashString, | ||
57 | }, | 59 | }, |
58 | 60 | ||
59 | "check_rate": { | 61 | "check_rate": { |
@@ -94,6 +96,7 @@ func resourceStatusCakeTest() *schema.Resource { | |||
94 | Optional: true, | 96 | Optional: true, |
95 | Default: 5, | 97 | Default: 5, |
96 | }, | 98 | }, |
99 | |||
97 | "custom_header": { | 100 | "custom_header": { |
98 | Type: schema.TypeString, | 101 | Type: schema.TypeString, |
99 | Optional: true, | 102 | Optional: true, |
@@ -178,8 +181,10 @@ func resourceStatusCakeTest() *schema.Resource { | |||
178 | }, | 181 | }, |
179 | 182 | ||
180 | "test_tags": { | 183 | "test_tags": { |
181 | Type: schema.TypeString, | 184 | Type: schema.TypeSet, |
185 | Elem: &schema.Schema{Type: schema.TypeString}, | ||
182 | Optional: true, | 186 | Optional: true, |
187 | Set: schema.HashString, | ||
183 | }, | 188 | }, |
184 | 189 | ||
185 | "status_codes": { | 190 | "status_codes": { |
@@ -220,7 +225,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error { | |||
220 | TestType: d.Get("test_type").(string), | 225 | TestType: d.Get("test_type").(string), |
221 | Paused: d.Get("paused").(bool), | 226 | Paused: d.Get("paused").(bool), |
222 | Timeout: d.Get("timeout").(int), | 227 | Timeout: d.Get("timeout").(int), |
223 | ContactID: d.Get("contact_id").(int), | 228 | ContactGroup: castSetToSliceStrings(d.Get("contact_group").(*schema.Set).List()), |
224 | Confirmation: d.Get("confirmations").(int), | 229 | Confirmation: d.Get("confirmations").(int), |
225 | Port: d.Get("port").(int), | 230 | Port: d.Get("port").(int), |
226 | TriggerRate: d.Get("trigger_rate").(int), | 231 | TriggerRate: d.Get("trigger_rate").(int), |
@@ -240,7 +245,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error { | |||
240 | FindString: d.Get("find_string").(string), | 245 | FindString: d.Get("find_string").(string), |
241 | DoNotFind: d.Get("do_not_find").(bool), | 246 | DoNotFind: d.Get("do_not_find").(bool), |
242 | RealBrowser: d.Get("real_browser").(int), | 247 | RealBrowser: d.Get("real_browser").(int), |
243 | TestTags: d.Get("test_tags").(string), | 248 | TestTags: castSetToSliceStrings(d.Get("test_tags").(*schema.Set).List()), |
244 | StatusCodes: d.Get("status_codes").(string), | 249 | StatusCodes: d.Get("status_codes").(string), |
245 | UseJar: d.Get("use_jar").(int), | 250 | UseJar: d.Get("use_jar").(int), |
246 | PostRaw: d.Get("post_raw").(string), | 251 | PostRaw: d.Get("post_raw").(string), |
@@ -309,7 +314,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error { | |||
309 | d.Set("test_type", testResp.TestType) | 314 | d.Set("test_type", testResp.TestType) |
310 | d.Set("paused", testResp.Paused) | 315 | d.Set("paused", testResp.Paused) |
311 | d.Set("timeout", testResp.Timeout) | 316 | d.Set("timeout", testResp.Timeout) |
312 | d.Set("contact_id", testResp.ContactID) | 317 | d.Set("contact_group", testResp.ContactGroup) |
313 | d.Set("confirmations", testResp.Confirmation) | 318 | d.Set("confirmations", testResp.Confirmation) |
314 | d.Set("port", testResp.Port) | 319 | d.Set("port", testResp.Port) |
315 | d.Set("trigger_rate", testResp.TriggerRate) | 320 | d.Set("trigger_rate", testResp.TriggerRate) |
@@ -353,8 +358,8 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test { | |||
353 | if v, ok := d.GetOk("check_rate"); ok { | 358 | if v, ok := d.GetOk("check_rate"); ok { |
354 | test.CheckRate = v.(int) | 359 | test.CheckRate = v.(int) |
355 | } | 360 | } |
356 | if v, ok := d.GetOk("contact_id"); ok { | 361 | if v, ok := d.GetOk("contact_group"); ok { |
357 | test.ContactID = v.(int) | 362 | test.ContactGroup = castSetToSliceStrings(v.(*schema.Set).List()) |
358 | } | 363 | } |
359 | if v, ok := d.GetOk("test_type"); ok { | 364 | if v, ok := d.GetOk("test_type"); ok { |
360 | test.TestType = v.(string) | 365 | test.TestType = v.(string) |
@@ -417,7 +422,7 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test { | |||
417 | test.RealBrowser = v.(int) | 422 | test.RealBrowser = v.(int) |
418 | } | 423 | } |
419 | if v, ok := d.GetOk("test_tags"); ok { | 424 | if v, ok := d.GetOk("test_tags"); ok { |
420 | test.TestTags = v.(string) | 425 | test.TestTags = castSetToSliceStrings(v.(*schema.Set).List()) |
421 | } | 426 | } |
422 | if v, ok := d.GetOk("status_codes"); ok { | 427 | if v, ok := d.GetOk("status_codes"); ok { |
423 | test.StatusCodes = v.(string) | 428 | test.StatusCodes = v.(string) |
diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go index 8bcbb36..0ea1e2b 100644 --- a/statuscake/resource_statuscaketest_test.go +++ b/statuscake/resource_statuscaketest_test.go | |||
@@ -72,7 +72,6 @@ func TestAccStatusCake_withUpdate(t *testing.T) { | |||
72 | resource.TestCheckResourceAttr("statuscake_test.google", "check_rate", "500"), | 72 | resource.TestCheckResourceAttr("statuscake_test.google", "check_rate", "500"), |
73 | resource.TestCheckResourceAttr("statuscake_test.google", "paused", "true"), | 73 | resource.TestCheckResourceAttr("statuscake_test.google", "paused", "true"), |
74 | resource.TestCheckResourceAttr("statuscake_test.google", "timeout", "40"), | 74 | resource.TestCheckResourceAttr("statuscake_test.google", "timeout", "40"), |
75 | resource.TestCheckResourceAttr("statuscake_test.google", "contact_id", "0"), | ||
76 | resource.TestCheckResourceAttr("statuscake_test.google", "confirmations", "0"), | 75 | resource.TestCheckResourceAttr("statuscake_test.google", "confirmations", "0"), |
77 | resource.TestCheckResourceAttr("statuscake_test.google", "trigger_rate", "20"), | 76 | resource.TestCheckResourceAttr("statuscake_test.google", "trigger_rate", "20"), |
78 | resource.TestCheckResourceAttr("statuscake_test.google", "custom_header", "{ \"Content-Type\": \"application/x-www-form-urlencoded\" }"), | 77 | resource.TestCheckResourceAttr("statuscake_test.google", "custom_header", "{ \"Content-Type\": \"application/x-www-form-urlencoded\" }"), |
@@ -91,7 +90,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) { | |||
91 | resource.TestCheckResourceAttr("statuscake_test.google", "find_string", "string15212"), | 90 | resource.TestCheckResourceAttr("statuscake_test.google", "find_string", "string15212"), |
92 | resource.TestCheckResourceAttr("statuscake_test.google", "do_not_find", "false"), | 91 | resource.TestCheckResourceAttr("statuscake_test.google", "do_not_find", "false"), |
93 | resource.TestCheckResourceAttr("statuscake_test.google", "real_browser", "1"), | 92 | resource.TestCheckResourceAttr("statuscake_test.google", "real_browser", "1"), |
94 | resource.TestCheckResourceAttr("statuscake_test.google", "test_tags", "string8191"), | 93 | resource.TestCheckResourceAttr("statuscake_test.google", "test_tags.#", "1"), |
95 | resource.TestCheckResourceAttr("statuscake_test.google", "status_codes", "string23065"), | 94 | resource.TestCheckResourceAttr("statuscake_test.google", "status_codes", "string23065"), |
96 | resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), | 95 | resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), |
97 | resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), | 96 | resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), |
@@ -159,8 +158,13 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC | |||
159 | err = check(key, value, strconv.FormatBool(test.Paused)) | 158 | err = check(key, value, strconv.FormatBool(test.Paused)) |
160 | case "timeout": | 159 | case "timeout": |
161 | err = check(key, value, strconv.Itoa(test.Timeout)) | 160 | err = check(key, value, strconv.Itoa(test.Timeout)) |
162 | case "contact_id": | 161 | case "contact_group": |
163 | err = check(key, value, strconv.Itoa(test.ContactID)) | 162 | for _, tv := range test.ContactGroup { |
163 | err = check(key, value, tv) | ||
164 | if err != nil { | ||
165 | return err | ||
166 | } | ||
167 | } | ||
164 | case "confirmations": | 168 | case "confirmations": |
165 | err = check(key, value, strconv.Itoa(test.Confirmation)) | 169 | err = check(key, value, strconv.Itoa(test.Confirmation)) |
166 | case "trigger_rate": | 170 | case "trigger_rate": |
@@ -214,13 +218,10 @@ func testAccTestCheckDestroy(test *statuscake.Test) resource.TestCheckFunc { | |||
214 | } | 218 | } |
215 | 219 | ||
216 | func interpolateTerraformTemplate(template string) string { | 220 | func interpolateTerraformTemplate(template string) string { |
217 | testContactGroupId := 43402 | 221 | testContactGroupId := "43402" |
218 | 222 | ||
219 | if v := os.Getenv("STATUSCAKE_TEST_CONTACT_GROUP_ID"); v != "" { | 223 | if v := os.Getenv("STATUSCAKE_TEST_CONTACT_GROUP_ID"); v != "" { |
220 | id, err := strconv.Atoi(v) | 224 | testContactGroupId = v |
221 | if err == nil { | ||
222 | testContactGroupId = id | ||
223 | } | ||
224 | } | 225 | } |
225 | 226 | ||
226 | return fmt.Sprintf(template, testContactGroupId) | 227 | return fmt.Sprintf(template, testContactGroupId) |
@@ -233,7 +234,7 @@ resource "statuscake_test" "google" { | |||
233 | test_type = "HTTP" | 234 | test_type = "HTTP" |
234 | check_rate = 300 | 235 | check_rate = 300 |
235 | timeout = 10 | 236 | timeout = 10 |
236 | contact_id = %d | 237 | contact_group = ["%s"] |
237 | confirmations = 1 | 238 | confirmations = 1 |
238 | trigger_rate = 10 | 239 | trigger_rate = 10 |
239 | } | 240 | } |
@@ -261,7 +262,7 @@ resource "statuscake_test" "google" { | |||
261 | find_string = "string15212" | 262 | find_string = "string15212" |
262 | do_not_find = false | 263 | do_not_find = false |
263 | real_browser = 1 | 264 | real_browser = 1 |
264 | test_tags = "string8191" | 265 | test_tags = ["string8191"] |
265 | status_codes = "string23065" | 266 | status_codes = "string23065" |
266 | use_jar = 1 | 267 | use_jar = 1 |
267 | post_raw = "string32096" | 268 | post_raw = "string32096" |
@@ -277,7 +278,7 @@ resource "statuscake_test" "google" { | |||
277 | test_type = "TCP" | 278 | test_type = "TCP" |
278 | check_rate = 300 | 279 | check_rate = 300 |
279 | timeout = 10 | 280 | timeout = 10 |
280 | contact_id = %d | 281 | contact_group = ["%s"] |
281 | confirmations = 1 | 282 | confirmations = 1 |
282 | port = 80 | 283 | port = 80 |
283 | } | 284 | } |
diff --git a/vendor/github.com/DreamItGetIT/statuscake/errors.go b/vendor/github.com/DreamItGetIT/statuscake/errors.go index 4c51991..c336647 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/errors.go +++ b/vendor/github.com/DreamItGetIT/statuscake/errors.go | |||
@@ -34,12 +34,15 @@ func (e ValidationError) Error() string { | |||
34 | } | 34 | } |
35 | 35 | ||
36 | type updateError struct { | 36 | type updateError struct { |
37 | Issues interface{} | 37 | Issues interface{} |
38 | Message string | ||
38 | } | 39 | } |
39 | 40 | ||
40 | func (e *updateError) Error() string { | 41 | func (e *updateError) Error() string { |
41 | var messages []string | 42 | var messages []string |
42 | 43 | ||
44 | messages = append(messages, e.Message) | ||
45 | |||
43 | if issues, ok := e.Issues.(map[string]interface{}); ok { | 46 | if issues, ok := e.Issues.(map[string]interface{}); ok { |
44 | for k, v := range issues { | 47 | for k, v := range issues { |
45 | m := fmt.Sprintf("%s %s", k, v) | 48 | m := fmt.Sprintf("%s %s", k, v) |
@@ -50,6 +53,9 @@ func (e *updateError) Error() string { | |||
50 | m := fmt.Sprint(v) | 53 | m := fmt.Sprint(v) |
51 | messages = append(messages, m) | 54 | messages = append(messages, m) |
52 | } | 55 | } |
56 | } else if issue, ok := e.Issues.(interface{}); ok { | ||
57 | m := fmt.Sprint(issue) | ||
58 | messages = append(messages, m) | ||
53 | } | 59 | } |
54 | 60 | ||
55 | return strings.Join(messages, ", ") | 61 | return strings.Join(messages, ", ") |
diff --git a/vendor/github.com/DreamItGetIT/statuscake/responses.go b/vendor/github.com/DreamItGetIT/statuscake/responses.go index 3cbf36d..e8d4af4 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/responses.go +++ b/vendor/github.com/DreamItGetIT/statuscake/responses.go | |||
@@ -1,6 +1,7 @@ | |||
1 | package statuscake | 1 | package statuscake |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "strconv" | ||
4 | "strings" | 5 | "strings" |
5 | ) | 6 | ) |
6 | 7 | ||
@@ -21,43 +22,55 @@ type deleteResponse struct { | |||
21 | Error string `json:"Error"` | 22 | Error string `json:"Error"` |
22 | } | 23 | } |
23 | 24 | ||
25 | type contactGroupDetailResponse struct { | ||
26 | ID int `json:"ID"` | ||
27 | Name string `json:"Name"` | ||
28 | Email string `json:"Email"` | ||
29 | } | ||
30 | |||
24 | type detailResponse struct { | 31 | type detailResponse struct { |
25 | Method string `json:"Method"` | 32 | Method string `json:"Method"` |
26 | TestID int `json:"TestID"` | 33 | TestID int `json:"TestID"` |
27 | TestType string `json:"TestType"` | 34 | TestType string `json:"TestType"` |
28 | Paused bool `json:"Paused"` | 35 | Paused bool `json:"Paused"` |
29 | WebsiteName string `json:"WebsiteName"` | 36 | WebsiteName string `json:"WebsiteName"` |
30 | URI string `json:"URI"` | 37 | URI string `json:"URI"` |
31 | ContactID int `json:"ContactID"` | 38 | ContactID int `json:"ContactID"` |
32 | Status string `json:"Status"` | 39 | ContactGroups []contactGroupDetailResponse `json:"ContactGroups"` |
33 | Uptime float64 `json:"Uptime"` | 40 | Status string `json:"Status"` |
34 | CustomHeader string `json:"CustomHeader"` | 41 | Uptime float64 `json:"Uptime"` |
35 | UserAgent string `json:"UserAgent"` | 42 | CustomHeader string `json:"CustomHeader"` |
36 | CheckRate int `json:"CheckRate"` | 43 | UserAgent string `json:"UserAgent"` |
37 | Timeout int `json:"Timeout"` | 44 | CheckRate int `json:"CheckRate"` |
38 | LogoImage string `json:"LogoImage"` | 45 | Timeout int `json:"Timeout"` |
39 | Confirmation int `json:"Confirmation,string"` | 46 | LogoImage string `json:"LogoImage"` |
40 | WebsiteHost string `json:"WebsiteHost"` | 47 | Confirmation int `json:"Confirmation,string"` |
41 | NodeLocations []string `json:"NodeLocations"` | 48 | WebsiteHost string `json:"WebsiteHost"` |
42 | FindString string `json:"FindString"` | 49 | NodeLocations []string `json:"NodeLocations"` |
43 | DoNotFind bool `json:"DoNotFind"` | 50 | FindString string `json:"FindString"` |
44 | LastTested string `json:"LastTested"` | 51 | DoNotFind bool `json:"DoNotFind"` |
45 | NextLocation string `json:"NextLocation"` | 52 | LastTested string `json:"LastTested"` |
46 | Port int `json:"Port"` | 53 | NextLocation string `json:"NextLocation"` |
47 | Processing bool `json:"Processing"` | 54 | Port int `json:"Port"` |
48 | ProcessingState string `json:"ProcessingState"` | 55 | Processing bool `json:"Processing"` |
49 | ProcessingOn string `json:"ProcessingOn"` | 56 | ProcessingState string `json:"ProcessingState"` |
50 | DownTimes int `json:"DownTimes,string"` | 57 | ProcessingOn string `json:"ProcessingOn"` |
51 | Sensitive bool `json:"Sensitive"` | 58 | DownTimes int `json:"DownTimes,string"` |
52 | TriggerRate int `json:"TriggerRate,string"` | 59 | Sensitive bool `json:"Sensitive"` |
53 | UseJar int `json:"UseJar"` | 60 | TriggerRate int `json:"TriggerRate,string"` |
54 | PostRaw string `json:"PostRaw"` | 61 | UseJar int `json:"UseJar"` |
55 | FinalEndpoint string `json:"FinalEndpoint"` | 62 | PostRaw string `json:"PostRaw"` |
56 | FollowRedirect bool `json:"FollowRedirect"` | 63 | FinalEndpoint string `json:"FinalEndpoint"` |
57 | StatusCodes []string `json:"StatusCodes"` | 64 | FollowRedirect bool `json:"FollowRedirect"` |
65 | StatusCodes []string `json:"StatusCodes"` | ||
58 | } | 66 | } |
59 | 67 | ||
60 | func (d *detailResponse) test() *Test { | 68 | func (d *detailResponse) test() *Test { |
69 | contactGroupIds := make([]string, len(d.ContactGroups)) | ||
70 | for i, v := range d.ContactGroups { | ||
71 | contactGroupIds[i] = strconv.Itoa(v.ID) | ||
72 | } | ||
73 | |||
61 | return &Test{ | 74 | return &Test{ |
62 | TestID: d.TestID, | 75 | TestID: d.TestID, |
63 | TestType: d.TestType, | 76 | TestType: d.TestType, |
@@ -67,6 +80,7 @@ func (d *detailResponse) test() *Test { | |||
67 | CustomHeader: d.CustomHeader, | 80 | CustomHeader: d.CustomHeader, |
68 | UserAgent: d.UserAgent, | 81 | UserAgent: d.UserAgent, |
69 | ContactID: d.ContactID, | 82 | ContactID: d.ContactID, |
83 | ContactGroup: contactGroupIds, | ||
70 | Status: d.Status, | 84 | Status: d.Status, |
71 | Uptime: d.Uptime, | 85 | Uptime: d.Uptime, |
72 | CheckRate: d.CheckRate, | 86 | CheckRate: d.CheckRate, |
diff --git a/vendor/github.com/DreamItGetIT/statuscake/tests.go b/vendor/github.com/DreamItGetIT/statuscake/tests.go index a41b0bd..c6e6dd2 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/tests.go +++ b/vendor/github.com/DreamItGetIT/statuscake/tests.go | |||
@@ -12,7 +12,7 @@ const queryStringTag = "querystring" | |||
12 | 12 | ||
13 | // Test represents a statuscake Test | 13 | // Test represents a statuscake Test |
14 | type Test struct { | 14 | type Test struct { |
15 | // ThiTestID is an int, use this to get more details about this test. If not provided will insert a new check, else will update | 15 | // TestID is an int, use this to get more details about this test. If not provided will insert a new check, else will update |
16 | TestID int `json:"TestID" querystring:"TestID" querystringoptions:"omitempty"` | 16 | TestID int `json:"TestID" querystring:"TestID" querystringoptions:"omitempty"` |
17 | 17 | ||
18 | // Sent tfalse To Unpause and true To Pause. | 18 | // Sent tfalse To Unpause and true To Pause. |
@@ -33,8 +33,11 @@ type Test struct { | |||
33 | // A Port to use on TCP Tests | 33 | // A Port to use on TCP Tests |
34 | Port int `json:"Port" querystring:"Port"` | 34 | Port int `json:"Port" querystring:"Port"` |
35 | 35 | ||
36 | // Contact group ID - will return int of contact group used else 0 | 36 | // Contact group ID - deprecated in favor of ContactGroup but still provided in the API detail response |
37 | ContactID int `json:"ContactID" querystring:"ContactGroup"` | 37 | ContactID int `json:"ContactID"` |
38 | |||
39 | // Contact group IDs - will return list of ints or empty if not provided | ||
40 | ContactGroup []string `json:"ContactGroup" querystring:"ContactGroup"` | ||
38 | 41 | ||
39 | // Current status at last test | 42 | // Current status at last test |
40 | Status string `json:"Status"` | 43 | Status string `json:"Status"` |
@@ -51,7 +54,7 @@ type Test struct { | |||
51 | // A URL to ping if a site goes down. | 54 | // A URL to ping if a site goes down. |
52 | PingURL string `json:"PingURL" querystring:"PingURL"` | 55 | PingURL string `json:"PingURL" querystring:"PingURL"` |
53 | 56 | ||
54 | Confirmation int `json:"Confirmationi,string" querystring:"Confirmation"` | 57 | Confirmation int `json:"Confirmation,string" querystring:"Confirmation"` |
55 | 58 | ||
56 | // The number of seconds between checks. | 59 | // The number of seconds between checks. |
57 | CheckRate int `json:"CheckRate" querystring:"CheckRate"` | 60 | CheckRate int `json:"CheckRate" querystring:"CheckRate"` |
@@ -93,7 +96,7 @@ type Test struct { | |||
93 | TriggerRate int `json:"TriggerRate" querystring:"TriggerRate"` | 96 | TriggerRate int `json:"TriggerRate" querystring:"TriggerRate"` |
94 | 97 | ||
95 | // Tags should be seperated by a comma - no spacing between tags (this,is,a set,of,tags) | 98 | // Tags should be seperated by a comma - no spacing between tags (this,is,a set,of,tags) |
96 | TestTags string `json:"TestTags" querystring:"TestTags"` | 99 | TestTags []string `json:"TestTags" querystring:"TestTags"` |
97 | 100 | ||
98 | // Comma Seperated List of StatusCodes to Trigger Error on (on Update will replace, so send full list each time) | 101 | // Comma Seperated List of StatusCodes to Trigger Error on (on Update will replace, so send full list each time) |
99 | StatusCodes string `json:"StatusCodes" querystring:"StatusCodes"` | 102 | StatusCodes string `json:"StatusCodes" querystring:"StatusCodes"` |
@@ -283,7 +286,7 @@ func (tt *tests) Update(t *Test) (*Test, error) { | |||
283 | } | 286 | } |
284 | 287 | ||
285 | if !ur.Success { | 288 | if !ur.Success { |
286 | return nil, &updateError{Issues: ur.Issues} | 289 | return nil, &updateError{Issues: ur.Issues, Message: ur.Message} |
287 | } | 290 | } |
288 | 291 | ||
289 | t2 := *t | 292 | t2 := *t |
diff --git a/vendor/vendor.json b/vendor/vendor.json index 61dd8f3..2ed1483 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json | |||
@@ -3,10 +3,10 @@ | |||
3 | "ignore": "appengine test github.com/hashicorp/nomad/ github.com/hashicorp/terraform/backend", | 3 | "ignore": "appengine test github.com/hashicorp/nomad/ github.com/hashicorp/terraform/backend", |
4 | "package": [ | 4 | "package": [ |
5 | { | 5 | { |
6 | "checksumSHA1": "6Fo7YzTT+MDviHOsqg6dNw8WrV4=", | 6 | "checksumSHA1": "YjE/nBvoiV2Z821c8uoxtQLCUSY=", |
7 | "path": "github.com/DreamItGetIT/statuscake", | 7 | "path": "github.com/DreamItGetIT/statuscake", |
8 | "revision": "f69198f958d7326f3c110dd9be1c21abbd8a87a7", | 8 | "revision": "85edefcbdaa39278c9db647d135d1dc8bccdad96", |
9 | "revisionTime": "2018-01-30T22:14:43Z" | 9 | "revisionTime": "2018-07-28T15:29:38Z" |
10 | }, | 10 | }, |
11 | { | 11 | { |
12 | "checksumSHA1": "FIL83loX9V9APvGQIjJpbxq53F0=", | 12 | "checksumSHA1": "FIL83loX9V9APvGQIjJpbxq53F0=", |
diff --git a/website/docs/r/test.html.markdown b/website/docs/r/test.html.markdown index b154773..9c1fb35 100644 --- a/website/docs/r/test.html.markdown +++ b/website/docs/r/test.html.markdown | |||
@@ -14,11 +14,11 @@ The test resource allows StatusCake tests to be managed by Terraform. | |||
14 | 14 | ||
15 | ```hcl | 15 | ```hcl |
16 | resource "statuscake_test" "google" { | 16 | resource "statuscake_test" "google" { |
17 | website_name = "google.com" | 17 | website_name = "google.com" |
18 | website_url = "www.google.com" | 18 | website_url = "www.google.com" |
19 | test_type = "HTTP" | 19 | test_type = "HTTP" |
20 | check_rate = 300 | 20 | check_rate = 300 |
21 | contact_id = 12345 | 21 | contact_group = ["12345"] |
22 | } | 22 | } |
23 | ``` | 23 | ``` |
24 | 24 | ||
@@ -29,7 +29,7 @@ The following arguments are supported: | |||
29 | * `website_name` - (Required) This is the name of the test and the website to be monitored. | 29 | * `website_name` - (Required) This is the name of the test and the website to be monitored. |
30 | * `website_url` - (Required) The URL of the website to be monitored | 30 | * `website_url` - (Required) The URL of the website to be monitored |
31 | * `check_rate` - (Optional) Test check rate in seconds. Defaults to 300 | 31 | * `check_rate` - (Optional) Test check rate in seconds. Defaults to 300 |
32 | * `contact_id` - (Optional) The id of the contact group to be add to the test. Each test can have only one. | 32 | * `contact_group` - (Optional) Set test contact groups, must be array of strings. |
33 | * `test_type` - (Required) The type of Test. Either HTTP, TCP, PING, or DNS | 33 | * `test_type` - (Required) The type of Test. Either HTTP, TCP, PING, or DNS |
34 | * `paused` - (Optional) Whether or not the test is paused. Defaults to false. | 34 | * `paused` - (Optional) Whether or not the test is paused. Defaults to false. |
35 | * `timeout` - (Optional) The timeout of the test in seconds. | 35 | * `timeout` - (Optional) The timeout of the test in seconds. |
@@ -50,7 +50,7 @@ The following arguments are supported: | |||
50 | * `find_string` - (Optional) A string that should either be found or not found. | 50 | * `find_string` - (Optional) A string that should either be found or not found. |
51 | * `do_not_find` - (Optional) If the above string should be found to trigger a alert. 1 = will trigger if find_string found. | 51 | * `do_not_find` - (Optional) If the above string should be found to trigger a alert. 1 = will trigger if find_string found. |
52 | * `real_browser` - (Optional) Use 1 to TURN OFF real browser testing. | 52 | * `real_browser` - (Optional) Use 1 to TURN OFF real browser testing. |
53 | * `test_tags` - (Optional) Tags should be seperated by a comma - no spacing between tags (this,is,a set,of,tags). | 53 | * `test_tags` - (Optional) Set test tags, must be array of strings. |
54 | * `status_codes` - (Optional) Comma Seperated List of StatusCodes to Trigger Error on. Defaults are "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599". | 54 | * `status_codes` - (Optional) Comma Seperated List of StatusCodes to Trigger Error on. Defaults are "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599". |
55 | * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. | 55 | * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. |
56 | * `post_raw` - (Optional) Use to populate the RAW POST data field on the test. | 56 | * `post_raw` - (Optional) Use to populate the RAW POST data field on the test. |