aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSam Crang <sam.crang@gmail.com>2017-01-13 11:35:15 +0000
committerPaul Stack <public@paulstack.co.uk>2017-01-13 11:35:15 +0000
commitb581540543290cbcd9b0e07ef93fec8b1d24b5c2 (patch)
tree5eabbd479541c2278ea1be507bdbfa98b6e96822
parentc07010769685fd6127e977d9ea7e891773fe75a0 (diff)
downloadterraform-provider-statuscake-b581540543290cbcd9b0e07ef93fec8b1d24b5c2.tar.gz
terraform-provider-statuscake-b581540543290cbcd9b0e07ef93fec8b1d24b5c2.tar.zst
terraform-provider-statuscake-b581540543290cbcd9b0e07ef93fec8b1d24b5c2.zip
Add support for StatusCake confirmation servers (#11179)
* Add support for StatusCake confirmation servers * Add documentation for new StatusCake confirmations argument
-rw-r--r--resource_statuscaketest.go23
-rw-r--r--resource_statuscaketest_test.go4
2 files changed, 20 insertions, 7 deletions
diff --git a/resource_statuscaketest.go b/resource_statuscaketest.go
index 08ace97..6c340d8 100644
--- a/resource_statuscaketest.go
+++ b/resource_statuscaketest.go
@@ -57,6 +57,10 @@ func resourceStatusCakeTest() *schema.Resource {
57 Type: schema.TypeInt, 57 Type: schema.TypeInt,
58 Optional: true, 58 Optional: true,
59 }, 59 },
60 "confirmations": &schema.Schema{
61 Type: schema.TypeInt,
62 Optional: true,
63 },
60 }, 64 },
61 } 65 }
62} 66}
@@ -65,13 +69,14 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
65 client := meta.(*statuscake.Client) 69 client := meta.(*statuscake.Client)
66 70
67 newTest := &statuscake.Test{ 71 newTest := &statuscake.Test{
68 WebsiteName: d.Get("website_name").(string), 72 WebsiteName: d.Get("website_name").(string),
69 WebsiteURL: d.Get("website_url").(string), 73 WebsiteURL: d.Get("website_url").(string),
70 CheckRate: d.Get("check_rate").(int), 74 CheckRate: d.Get("check_rate").(int),
71 TestType: d.Get("test_type").(string), 75 TestType: d.Get("test_type").(string),
72 Paused: d.Get("paused").(bool), 76 Paused: d.Get("paused").(bool),
73 Timeout: d.Get("timeout").(int), 77 Timeout: d.Get("timeout").(int),
74 ContactID: d.Get("contact_id").(int), 78 ContactID: d.Get("contact_id").(int),
79 Confirmation: d.Get("confirmations").(int),
75 } 80 }
76 81
77 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string)) 82 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string))
@@ -134,6 +139,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
134 d.Set("paused", testResp.Paused) 139 d.Set("paused", testResp.Paused)
135 d.Set("timeout", testResp.Timeout) 140 d.Set("timeout", testResp.Timeout)
136 d.Set("contact_id", testResp.ContactID) 141 d.Set("contact_id", testResp.ContactID)
142 d.Set("confirmations", testResp.Confirmation)
137 143
138 return nil 144 return nil
139} 145}
@@ -167,5 +173,8 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
167 if v, ok := d.GetOk("contact_id"); ok { 173 if v, ok := d.GetOk("contact_id"); ok {
168 test.ContactID = v.(int) 174 test.ContactID = v.(int)
169 } 175 }
176 if v, ok := d.GetOk("confirmations"); ok {
177 test.Confirmation = v.(int)
178 }
170 return test 179 return test
171} 180}
diff --git a/resource_statuscaketest_test.go b/resource_statuscaketest_test.go
index de30254..ac3cc92 100644
--- a/resource_statuscaketest_test.go
+++ b/resource_statuscaketest_test.go
@@ -52,6 +52,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) {
52 resource.TestCheckResourceAttr("statuscake_test.google", "check_rate", "500"), 52 resource.TestCheckResourceAttr("statuscake_test.google", "check_rate", "500"),
53 resource.TestCheckResourceAttr("statuscake_test.google", "paused", "true"), 53 resource.TestCheckResourceAttr("statuscake_test.google", "paused", "true"),
54 resource.TestCheckResourceAttr("statuscake_test.google", "contact_id", "0"), 54 resource.TestCheckResourceAttr("statuscake_test.google", "contact_id", "0"),
55 resource.TestCheckResourceAttr("statuscake_test.google", "confirmations", "0"),
55 ), 56 ),
56 }, 57 },
57 }, 58 },
@@ -116,6 +117,8 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC
116 err = check(key, value, strconv.Itoa(test.Timeout)) 117 err = check(key, value, strconv.Itoa(test.Timeout))
117 case "contact_id": 118 case "contact_id":
118 err = check(key, value, strconv.Itoa(test.ContactID)) 119 err = check(key, value, strconv.Itoa(test.ContactID))
120 case "confirmations":
121 err = check(key, value, strconv.Itoa(test.Confirmation))
119 } 122 }
120 123
121 if err != nil { 124 if err != nil {
@@ -145,6 +148,7 @@ resource "statuscake_test" "google" {
145 test_type = "HTTP" 148 test_type = "HTTP"
146 check_rate = 300 149 check_rate = 300
147 contact_id = 12345 150 contact_id = 12345
151 confirmations = 1
148} 152}
149` 153`
150 154