From e783b840d0f6de39f16e31dae647d453fd9f1c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Mon, 8 Apr 2019 09:47:25 +0200 Subject: [PATCH] Update go-scalingo dependency to sync with master --- Gopkg.lock | 6 +++--- Gopkg.toml | 2 +- vendor/github.com/Scalingo/go-scalingo/addons.go | 9 +++++++++ vendor/github.com/Scalingo/go-scalingo/client.go | 12 +++++++++--- .../github.com/Scalingo/go-scalingo/http/client.go | 11 ++++++++--- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 98d7b13be..47c8a62c6 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -18,8 +18,8 @@ revision = "97b505dac0c3696d7395d6627494ec105a69280f" [[projects]] - branch = "fix/alerter/93/alert_delay" - digest = "1:ddda362af92839f34031799e4f8a7082f8aa64daec8cbf619de54e215d37170d" + branch = "master" + digest = "1:8073b84ef8d42ac77da66f3a50003b80d513fb6bd95359c3acbc3ac86082497e" name = "github.com/Scalingo/go-scalingo" packages = [ ".", @@ -30,7 +30,7 @@ "io", ] pruneopts = "NUT" - revision = "06bde683a5d67851c7a0dead12c7e84ad6ceaa62" + revision = "b2df3db622c7130c7d7fa8f4d3dec62a6ad2f15f" [[projects]] branch = "master" diff --git a/Gopkg.toml b/Gopkg.toml index 1cadf3827..a182232ae 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -26,7 +26,7 @@ [[constraint]] name = "github.com/Scalingo/go-scalingo" - branch = "fix/alerter/93/alert_delay" + branch = "master" [[constraint]] branch = "master" diff --git a/vendor/github.com/Scalingo/go-scalingo/addons.go b/vendor/github.com/Scalingo/go-scalingo/addons.go index 0fa61a75b..097f591ae 100644 --- a/vendor/github.com/Scalingo/go-scalingo/addons.go +++ b/vendor/github.com/Scalingo/go-scalingo/addons.go @@ -19,12 +19,21 @@ type AddonsService interface { var _ AddonsService = (*Client)(nil) +type AddonStatus string + +const ( + AddonStatusRunning AddonStatus = "running" + AddonStatusProvisioning AddonStatus = "provisioning" + AddonStatusSuspended AddonStatus = "suspended" +) + type Addon struct { ID string `json:"id"` AppID string `json:"app_id"` ResourceID string `json:"resource_id"` PlanID string `json:"plan_id"` AddonProviderID string `json:"addon_provider_id"` + Status AddonStatus `json:"status"` Plan *Plan `json:"plan"` AddonProvider *AddonProvider `json:"addon_provider"` } diff --git a/vendor/github.com/Scalingo/go-scalingo/client.go b/vendor/github.com/Scalingo/go-scalingo/client.go index 6ffeae2d0..92eac2d97 100644 --- a/vendor/github.com/Scalingo/go-scalingo/client.go +++ b/vendor/github.com/Scalingo/go-scalingo/client.go @@ -49,9 +49,12 @@ type Client struct { } type ClientConfig struct { - Timeout time.Duration - TLSConfig *tls.Config - APIToken string + Timeout time.Duration + TLSConfig *tls.Config + APIEndpoint string + AuthEndpoint string + DatabaseAPIEndpoint string + APIToken string } func NewClient(cfg ClientConfig) *Client { @@ -75,6 +78,7 @@ func (c *Client) ScalingoAPI() http.Client { TLSConfig: c.config.TLSConfig, APIVersion: "1", TokenGenerator: tokenGenerator, + Endpoint: c.config.APIEndpoint, }) } @@ -86,6 +90,7 @@ func (c *Client) DBAPI(app, addon string) http.Client { Timeout: c.config.Timeout, TLSConfig: c.config.TLSConfig, TokenGenerator: http.NewAddonTokenGenerator(app, addon, c), + Endpoint: c.config.DatabaseAPIEndpoint, }) } @@ -103,5 +108,6 @@ func (c *Client) AuthAPI() http.Client { TLSConfig: c.config.TLSConfig, APIVersion: "1", TokenGenerator: tokenGenerator, + Endpoint: c.config.AuthEndpoint, }) } diff --git a/vendor/github.com/Scalingo/go-scalingo/http/client.go b/vendor/github.com/Scalingo/go-scalingo/http/client.go index 7076644c0..157f3e233 100644 --- a/vendor/github.com/Scalingo/go-scalingo/http/client.go +++ b/vendor/github.com/Scalingo/go-scalingo/http/client.go @@ -65,6 +65,7 @@ type ClientConfig struct { Timeout time.Duration TLSConfig *tls.Config APIVersion string + Endpoint string TokenGenerator TokenGenerator } @@ -102,6 +103,7 @@ func NewClient(api string, cfg ClientConfig) Client { c := client{ prefix: prefix, + endpoint: cfg.Endpoint, tokenGenerator: cfg.TokenGenerator, apiConfig: config, httpClient: &http.Client{ @@ -221,9 +223,12 @@ func (c *client) TokenGenerator() TokenGenerator { } func (c *client) BaseURL() string { - endpoint := c.apiConfig.DefaultEndpoint - if os.Getenv(c.apiConfig.EnvironmentKey) != "" { - endpoint = os.Getenv(c.apiConfig.EnvironmentKey) + endpoint := c.endpoint + if endpoint == "" { + endpoint = c.apiConfig.DefaultEndpoint + if os.Getenv(c.apiConfig.EnvironmentKey) != "" { + endpoint = os.Getenv(c.apiConfig.EnvironmentKey) + } } if c.prefix != "" {