From 24c95871c559e4d0a284f4c245d6e7afaeb5b9a7 Mon Sep 17 00:00:00 2001 From: Ivan Schwarz Date: Fri, 14 Jun 2019 15:41:14 +0200 Subject: Update client dependency --- go.mod | 2 +- go.sum | 4 +- .../github.com/DreamItGetIT/statuscake/.gitignore | 1 + .../github.com/DreamItGetIT/statuscake/.travis.yml | 14 +++++++ .../github.com/DreamItGetIT/statuscake/Gopkg.lock | 48 ++++++++++++++++++++++ .../github.com/DreamItGetIT/statuscake/Gopkg.toml | 38 +++++++++++++++++ .../github.com/DreamItGetIT/statuscake/README.md | 2 + vendor/github.com/DreamItGetIT/statuscake/doc.go | 12 +++++- vendor/github.com/DreamItGetIT/statuscake/makefile | 6 ++- .../DreamItGetIT/statuscake/responses.go | 2 + vendor/github.com/DreamItGetIT/statuscake/tests.go | 29 ++++++++++--- vendor/modules.txt | 2 +- 12 files changed, 148 insertions(+), 12 deletions(-) create mode 100644 vendor/github.com/DreamItGetIT/statuscake/.gitignore create mode 100644 vendor/github.com/DreamItGetIT/statuscake/.travis.yml create mode 100644 vendor/github.com/DreamItGetIT/statuscake/Gopkg.lock create mode 100644 vendor/github.com/DreamItGetIT/statuscake/Gopkg.toml diff --git a/go.mod b/go.mod index 5374fe2..d999246 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/terraform-providers/terraform-provider-statuscake require ( - github.com/DreamItGetIT/statuscake v0.0.0-20180728152938-85edefcbdaa3 + github.com/DreamItGetIT/statuscake v0.0.0-20190218105717-471b24d8edfb github.com/hashicorp/terraform v0.12.0 ) diff --git a/go.sum b/go.sum index 769c88e..cc8f846 100644 --- a/go.sum +++ b/go.sum @@ -17,8 +17,8 @@ github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzS github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022 h1:y8Gs8CzNfDF5AZvjr+5UyGQvQEBL7pwo+v+wX6q9JI8= github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/DreamItGetIT/statuscake v0.0.0-20180728152938-85edefcbdaa3 h1:BmnYSwnNifByVfy5Yp3AxiEWAS4EkzK0Cu6/Rh/7mu4= -github.com/DreamItGetIT/statuscake v0.0.0-20180728152938-85edefcbdaa3/go.mod h1:OclNh7ZacJo61GDJablmsOZ7l8/AVtzGqP8G7baOdAs= +github.com/DreamItGetIT/statuscake v0.0.0-20190218105717-471b24d8edfb h1:vJ3lnCyZNmSV/OKyw4d7GuZHFrUaa3FY6/NqtvRE0lw= +github.com/DreamItGetIT/statuscake v0.0.0-20190218105717-471b24d8edfb/go.mod h1:OclNh7ZacJo61GDJablmsOZ7l8/AVtzGqP8G7baOdAs= github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292 h1:tuQ7w+my8a8mkwN7x2TSd7OzTjkZ7rAeSyH4xncuAMI= github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= diff --git a/vendor/github.com/DreamItGetIT/statuscake/.gitignore b/vendor/github.com/DreamItGetIT/statuscake/.gitignore new file mode 100644 index 0000000..22d0d82 --- /dev/null +++ b/vendor/github.com/DreamItGetIT/statuscake/.gitignore @@ -0,0 +1 @@ +vendor diff --git a/vendor/github.com/DreamItGetIT/statuscake/.travis.yml b/vendor/github.com/DreamItGetIT/statuscake/.travis.yml new file mode 100644 index 0000000..c7bad4e --- /dev/null +++ b/vendor/github.com/DreamItGetIT/statuscake/.travis.yml @@ -0,0 +1,14 @@ +language: go +go: + - "1.x" + +env: + - DEP_VERSION="0.5.0" + +before_install: + # Install dep + - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep + - chmod +x $GOPATH/bin/dep + + # Install golint + - go get golang.org/x/lint/golint diff --git a/vendor/github.com/DreamItGetIT/statuscake/Gopkg.lock b/vendor/github.com/DreamItGetIT/statuscake/Gopkg.lock new file mode 100644 index 0000000..c5b189e --- /dev/null +++ b/vendor/github.com/DreamItGetIT/statuscake/Gopkg.lock @@ -0,0 +1,48 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + digest = "1:27dce89d419e7be582ae735623fb0b538012e62b08a87c0308c3b360de2a74b0" + name = "github.com/DreamItGetIT/statuscake" + packages = ["."] + pruneopts = "UT" + revision = "49ae6aae1769b896774d7e860e620f1bd8221355" + +[[projects]] + digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" + name = "github.com/davecgh/go-spew" + packages = ["spew"] + pruneopts = "UT" + revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" + version = "v1.1.1" + +[[projects]] + digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe" + name = "github.com/pmezard/go-difflib" + packages = ["difflib"] + pruneopts = "UT" + revision = "792786c7400a136282c1664665ae0a8db921c6c2" + version = "v1.0.0" + +[[projects]] + digest = "1:c40d65817cdd41fac9aa7af8bed56927bb2d6d47e4fea566a74880f5c2b1c41e" + name = "github.com/stretchr/testify" + packages = [ + "assert", + "require", + ] + pruneopts = "UT" + revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686" + version = "v1.2.2" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + input-imports = [ + "github.com/DreamItGetIT/statuscake", + "github.com/stretchr/testify/assert", + "github.com/stretchr/testify/require", + ] + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/DreamItGetIT/statuscake/Gopkg.toml b/vendor/github.com/DreamItGetIT/statuscake/Gopkg.toml new file mode 100644 index 0000000..b0c1687 --- /dev/null +++ b/vendor/github.com/DreamItGetIT/statuscake/Gopkg.toml @@ -0,0 +1,38 @@ +# Gopkg.toml example +# +# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" +# +# [prune] +# non-go = false +# go-tests = true +# unused-packages = true + + +[[constraint]] + branch = "master" + name = "github.com/DreamItGetIT/statuscake" + +[[constraint]] + name = "github.com/stretchr/testify" + version = "1.2.2" + +[prune] + go-tests = true + unused-packages = true diff --git a/vendor/github.com/DreamItGetIT/statuscake/README.md b/vendor/github.com/DreamItGetIT/statuscake/README.md index f1e4eaf..0806028 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/README.md +++ b/vendor/github.com/DreamItGetIT/statuscake/README.md @@ -1,5 +1,7 @@ # statuscake +[![Build Status](https://travis-ci.org/DreamItGetIT/statuscake.svg?branch=master)](https://travis-ci.org/DreamItGetIT/statuscake) + `statuscake` is a Go pkg that implements a client for the [statuscake]("https://statuscake.com") API. More documentation and examples at [http://godoc.org/github.com/DreamItGetIT/statuscake](http://godoc.org/github.com/DreamItGetIT/statuscake). diff --git a/vendor/github.com/DreamItGetIT/statuscake/doc.go b/vendor/github.com/DreamItGetIT/statuscake/doc.go index fa68d94..d45680e 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/doc.go +++ b/vendor/github.com/DreamItGetIT/statuscake/doc.go @@ -11,6 +11,13 @@ // log.Fatal(err) // } // +// v := url.Values{} +// v.Set("tags", "test1,test2") +// testsWithFilter, err := c.Tests().AllWithFilter(v) +// if err != nil { +// log.Fatal(err) +// } +// // // delete a `Test` // err = c.Tests().Delete(TestID) // @@ -25,7 +32,10 @@ // log.Fatal(err) // } // -// t2 := c.Tests().Update(t) +// t2, err := c.Tests().Update(t) +// if err != nil { +// log.Fatal(err) +// } // fmt.Printf("New Test created with id: %d\n", t2.TestID) // // // get Tests details diff --git a/vendor/github.com/DreamItGetIT/statuscake/makefile b/vendor/github.com/DreamItGetIT/statuscake/makefile index 946f6d9..6149bbf 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/makefile +++ b/vendor/github.com/DreamItGetIT/statuscake/makefile @@ -1,6 +1,6 @@ -.PHONY: default lint test +.PHONY: default deps lint test -default: lint test +default: deps lint test lint: @golint ./... @@ -9,3 +9,5 @@ lint: test: go test ${GOTEST_ARGS} ./... +deps: + dep ensure \ No newline at end of file diff --git a/vendor/github.com/DreamItGetIT/statuscake/responses.go b/vendor/github.com/DreamItGetIT/statuscake/responses.go index e8d4af4..ec74a63 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/responses.go +++ b/vendor/github.com/DreamItGetIT/statuscake/responses.go @@ -61,6 +61,7 @@ type detailResponse struct { UseJar int `json:"UseJar"` PostRaw string `json:"PostRaw"` FinalEndpoint string `json:"FinalEndpoint"` + EnableSSLWarning bool `json:"EnableSSLWarning"` FollowRedirect bool `json:"FollowRedirect"` StatusCodes []string `json:"StatusCodes"` } @@ -96,6 +97,7 @@ func (d *detailResponse) test() *Test { UseJar: d.UseJar, PostRaw: d.PostRaw, FinalEndpoint: d.FinalEndpoint, + EnableSSLAlert: d.EnableSSLWarning, FollowRedirect: d.FollowRedirect, StatusCodes: strings.Join(d.StatusCodes[:], ","), } diff --git a/vendor/github.com/DreamItGetIT/statuscake/tests.go b/vendor/github.com/DreamItGetIT/statuscake/tests.go index c6e6dd2..2a2383d 100644 --- a/vendor/github.com/DreamItGetIT/statuscake/tests.go +++ b/vendor/github.com/DreamItGetIT/statuscake/tests.go @@ -42,7 +42,7 @@ type Test struct { // Current status at last test Status string `json:"Status"` - // 7 Day Uptime + // 1 Day Uptime Uptime float64 `json:"Uptime"` // Any test locations seperated by a comma (using the Node Location IDs) @@ -75,7 +75,7 @@ type Test struct { Branding int `json:"Branding" querystring:"Branding"` // Used internally by the statuscake API - WebsiteHost string `json:"WebsiteHost"` + WebsiteHost string `json:"WebsiteHost" querystring:"WebsiteHost"` // Enable virus checking or not. 1 to enable Virus int `json:"Virus" querystring:"Virus"` @@ -110,6 +110,9 @@ type Test struct { // Use to specify the expected Final URL in the testing process FinalEndpoint string `json:"FinalEndpoint" querystring:"FinalEndpoint"` + // Use to enable SSL validation + EnableSSLAlert bool `json:"EnableSSLAlert" querystring:"EnableSSLAlert"` + // Use to specify whether redirects should be followed FollowRedirect bool `json:"FollowRedirect" querystring:"FollowRedirect"` } @@ -166,9 +169,11 @@ func (t *Test) Validate() error { e["FinalEndpoint"] = "must be a Valid URL" } - var jsonVerifiable map[string]interface{} - if json.Unmarshal([]byte(t.CustomHeader), &jsonVerifiable) != nil { - e["CustomHeader"] = "must be provided as json string" + if t.CustomHeader != "" { + var jsonVerifiable map[string]interface{} + if json.Unmarshal([]byte(t.CustomHeader), &jsonVerifiable) != nil { + e["CustomHeader"] = "must be provided as json string" + } } if len(e) > 0 { @@ -244,6 +249,7 @@ func valueToQueryStringValue(v reflect.Value) string { // Tests is a client that implements the `Tests` API. type Tests interface { All() ([]*Test, error) + AllWithFilter(url.Values) ([]*Test, error) Detail(int) (*Test, error) Update(*Test) (*Test, error) Delete(TestID int) error @@ -272,6 +278,19 @@ func (tt *tests) All() ([]*Test, error) { return tests, err } +func (tt *tests) AllWithFilter(filterOptions url.Values) ([]*Test, error) { + resp, err := tt.client.get("/Tests", filterOptions) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + var tests []*Test + err = json.NewDecoder(resp.Body).Decode(&tests) + + return tests, err +} + func (tt *tests) Update(t *Test) (*Test, error) { resp, err := tt.client.put("/Tests/Update", t.ToURLValues()) if err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index e083517..b1009a7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -6,7 +6,7 @@ cloud.google.com/go/internal/optional cloud.google.com/go/internal/trace cloud.google.com/go/internal/version cloud.google.com/go/compute/metadata -# github.com/DreamItGetIT/statuscake v0.0.0-20180728152938-85edefcbdaa3 +# github.com/DreamItGetIT/statuscake v0.0.0-20190218105717-471b24d8edfb github.com/DreamItGetIT/statuscake # github.com/agext/levenshtein v1.2.2 github.com/agext/levenshtein -- cgit v1.2.3 From 31ca64bb28cb66f0b41661afe66b6811254ef09e Mon Sep 17 00:00:00 2001 From: Ivan Schwarz Date: Fri, 14 Jun 2019 15:55:36 +0200 Subject: Add enable_ssl_alert feature for uptime tests --- statuscake/resource_statuscaketest.go | 11 +++++++++++ statuscake/resource_statuscaketest_test.go | 4 ++++ website/docs/r/test.html.markdown | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go index b062456..d32a870 100644 --- a/statuscake/resource_statuscaketest.go +++ b/statuscake/resource_statuscaketest.go @@ -215,6 +215,12 @@ func resourceStatusCakeTest() *schema.Resource { Optional: true, }, + "enable_ssl_alert": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "follow_redirect": { Type: schema.TypeBool, Optional: true, @@ -257,6 +263,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error { UseJar: d.Get("use_jar").(int), PostRaw: d.Get("post_raw").(string), FinalEndpoint: d.Get("final_endpoint").(string), + EnableSSLAlert: d.Get("enable_ssl_alert").(bool), FollowRedirect: d.Get("follow_redirect").(bool), } @@ -354,6 +361,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error { d.Set("use_jar", testResp.UseJar) d.Set("post_raw", testResp.PostRaw) d.Set("final_endpoint", testResp.FinalEndpoint) + d.Set("enable_ssl_alert", testResp.EnableSSLAlert) d.Set("follow_redirect", testResp.FollowRedirect) return nil @@ -456,6 +464,9 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test { if v, ok := d.GetOk("final_endpoint"); ok { test.FinalEndpoint = v.(string) } + if v, ok := d.GetOk("enable_ssl_alert"); ok { + test.EnableSSLAlert = v.(bool) + } if v, ok := d.GetOk("follow_redirect"); ok { test.FollowRedirect = v.(bool) } diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go index bd609d8..71362f7 100644 --- a/statuscake/resource_statuscaketest_test.go +++ b/statuscake/resource_statuscaketest_test.go @@ -114,6 +114,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) { resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), resource.TestCheckResourceAttr("statuscake_test.google", "final_endpoint", "string10781"), + resource.TestCheckResourceAttr("statuscake_test.google", "enable_ssl_alert", "false"), resource.TestCheckResourceAttr("statuscake_test.google", "follow_redirect", "true"), ), }, @@ -213,6 +214,8 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC err = check(key, value, test.PostRaw) case "final_endpoint": err = check(key, value, test.FinalEndpoint) + case "enable_ssl_alert": + err = check(key, value, strconv.FormatBool(test.EnableSSLAlert)) case "follow_redirect": err = check(key, value, strconv.FormatBool(test.FollowRedirect)) } @@ -297,6 +300,7 @@ resource "statuscake_test" "google" { use_jar = 1 post_raw = "string32096" final_endpoint = "string10781" + enable_ssl_alert = false follow_redirect = true } ` diff --git a/website/docs/r/test.html.markdown b/website/docs/r/test.html.markdown index 6c65f10..f5cc5e0 100644 --- a/website/docs/r/test.html.markdown +++ b/website/docs/r/test.html.markdown @@ -29,8 +29,8 @@ The following arguments are supported: * `website_name` - (Required) This is the name of the test and the website to be monitored. * `website_url` - (Required) The URL of the website to be monitored * `check_rate` - (Optional) Test check rate in seconds. Defaults to 300 -* `contact_id` - **Deprecated** (Optional) The id of the contact group to be added to the test. Each test can have only one. -* `contact_group` - (Optional) Set test contact groups, must be array of strings. +* `contact_id` - **Deprecated** (Optional) The id of the contact group to be added to the test. Each test can have only one. +* `contact_group` - (Optional) Set test contact groups, must be array of strings. * `test_type` - (Required) The type of Test. Either HTTP, TCP, PING, or DNS * `paused` - (Optional) Whether or not the test is paused. Defaults to false. * `timeout` - (Optional) The timeout of the test in seconds. @@ -56,6 +56,7 @@ The following arguments are supported: * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. * `post_raw` - (Optional) Use to populate the RAW POST data field on the test. * `final_endpoint` - (Optional) Use to specify the expected Final URL in the testing process. +* `enable_ssl_alert` - (Optional) HTTP Tests only. If enabled, tests will send warnings if the SSL certificate is about to expire. Paid users only. Default is false * `follow_redirect` - (Optional) Use to specify whether redirects should be followed, set to true to enable. Default is false. ## Attributes Reference -- cgit v1.2.3