From e49c367236f06ef212bdd8d1ec03b86aba058a68 Mon Sep 17 00:00:00 2001 From: Trevor Rosen Date: Mon, 16 Dec 2019 09:58:06 -0600 Subject: [PATCH] Update to 0.5.1 --- Gopkg.lock | 6 +-- Gopkg.toml | 2 +- .../appoptics/appoptics-api-go/alerts.go | 2 +- .../appoptics/appoptics-api-go/client.go | 37 +++++++------------ 4 files changed, 18 insertions(+), 29 deletions(-) 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