diff --git a/Gopkg.lock b/Gopkg.lock index e0693b1..df18914 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -50,12 +50,12 @@ version = "v1.0.0" [[projects]] - digest = "1:9bb1929078c6e8d1857efae76cfa04c1bf692f6747336e204d8a17617be92bee" + digest = "1:3083879473b3880eade76ded4e6c34c9374283dc39e056c6ba54733ff0868567" name = "github.com/appoptics/appoptics-api-go" packages = ["."] pruneopts = "UT" - revision = "69abc66ddf3a4700e4c1400bafdab89ec947259c" - version = "0.3.2" + revision = "948a740c2a0927e5049310e23f6a1beb6f2f1c0a" + version = "0.5.1" [[projects]] digest = "1:c47f4964978e211c6e566596ec6246c329912ea92e9bb99c00798bb4564c5b09" diff --git a/Gopkg.toml b/Gopkg.toml index 56e8bda..b4c4782 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -31,7 +31,7 @@ [[constraint]] name = "github.com/appoptics/appoptics-api-go" - version = ">=0.3.0" + version = ">=0.5.1" [[constraint]] name = "github.com/hashicorp/terraform" diff --git a/vendor/github.com/appoptics/appoptics-api-go/alerts.go b/vendor/github.com/appoptics/appoptics-api-go/alerts.go index bcd4d01..6c3df02 100644 --- a/vendor/github.com/appoptics/appoptics-api-go/alerts.go +++ b/vendor/github.com/appoptics/appoptics-api-go/alerts.go @@ -36,7 +36,7 @@ type AlertCondition struct { ID int `json:"id,omitempty"` Type string `json:"type,omitempty"` MetricName string `json:"metric_name,omitempty"` - Threshold float64 `json:"threshold,omitempty"` + Threshold float64 `json:"threshold"` SummaryFunction string `json:"summary_function,omitempty"` Duration int `json:"duration,omitempty"` DetectReset bool `json:"detect_reset,omitempty"` diff --git a/vendor/github.com/appoptics/appoptics-api-go/client.go b/vendor/github.com/appoptics/appoptics-api-go/client.go index 46c95d7..8cff4f2 100644 --- a/vendor/github.com/appoptics/appoptics-api-go/client.go +++ b/vendor/github.com/appoptics/appoptics-api-go/client.go @@ -18,12 +18,6 @@ import ( log "github.com/sirupsen/logrus" ) -// Version number of this package. -const ( - MajorVersion = 0 - MinorVersion = 2 - PatchVersion = 3 -) const ( // MeasurementPostMaxBatchSize defines the max number of Measurements to send to the API at once @@ -36,17 +30,14 @@ const ( ) var ( - // Version is the current version of this httpClient - regexpIllegalNameChars = regexp.MustCompile("[^A-Za-z0-9.:_-]") // from https://www.AppOptics.com/docs/api/#measurements // ErrBadStatus is returned if the AppOptics API returns a non-200 error code. ErrBadStatus = errors.New("Received non-OK status from AppOptics POST") + client = &http.Client{ + Timeout: 30 * time.Second, + } ) -func Version() string { - return fmt.Sprintf("%d.%d.%d", MajorVersion, MinorVersion, PatchVersion) -} - // ServiceAccessor defines an interface for talking to via domain-specific service constructs type ServiceAccessor interface { AlertsService() AlertsCommunicator @@ -117,13 +108,7 @@ func NewClient(token string, opts ...func(*Client) error) *Client { c := &Client{ token: token, baseURL: baseURL, - httpClient: &http.Client{ - Timeout: 30 * time.Second, - Transport: &http.Transport{ - MaxIdleConnsPerHost: 4, - IdleConnTimeout: 30 * time.Second, - }, - }, + httpClient: client, } c.alertsService = NewAlertsService(c) @@ -205,6 +190,14 @@ func SetDebugMode() ClientOption { } } +// SetHTTPClient allows the user to provide a custom http.Client configuration +func SetHTTPClient(client *http.Client) ClientOption { + return func(c *Client) error { + c.httpClient = client + return nil + } +} + // AlertsService represents the subset of the API that deals with Alerts func (c *Client) AlertsService() AlertsCommunicator { return c.alertsService @@ -288,10 +281,6 @@ func (c *Client) Do(req *http.Request, respData interface{}) (*http.Response, er defer resp.Body.Close() if respData != nil { - if writer, ok := respData.(io.Writer); ok { - _, err := io.Copy(writer, resp.Body) - return resp, err - } err = json.NewDecoder(resp.Body).Decode(respData) } @@ -309,7 +298,7 @@ func (c *Client) completeUserAgentString() string { // clientVersionString returns the canonical name-and-version string func clientVersionString() string { - return fmt.Sprintf("%s-v%s", clientIdentifier, Version()) + return fmt.Sprintf("%s", clientIdentifier) } // checkError creates an ErrorResponse from the http.Response.Body, if there is one diff --git a/vendor/github.com/appoptics/appoptics-api-go/go.mod b/vendor/github.com/appoptics/appoptics-api-go/go.mod new file mode 100644 index 0000000..9eeec43 --- /dev/null +++ b/vendor/github.com/appoptics/appoptics-api-go/go.mod @@ -0,0 +1,21 @@ +module github.com/appoptics/appoptics-api-go + +go 1.13 + +require ( + github.com/davecgh/go-spew v1.1.0 + github.com/golang/protobuf v1.1.0 + github.com/gorilla/context v1.1.1 + github.com/gorilla/mux v1.6.2 + github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 + github.com/magiconair/properties v1.8.0 + github.com/pmezard/go-difflib v1.0.0 + github.com/sirupsen/logrus v1.0.6 + github.com/stretchr/testify v1.2.2 + golang.org/x/crypto v0.0.0-20180802221240-56440b844dfe + golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a + golang.org/x/sys v0.0.0-20180806082429-34b17bdb4300 + golang.org/x/text v0.3.0 + google.golang.org/genproto v0.0.0-20180731170733-daca94659cb5 + google.golang.org/grpc v1.14.0 +) diff --git a/vendor/github.com/appoptics/appoptics-api-go/go.sum b/vendor/github.com/appoptics/appoptics-api-go/go.sum new file mode 100644 index 0000000..af3aebd --- /dev/null +++ b/vendor/github.com/appoptics/appoptics-api-go/go.sum @@ -0,0 +1,29 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/golang/protobuf v1.1.0 h1:0iH4Ffd/meGoXqF2lSAhZHt8X+cPgkfn/cb6Cce5Vpc= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.0.6 h1:hcP1GmhGigz/O7h1WVUM5KklBp1JoNS9FggWKdj/j3s= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/crypto v0.0.0-20180802221240-56440b844dfe h1:APBCFlxGVQi3YDSHtTbNXRZhDEuz9rrnVPXZA4YbUx8= +golang.org/x/crypto v0.0.0-20180802221240-56440b844dfe/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a h1:8fCF9zjAir2SP3N+axz9xs+0r4V8dqPzqsWO10t8zoo= +golang.org/x/net v0.0.0-20180801234040-f4c29de78a2a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sys v0.0.0-20180806082429-34b17bdb4300 h1:eJa+6+7jje7fOYUrLnwKNR9kcpvLANj1Asw0Ou1pBiI= +golang.org/x/sys v0.0.0-20180806082429-34b17bdb4300/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/genproto v0.0.0-20180731170733-daca94659cb5 h1:2PjFmwzH/sxgW9CRJDlEiwMHO8rOk1eMDzVL14HC1e4= +google.golang.org/genproto v0.0.0-20180731170733-daca94659cb5/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.14.0 h1:ArxJuB1NWfPY6r9Gp9gqwplT0Ge7nqv9msgu03lHLmo= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=