aboutsummaryrefslogtreecommitdiffhomepage
path: root/resource_statuscaketest.go
diff options
context:
space:
mode:
Diffstat (limited to 'resource_statuscaketest.go')
-rw-r--r--resource_statuscaketest.go26
1 files changed, 22 insertions, 4 deletions
diff --git a/resource_statuscaketest.go b/resource_statuscaketest.go
index a1d7354..0cdc76d 100644
--- a/resource_statuscaketest.go
+++ b/resource_statuscaketest.go
@@ -58,6 +58,10 @@ func resourceStatusCakeTest() *schema.Resource {
58 Type: schema.TypeInt, 58 Type: schema.TypeInt,
59 Computed: true, 59 Computed: true,
60 }, 60 },
61 "confirmations": &schema.Schema{
62 Type: schema.TypeInt,
63 Optional: true,
64 },
61 }, 65 },
62 } 66 }
63} 67}
@@ -66,10 +70,14 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
66 client := meta.(*statuscake.Client) 70 client := meta.(*statuscake.Client)
67 71
68 newTest := &statuscake.Test{ 72 newTest := &statuscake.Test{
69 WebsiteName: d.Get("website_name").(string), 73 WebsiteName: d.Get("website_name").(string),
70 WebsiteURL: d.Get("website_url").(string), 74 WebsiteURL: d.Get("website_url").(string),
71 TestType: d.Get("test_type").(string), 75 CheckRate: d.Get("check_rate").(int),
72 CheckRate: d.Get("check_rate").(int), 76 TestType: d.Get("test_type").(string),
77 Paused: d.Get("paused").(bool),
78 Timeout: d.Get("timeout").(int),
79 ContactID: d.Get("contact_id").(int),
80 Confirmation: d.Get("confirmations").(int),
73 } 81 }
74 82
75 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string)) 83 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string))
@@ -125,7 +133,14 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
125 if err != nil { 133 if err != nil {
126 return fmt.Errorf("Error Getting StatusCake Test Details for %s: Error: %s", d.Id(), err) 134 return fmt.Errorf("Error Getting StatusCake Test Details for %s: Error: %s", d.Id(), err)
127 } 135 }
136 d.Set("website_name", testResp.WebsiteName)
137 d.Set("website_url", testResp.WebsiteURL)
128 d.Set("check_rate", testResp.CheckRate) 138 d.Set("check_rate", testResp.CheckRate)
139 d.Set("test_type", testResp.TestType)
140 d.Set("paused", testResp.Paused)
141 d.Set("timeout", testResp.Timeout)
142 d.Set("contact_id", testResp.ContactID)
143 d.Set("confirmations", testResp.Confirmation)
129 144
130 return nil 145 return nil
131} 146}
@@ -162,5 +177,8 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
162 if v, ok := d.GetOk("contact_id"); ok { 177 if v, ok := d.GetOk("contact_id"); ok {
163 test.ContactID = v.(int) 178 test.ContactID = v.(int)
164 } 179 }
180 if v, ok := d.GetOk("confirmations"); ok {
181 test.Confirmation = v.(int)
182 }
165 return test 183 return test
166} 184}