aboutsummaryrefslogtreecommitdiffhomepage
path: root/resource_statuscaketest.go
diff options
context:
space:
mode:
authorRui Gonçalves <ruippeixotog@gmail.com>2017-04-04 16:58:11 +0100
committerstack72 <public@paulstack.co.uk>2017-04-10 15:38:26 +0300
commit0e962b8ebd36cbb0e2f722a1859594b748713d65 (patch)
tree73454a69b62b67f6648aad2ab7297247c81d1e4b /resource_statuscaketest.go
parent2a6605e977ead1c970973bdb3517b20ac99bdc15 (diff)
downloadterraform-provider-statuscake-0e962b8ebd36cbb0e2f722a1859594b748713d65.tar.gz
terraform-provider-statuscake-0e962b8ebd36cbb0e2f722a1859594b748713d65.tar.zst
terraform-provider-statuscake-0e962b8ebd36cbb0e2f722a1859594b748713d65.zip
Add support for StatusCake trigger rate
Diffstat (limited to 'resource_statuscaketest.go')
-rw-r--r--resource_statuscaketest.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/resource_statuscaketest.go b/resource_statuscaketest.go
index 4912758..101ee83 100644
--- a/resource_statuscaketest.go
+++ b/resource_statuscaketest.go
@@ -70,6 +70,12 @@ func resourceStatusCakeTest() *schema.Resource {
70 Type: schema.TypeInt, 70 Type: schema.TypeInt,
71 Optional: true, 71 Optional: true,
72 }, 72 },
73
74 "trigger_rate": {
75 Type: schema.TypeInt,
76 Optional: true,
77 Default: 5,
78 },
73 }, 79 },
74 } 80 }
75} 81}
@@ -87,6 +93,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
87 ContactID: d.Get("contact_id").(int), 93 ContactID: d.Get("contact_id").(int),
88 Confirmation: d.Get("confirmations").(int), 94 Confirmation: d.Get("confirmations").(int),
89 Port: d.Get("port").(int), 95 Port: d.Get("port").(int),
96 TriggerRate: d.Get("trigger_rate").(int),
90 } 97 }
91 98
92 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string)) 99 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string))
@@ -151,6 +158,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
151 d.Set("contact_id", testResp.ContactID) 158 d.Set("contact_id", testResp.ContactID)
152 d.Set("confirmations", testResp.Confirmation) 159 d.Set("confirmations", testResp.Confirmation)
153 d.Set("port", testResp.Port) 160 d.Set("port", testResp.Port)
161 d.Set("trigger_rate", testResp.TriggerRate)
154 162
155 return nil 163 return nil
156} 164}
@@ -193,6 +201,9 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
193 if v, ok := d.GetOk("port"); ok { 201 if v, ok := d.GetOk("port"); ok {
194 test.Port = v.(int) 202 test.Port = v.(int)
195 } 203 }
204 if v, ok := d.GetOk("trigger_rate"); ok {
205 test.TriggerRate = v.(int)
206 }
196 207
197 defaultStatusCodes := "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, " + 208 defaultStatusCodes := "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, " +
198 "408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, " + 209 "408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, " +