diff --git a/CHANGELOG.md b/CHANGELOG.md index db90454e..b17b6310 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## To Be Released +* feat(http): add X-Request-ID if ID is in the context [#262](https://github.com/Scalingo/go-scalingo/pull/262) * refactor(events): moved addons related events to events_addon.go [#261](https://github.com/Scalingo/go-scalingo/pull/261) * refactor(events): moved direct app related events to events_app.go [#260](https://github.com/Scalingo/go-scalingo/pull/260) * feat(events): implement two factor auth related events [#259](https://github.com/Scalingo/go-scalingo/pull/259) diff --git a/addons.go b/addons.go index e64379a7..2c58858b 100644 --- a/addons.go +++ b/addons.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "io" "strconv" @@ -12,13 +13,13 @@ import ( ) type AddonsService interface { - AddonsList(app string) ([]*Addon, error) - AddonProvision(app string, params AddonProvisionParams) (AddonRes, error) - AddonDestroy(app, addonID string) error - AddonUpgrade(app, addonID string, params AddonUpgradeParams) (AddonRes, error) - AddonToken(app, addonID string) (string, error) - AddonLogsURL(app, addonID string) (string, error) - AddonLogsArchives(app, addonId string, page int) (*LogsArchivesResponse, error) + AddonsList(ctx context.Context, app string) ([]*Addon, error) + AddonProvision(ctx context.Context, app string, params AddonProvisionParams) (AddonRes, error) + AddonDestroy(ctx context.Context, app, addonID string) error + AddonUpgrade(ctx context.Context, app, addonID string, params AddonUpgradeParams) (AddonRes, error) + AddonToken(ctx context.Context, app, addonID string) (string, error) + AddonLogsURL(ctx context.Context, app, addonID string) (string, error) + AddonLogsArchives(ctx context.Context, app, addonID string, page int) (*LogsArchivesResponse, error) } var _ AddonsService = (*Client)(nil) @@ -63,19 +64,19 @@ type AddonLogsURLRes struct { URL string `json:"url"` } -func (c *Client) AddonsList(app string) ([]*Addon, error) { +func (c *Client) AddonsList(ctx context.Context, app string) ([]*Addon, error) { var addonsRes AddonsRes - err := c.ScalingoAPI().SubresourceList("apps", app, "addons", nil, &addonsRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "addons", nil, &addonsRes) if err != nil { return nil, errgo.Mask(err, errgo.Any) } return addonsRes.Addons, nil } -func (c *Client) AddonShow(app, addonID string) (Addon, error) { +func (c *Client) AddonShow(ctx context.Context, app, addonID string) (Addon, error) { var addonRes AddonRes - err := c.ScalingoAPI().SubresourceGet("apps", app, "addons", addonID, nil, &addonRes) + err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "addons", addonID, nil, &addonRes) if err != nil { return Addon{}, errgo.Mask(err, errgo.Any) } @@ -94,17 +95,17 @@ type AddonProvisionParamsWrapper struct { Addon AddonProvisionParams `json:"addon"` } -func (c *Client) AddonProvision(app string, params AddonProvisionParams) (AddonRes, error) { +func (c *Client) AddonProvision(ctx context.Context, app string, params AddonProvisionParams) (AddonRes, error) { var addonRes AddonRes - err := c.ScalingoAPI().SubresourceAdd("apps", app, "addons", AddonProvisionParamsWrapper{params}, &addonRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "addons", AddonProvisionParamsWrapper{params}, &addonRes) if err != nil { return AddonRes{}, errgo.Mask(err, errgo.Any) } return addonRes, nil } -func (c *Client) AddonDestroy(app, addonID string) error { - return c.ScalingoAPI().SubresourceDelete("apps", app, "addons", addonID) +func (c *Client) AddonDestroy(ctx context.Context, app, addonID string) error { + return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "addons", addonID) } type AddonUpgradeParams struct { @@ -115,10 +116,10 @@ type AddonUpgradeParamsWrapper struct { Addon AddonUpgradeParams `json:"addon"` } -func (c *Client) AddonUpgrade(app, addonID string, params AddonUpgradeParams) (AddonRes, error) { +func (c *Client) AddonUpgrade(ctx context.Context, app, addonID string, params AddonUpgradeParams) (AddonRes, error) { var addonRes AddonRes err := c.ScalingoAPI().SubresourceUpdate( - "apps", app, "addons", addonID, + ctx, "apps", app, "addons", addonID, AddonUpgradeParamsWrapper{Addon: params}, &addonRes, ) if err != nil { @@ -127,9 +128,9 @@ func (c *Client) AddonUpgrade(app, addonID string, params AddonUpgradeParams) (A return addonRes, nil } -func (c *Client) AddonToken(app, addonID string) (string, error) { +func (c *Client) AddonToken(ctx context.Context, app, addonID string) (string, error) { var res AddonTokenRes - err := c.ScalingoAPI().DoRequest(&http.APIRequest{ + err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/addons/" + addonID + "/token", }, &res) @@ -140,9 +141,9 @@ func (c *Client) AddonToken(app, addonID string) (string, error) { return res.Addon.Token, nil } -func (c *Client) AddonLogsURL(app, addonID string) (string, error) { +func (c *Client) AddonLogsURL(ctx context.Context, app, addonID string) (string, error) { var url AddonLogsURLRes - res, err := c.DBAPI(app, addonID).Do(&http.APIRequest{ + res, err := c.DBAPI(app, addonID).Do(ctx, &http.APIRequest{ Endpoint: "/databases/" + addonID + "/logs", }) if err != nil { @@ -158,8 +159,8 @@ func (c *Client) AddonLogsURL(app, addonID string) (string, error) { return url.URL, nil } -func (c *Client) AddonLogsArchives(app, addonID string, page int) (*LogsArchivesResponse, error) { - res, err := c.DBAPI(app, addonID).Do(&http.APIRequest{ +func (c *Client) AddonLogsArchives(ctx context.Context, app, addonID string, page int) (*LogsArchivesResponse, error) { + res, err := c.DBAPI(app, addonID).Do(ctx, &http.APIRequest{ Endpoint: "/databases/" + addonID + "/logs_archives", Params: map[string]string{ "page": strconv.FormatInt(int64(page), 10), @@ -168,6 +169,7 @@ func (c *Client) AddonLogsArchives(app, addonID string, page int) (*LogsArchives if err != nil { return nil, errgo.Notef(err, "fail to get log archives") } + defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { diff --git a/addons_providers.go b/addons_providers.go index 36a2420a..01cef767 100644 --- a/addons_providers.go +++ b/addons_providers.go @@ -1,14 +1,16 @@ package scalingo import ( + "context" + "gopkg.in/errgo.v1" "github.com/Scalingo/go-scalingo/v4/http" ) type AddonProvidersService interface { - AddonProvidersList() ([]*AddonProvider, error) - AddonProviderPlansList(addon string) ([]*Plan, error) + AddonProvidersList(context.Context) ([]*AddonProvider, error) + AddonProviderPlansList(ctx context.Context, addon string) ([]*Plan, error) } var _ AddonProvidersService = (*Client)(nil) @@ -37,13 +39,13 @@ type ListParams struct { AddonProviders []*AddonProvider `json:"addon_providers"` } -func (c *Client) AddonProvidersList() ([]*AddonProvider, error) { +func (c *Client) AddonProvidersList(ctx context.Context) ([]*AddonProvider, error) { req := &http.APIRequest{ NoAuth: true, Endpoint: "/addon_providers", } var params ListParams - err := c.ScalingoAPI().DoRequest(req, ¶ms) + err := c.ScalingoAPI().DoRequest(ctx, req, ¶ms) if err != nil { return nil, errgo.Mask(err) } @@ -60,7 +62,7 @@ var addonProviderTypo = map[string]string{ "scalingo-psql": "scalingo-postgresql", } -func (c *Client) AddonProviderPlansList(addon string) ([]*Plan, error) { +func (c *Client) AddonProviderPlansList(ctx context.Context, addon string) ([]*Plan, error) { correctAddon, ok := addonProviderTypo[addon] if ok { addon = correctAddon @@ -71,7 +73,7 @@ func (c *Client) AddonProviderPlansList(addon string) ([]*Plan, error) { NoAuth: true, Endpoint: "/addon_providers/" + addon + "/plans", } - err := c.ScalingoAPI().DoRequest(req, ¶ms) + err := c.ScalingoAPI().DoRequest(ctx, req, ¶ms) if err != nil { return nil, errgo.Notef(err, "fail to get plans") } diff --git a/alerts.go b/alerts.go index 1ad74014..a494c07c 100644 --- a/alerts.go +++ b/alerts.go @@ -1,17 +1,18 @@ package scalingo import ( + "context" "time" "gopkg.in/errgo.v1" ) type AlertsService interface { - AlertsList(app string) ([]*Alert, error) - AlertAdd(app string, params AlertAddParams) (*Alert, error) - AlertShow(app, id string) (*Alert, error) - AlertUpdate(app, id string, params AlertUpdateParams) (*Alert, error) - AlertRemove(app, id string) error + AlertsList(ctx context.Context, app string) ([]*Alert, error) + AlertAdd(ctx context.Context, app string, params AlertAddParams) (*Alert, error) + AlertShow(ctx context.Context, app, id string) (*Alert, error) + AlertUpdate(ctx context.Context, app, id string, params AlertUpdateParams) (*Alert, error) + AlertRemove(ctx context.Context, app, id string) error } var _ AlertsService = (*Client)(nil) @@ -36,9 +37,9 @@ type AlertRes struct { Alert *Alert `json:"alert"` } -func (c *Client) AlertsList(app string) ([]*Alert, error) { +func (c *Client) AlertsList(ctx context.Context, app string) ([]*Alert, error) { var alertsRes AlertsRes - err := c.ScalingoAPI().SubresourceList("apps", app, "alerts", nil, &alertsRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "alerts", nil, &alertsRes) if err != nil { return nil, errgo.Notef(err, "fail to query the API to list an alert") } @@ -55,7 +56,7 @@ type AlertAddParams struct { Notifiers []string } -func (c *Client) AlertAdd(app string, params AlertAddParams) (*Alert, error) { +func (c *Client) AlertAdd(ctx context.Context, app string, params AlertAddParams) (*Alert, error) { var alertRes AlertRes a := &Alert{ ContainerType: params.ContainerType, @@ -69,7 +70,7 @@ func (c *Client) AlertAdd(app string, params AlertAddParams) (*Alert, error) { if params.DurationBeforeTrigger != nil { a.DurationBeforeTrigger = *params.DurationBeforeTrigger } - err := c.ScalingoAPI().SubresourceAdd("apps", app, "alerts", AlertRes{ + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "alerts", AlertRes{ Alert: a, }, &alertRes) if err != nil { @@ -78,9 +79,9 @@ func (c *Client) AlertAdd(app string, params AlertAddParams) (*Alert, error) { return alertRes.Alert, nil } -func (c *Client) AlertShow(app, id string) (*Alert, error) { +func (c *Client) AlertShow(ctx context.Context, app, id string) (*Alert, error) { var alertRes AlertRes - err := c.ScalingoAPI().SubresourceGet("apps", app, "alerts", id, nil, &alertRes) + err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "alerts", id, nil, &alertRes) if err != nil { return nil, errgo.Notef(err, "fail to query the API to show an alert") } @@ -98,17 +99,17 @@ type AlertUpdateParams struct { Notifiers *[]string `json:"notifiers,omitempty"` } -func (c *Client) AlertUpdate(app, id string, params AlertUpdateParams) (*Alert, error) { +func (c *Client) AlertUpdate(ctx context.Context, app, id string, params AlertUpdateParams) (*Alert, error) { var alertRes AlertRes - err := c.ScalingoAPI().SubresourceUpdate("apps", app, "alerts", id, params, &alertRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "alerts", id, params, &alertRes) if err != nil { return nil, errgo.Notef(err, "fail to query the API to update an alert") } return alertRes.Alert, nil } -func (c *Client) AlertRemove(app, id string) error { - err := c.ScalingoAPI().SubresourceDelete("apps", app, "alerts", id) +func (c *Client) AlertRemove(ctx context.Context, app, id string) error { + err := c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "alerts", id) if err != nil { return errgo.Notef(err, "fail to query the API to remove an alert") } diff --git a/alerts_test.go b/alerts_test.go index 9b4629f0..221136b5 100644 --- a/alerts_test.go +++ b/alerts_test.go @@ -1,17 +1,19 @@ package scalingo import ( + "context" "encoding/json" "net/http" "net/http/httptest" "testing" - gomock "github.com/golang/mock/gomock" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestAlertsClient(t *testing.T) { + ctx := context.Background() appName := "my-app" alertID := "my-id" @@ -27,7 +29,7 @@ func TestAlertsClient(t *testing.T) { { action: "list", testedClientCall: func(c AlertsService) error { - _, err := c.AlertsList(appName) + _, err := c.AlertsList(ctx, appName) return err }, expectedEndpoint: "/v1/apps/my-app/alerts", @@ -37,7 +39,7 @@ func TestAlertsClient(t *testing.T) { { action: "add", testedClientCall: func(c AlertsService) error { - _, err := c.AlertAdd(appName, AlertAddParams{}) + _, err := c.AlertAdd(ctx, appName, AlertAddParams{}) return err }, expectedEndpoint: "/v1/apps/my-app/alerts", @@ -48,7 +50,7 @@ func TestAlertsClient(t *testing.T) { { action: "show", testedClientCall: func(c AlertsService) error { - _, err := c.AlertShow(appName, alertID) + _, err := c.AlertShow(ctx, appName, alertID) return err }, expectedEndpoint: "/v1/apps/my-app/alerts/my-id", @@ -58,7 +60,7 @@ func TestAlertsClient(t *testing.T) { { action: "update", testedClientCall: func(c AlertsService) error { - _, err := c.AlertUpdate(appName, alertID, AlertUpdateParams{}) + _, err := c.AlertUpdate(ctx, appName, alertID, AlertUpdateParams{}) return err }, expectedEndpoint: "/v1/apps/my-app/alerts/my-id", @@ -68,7 +70,7 @@ func TestAlertsClient(t *testing.T) { { action: "remove", testedClientCall: func(c AlertsService) error { - return c.AlertRemove(appName, alertID) + return c.AlertRemove(ctx, appName, alertID) }, expectedEndpoint: "/v1/apps/my-app/alerts/my-id", expectedMethod: "DELETE", @@ -109,7 +111,7 @@ func TestAlertsClient(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(handler)) defer ts.Close() - c, err := New(ClientConfig{ + c, err := New(ctx, ClientConfig{ APIEndpoint: ts.URL, APIToken: "test", }) diff --git a/apps.go b/apps.go index d489c8fd..ea82652e 100644 --- a/apps.go +++ b/apps.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "net/http" "time" @@ -20,23 +21,23 @@ const ( ) type AppsService interface { - AppsList() ([]*App, error) - AppsShow(appName string) (*App, error) - AppsDestroy(name string, currentName string) error - AppsRename(name string, newName string) (*App, error) - AppsTransfer(name string, email string) (*App, error) - AppsSetStack(name string, stackID string) (*App, error) - AppsRestart(app string, scope *AppsRestartParams) (*http.Response, error) - AppsCreate(opts AppsCreateOpts) (*App, error) - AppsStats(app string) (*AppStatsRes, error) - AppsContainerTypes(app string) ([]ContainerType, error) + AppsList(ctx context.Context) ([]*App, error) + AppsShow(ctx context.Context, appName string) (*App, error) + AppsDestroy(ctx context.Context, name string, currentName string) error + AppsRename(ctx context.Context, name string, newName string) (*App, error) + AppsTransfer(ctx context.Context, name string, email string) (*App, error) + AppsSetStack(ctx context.Context, name string, stackID string) (*App, error) + AppsRestart(ctx context.Context, app string, scope *AppsRestartParams) (*http.Response, error) + AppsCreate(ctx context.Context, opts AppsCreateOpts) (*App, error) + AppsStats(ctx context.Context, app string) (*AppStatsRes, error) + AppsContainerTypes(ctx context.Context, app string) ([]ContainerType, error) // Deprecated: Use AppsContainerTypes instead - AppsPs(app string) ([]ContainerType, error) - AppsContainersPs(app string) ([]Container, error) - AppsScale(app string, params *AppsScaleParams) (*http.Response, error) - AppsForceHTTPS(name string, enable bool) (*App, error) - AppsStickySession(name string, enable bool) (*App, error) - AppsRouterLogs(name string, enable bool) (*App, error) + AppsPs(ctx context.Context, app string) ([]ContainerType, error) + AppsContainersPs(ctx context.Context, app string) ([]Container, error) + AppsScale(ctx context.Context, app string, params *AppsScaleParams) (*http.Response, error) + AppsForceHTTPS(ctx context.Context, name string, enable bool) (*App, error) + AppsStickySession(ctx context.Context, name string, enable bool) (*App, error) + AppsRouterLogs(ctx context.Context, name string, enable bool) (*App, error) } var _ AppsService = (*Client)(nil) @@ -124,26 +125,26 @@ func (app App) String() string { return app.Name } -func (c *Client) AppsList() ([]*App, error) { +func (c *Client) AppsList(ctx context.Context) ([]*App, error) { appsMap := map[string][]*App{} req := &httpclient.APIRequest{ Endpoint: "/apps", } - err := c.ScalingoAPI().DoRequest(req, &appsMap) + err := c.ScalingoAPI().DoRequest(ctx, req, &appsMap) if err != nil { return []*App{}, errgo.Mask(err, errgo.Any) } return appsMap["apps"], nil } -func (c *Client) AppsShow(appName string) (*App, error) { +func (c *Client) AppsShow(ctx context.Context, appName string) (*App, error) { var appMap map[string]*App req := &httpclient.APIRequest{ Endpoint: "/apps/" + appName, } - err := c.ScalingoAPI().DoRequest(req, &appMap) + err := c.ScalingoAPI().DoRequest(ctx, req, &appMap) if err != nil { return nil, errgo.Mask(err, errgo.Any) } @@ -151,7 +152,7 @@ func (c *Client) AppsShow(appName string) (*App, error) { return appMap["app"], nil } -func (c *Client) AppsDestroy(name string, currentName string) error { +func (c *Client) AppsDestroy(ctx context.Context, name string, currentName string) error { req := &httpclient.APIRequest{ Method: "DELETE", Endpoint: "/apps/" + name, @@ -160,7 +161,7 @@ func (c *Client) AppsDestroy(name string, currentName string) error { "current_name": currentName, }, } - err := c.ScalingoAPI().DoRequest(req, nil) + err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { return err } @@ -168,7 +169,7 @@ func (c *Client) AppsDestroy(name string, currentName string) error { return nil } -func (c *Client) AppsRename(name string, newName string) (*App, error) { +func (c *Client) AppsRename(ctx context.Context, name string, newName string) (*App, error) { var appRes *AppResponse req := &httpclient.APIRequest{ Method: "POST", @@ -179,7 +180,7 @@ func (c *Client) AppsRename(name string, newName string) (*App, error) { "new_name": newName, }, } - err := c.ScalingoAPI().DoRequest(req, &appRes) + err := c.ScalingoAPI().DoRequest(ctx, req, &appRes) if err != nil { return nil, err } @@ -187,7 +188,7 @@ func (c *Client) AppsRename(name string, newName string) (*App, error) { return appRes.App, nil } -func (c *Client) AppsTransfer(name string, email string) (*App, error) { +func (c *Client) AppsTransfer(ctx context.Context, name string, email string) (*App, error) { var appRes *AppResponse req := &httpclient.APIRequest{ Method: "PATCH", @@ -199,7 +200,7 @@ func (c *Client) AppsTransfer(name string, email string) (*App, error) { }, }, } - err := c.ScalingoAPI().DoRequest(req, &appRes) + err := c.ScalingoAPI().DoRequest(ctx, req, &appRes) if err != nil { return nil, err } @@ -207,7 +208,7 @@ func (c *Client) AppsTransfer(name string, email string) (*App, error) { return appRes.App, nil } -func (c *Client) AppsSetStack(app string, stackID string) (*App, error) { +func (c *Client) AppsSetStack(ctx context.Context, app string, stackID string) (*App, error) { req := &httpclient.APIRequest{ Method: "PATCH", Endpoint: "/apps/" + app, @@ -220,7 +221,7 @@ func (c *Client) AppsSetStack(app string, stackID string) (*App, error) { } var appRes AppResponse - err := c.ScalingoAPI().DoRequest(req, &appRes) + err := c.ScalingoAPI().DoRequest(ctx, req, &appRes) if err != nil { return nil, errgo.Notef(err, "fail to request Scalingo API") } @@ -228,7 +229,7 @@ func (c *Client) AppsSetStack(app string, stackID string) (*App, error) { return appRes.App, nil } -func (c *Client) AppsRestart(app string, scope *AppsRestartParams) (*http.Response, error) { +func (c *Client) AppsRestart(ctx context.Context, app string, scope *AppsRestartParams) (*http.Response, error) { req := &httpclient.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/restart", @@ -236,10 +237,10 @@ func (c *Client) AppsRestart(app string, scope *AppsRestartParams) (*http.Respon Params: scope, } - return c.ScalingoAPI().Do(req) + return c.ScalingoAPI().Do(ctx, req) } -func (c *Client) AppsCreate(opts AppsCreateOpts) (*App, error) { +func (c *Client) AppsCreate(ctx context.Context, opts AppsCreateOpts) (*App, error) { var appRes *AppResponse req := &httpclient.APIRequest{ Method: "POST", @@ -247,19 +248,19 @@ func (c *Client) AppsCreate(opts AppsCreateOpts) (*App, error) { Expected: httpclient.Statuses{201}, Params: map[string]interface{}{"app": opts}, } - err := c.ScalingoAPI().DoRequest(req, &appRes) + err := c.ScalingoAPI().DoRequest(ctx, req, &appRes) if err != nil { return nil, errgo.Mask(err, errgo.Any) } return appRes.App, nil } -func (c *Client) AppsStats(app string) (*AppStatsRes, error) { +func (c *Client) AppsStats(ctx context.Context, app string) (*AppStatsRes, error) { var stats AppStatsRes req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/stats", } - err := c.ScalingoAPI().DoRequest(req, &stats) + err := c.ScalingoAPI().DoRequest(ctx, req, &stats) if err != nil { return nil, errgo.Mask(err) } @@ -267,16 +268,16 @@ func (c *Client) AppsStats(app string) (*AppStatsRes, error) { } // Deprecated: Use AppsContainerTypes instead -func (c *Client) AppsPs(app string) ([]ContainerType, error) { - return c.AppsContainerTypes(app) +func (c *Client) AppsPs(ctx context.Context, app string) ([]ContainerType, error) { + return c.AppsContainerTypes(ctx, app) } -func (c *Client) AppsContainersPs(app string) ([]Container, error) { +func (c *Client) AppsContainersPs(ctx context.Context, app string) ([]Container, error) { var containersRes AppsPsRes req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/ps", } - err := c.ScalingoAPI().DoRequest(req, &containersRes) + err := c.ScalingoAPI().DoRequest(ctx, req, &containersRes) if err != nil { return nil, errgo.Notef(err, "fail to execute the GET request to list containers") } @@ -284,12 +285,12 @@ func (c *Client) AppsContainersPs(app string) ([]Container, error) { return containersRes.Containers, nil } -func (c *Client) AppsContainerTypes(app string) ([]ContainerType, error) { +func (c *Client) AppsContainerTypes(ctx context.Context, app string) ([]ContainerType, error) { var containerTypesRes AppsContainerTypesRes req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/containers", } - err := c.ScalingoAPI().DoRequest(req, &containerTypesRes) + err := c.ScalingoAPI().DoRequest(ctx, req, &containerTypesRes) if err != nil { return nil, errgo.Notef(err, "fail to execute the GET request to list container types") } @@ -297,7 +298,7 @@ func (c *Client) AppsContainerTypes(app string) ([]ContainerType, error) { return containerTypesRes.Containers, nil } -func (c *Client) AppsScale(app string, params *AppsScaleParams) (*http.Response, error) { +func (c *Client) AppsScale(ctx context.Context, app string, params *AppsScaleParams) (*http.Response, error) { req := &httpclient.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/scale", @@ -306,28 +307,28 @@ func (c *Client) AppsScale(app string, params *AppsScaleParams) (*http.Response, // Otherwise async job is triggered, it's 202 Expected: httpclient.Statuses{200, 202}, } - return c.ScalingoAPI().Do(req) + return c.ScalingoAPI().Do(ctx, req) } -func (c *Client) AppsForceHTTPS(name string, enable bool) (*App, error) { - return c.appsUpdate(name, map[string]interface{}{ +func (c *Client) AppsForceHTTPS(ctx context.Context, name string, enable bool) (*App, error) { + return c.appsUpdate(ctx, name, map[string]interface{}{ "force_https": enable, }) } -func (c *Client) AppsRouterLogs(name string, enable bool) (*App, error) { - return c.appsUpdate(name, map[string]interface{}{ +func (c *Client) AppsRouterLogs(ctx context.Context, name string, enable bool) (*App, error) { + return c.appsUpdate(ctx, name, map[string]interface{}{ "router_logs": enable, }) } -func (c *Client) AppsStickySession(name string, enable bool) (*App, error) { - return c.appsUpdate(name, map[string]interface{}{ +func (c *Client) AppsStickySession(ctx context.Context, name string, enable bool) (*App, error) { + return c.appsUpdate(ctx, name, map[string]interface{}{ "sticky_session": enable, }) } -func (c *Client) appsUpdate(name string, params map[string]interface{}) (*App, error) { +func (c *Client) appsUpdate(ctx context.Context, name string, params map[string]interface{}) (*App, error) { var appRes *AppResponse req := &httpclient.APIRequest{ Method: "PUT", @@ -335,7 +336,7 @@ func (c *Client) appsUpdate(name string, params map[string]interface{}) (*App, e Expected: httpclient.Statuses{200}, Params: params, } - err := c.ScalingoAPI().DoRequest(req, &appRes) + err := c.ScalingoAPI().DoRequest(ctx, req, &appRes) if err != nil { return nil, err } diff --git a/apps_test.go b/apps_test.go index 32719368..024b188c 100644 --- a/apps_test.go +++ b/apps_test.go @@ -2,17 +2,19 @@ package scalingo import ( "bytes" + "context" "encoding/json" "net/http" "net/http/httptest" "testing" - gomock "github.com/golang/mock/gomock" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestAppsClient_Update(t *testing.T) { + ctx := context.Background() appName := "my-app" runs := map[string]struct { @@ -25,7 +27,7 @@ func TestAppsClient_Update(t *testing.T) { }{ "it should enable the app router_logs attribute": { testedClientCall: func(c AppsService) error { - _, err := c.AppsRouterLogs(appName, true) + _, err := c.AppsRouterLogs(ctx, appName, true) return err }, expectedEndpoint: "/v1/apps/my-app", @@ -36,7 +38,7 @@ func TestAppsClient_Update(t *testing.T) { }, "it should disable the app router_logs attribute": { testedClientCall: func(c AppsService) error { - _, err := c.AppsRouterLogs(appName, false) + _, err := c.AppsRouterLogs(ctx, appName, false) return err }, expectedEndpoint: "/v1/apps/my-app", @@ -48,7 +50,7 @@ func TestAppsClient_Update(t *testing.T) { "it should enable the app force_https attribute": { testedClientCall: func(c AppsService) error { - _, err := c.AppsForceHTTPS(appName, true) + _, err := c.AppsForceHTTPS(ctx, appName, true) return err }, expectedEndpoint: "/v1/apps/my-app", @@ -59,7 +61,7 @@ func TestAppsClient_Update(t *testing.T) { }, "it should disable the app force_https attribute": { testedClientCall: func(c AppsService) error { - _, err := c.AppsForceHTTPS(appName, false) + _, err := c.AppsForceHTTPS(ctx, appName, false) return err }, expectedEndpoint: "/v1/apps/my-app", @@ -71,7 +73,7 @@ func TestAppsClient_Update(t *testing.T) { "it should enable the app sticky_session attribute": { testedClientCall: func(c AppsService) error { - _, err := c.AppsStickySession(appName, true) + _, err := c.AppsStickySession(ctx, appName, true) return err }, expectedEndpoint: "/v1/apps/my-app", @@ -82,7 +84,7 @@ func TestAppsClient_Update(t *testing.T) { }, "it should disable the app sticky_session attribute": { testedClientCall: func(c AppsService) error { - _, err := c.AppsStickySession(appName, false) + _, err := c.AppsStickySession(ctx, appName, false) return err }, expectedEndpoint: "/v1/apps/my-app", @@ -116,7 +118,7 @@ func TestAppsClient_Update(t *testing.T) { })) defer ts.Close() - c, err := New(ClientConfig{ + c, err := New(ctx, ClientConfig{ APIEndpoint: ts.URL, APIToken: "test", }) diff --git a/auth_mock.go b/auth_mock.go index f13501ed..1abd1008 100644 --- a/auth_mock.go +++ b/auth_mock.go @@ -2,6 +2,7 @@ package scalingo import ( "bytes" + "context" "fmt" "io" "net/http" @@ -17,7 +18,7 @@ import ( func MockAuth(ctrl *gomock.Controller) *httpmock.MockClient { mock := httpmock.NewMockClient(ctrl) - mock.EXPECT().Do(gomock.Any()).DoAndReturn(func(_ *httpclient.APIRequest) (*http.Response, error) { + mock.EXPECT().Do(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, _ *httpclient.APIRequest) (*http.Response, error) { claims := &jwt.RegisteredClaims{ ExpiresAt: jwt.NewNumericDate(time.Now().Add(5 * time.Minute)), } diff --git a/autoscalers.go b/autoscalers.go index 5038eb6f..0f7a7eb5 100644 --- a/autoscalers.go +++ b/autoscalers.go @@ -1,13 +1,15 @@ package scalingo import ( + "context" + "gopkg.in/errgo.v1" ) type AutoscalersService interface { - AutoscalersList(app string) ([]Autoscaler, error) - AutoscalerAdd(app string, params AutoscalerAddParams) (*Autoscaler, error) - AutoscalerRemove(app string, id string) error + AutoscalersList(ctx context.Context, app string) ([]Autoscaler, error) + AutoscalerAdd(ctx context.Context, app string, params AutoscalerAddParams) (*Autoscaler, error) + AutoscalerRemove(ctx context.Context, app string, id string) error } var _ AutoscalersService = (*Client)(nil) @@ -31,9 +33,9 @@ type AutoscalerRes struct { Autoscaler Autoscaler `json:"autoscaler"` } -func (c *Client) AutoscalersList(app string) ([]Autoscaler, error) { +func (c *Client) AutoscalersList(ctx context.Context, app string) ([]Autoscaler, error) { var autoscalersRes AutoscalersRes - err := c.ScalingoAPI().SubresourceList("apps", app, "autoscalers", nil, &autoscalersRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "autoscalers", nil, &autoscalersRes) if err != nil { return nil, errgo.Mask(err) } @@ -48,9 +50,9 @@ type AutoscalerAddParams struct { MaxContainers int `json:"max_containers"` } -func (c *Client) AutoscalerAdd(app string, params AutoscalerAddParams) (*Autoscaler, error) { +func (c *Client) AutoscalerAdd(ctx context.Context, app string, params AutoscalerAddParams) (*Autoscaler, error) { var autoscalerRes AutoscalerRes - err := c.ScalingoAPI().SubresourceAdd("apps", app, "autoscalers", AutoscalerRes{ + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "autoscalers", AutoscalerRes{ Autoscaler: Autoscaler{ ContainerType: params.ContainerType, Metric: params.Metric, @@ -65,9 +67,9 @@ func (c *Client) AutoscalerAdd(app string, params AutoscalerAddParams) (*Autosca return &autoscalerRes.Autoscaler, nil } -func (c *Client) AutoscalerShow(app, id string) (*Autoscaler, error) { +func (c *Client) AutoscalerShow(ctx context.Context, app, id string) (*Autoscaler, error) { var autoscalerRes AutoscalerRes - err := c.ScalingoAPI().SubresourceGet("apps", app, "autoscalers", id, nil, &autoscalerRes) + err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "autoscalers", id, nil, &autoscalerRes) if err != nil { return nil, errgo.Mask(err) } @@ -82,17 +84,17 @@ type AutoscalerUpdateParams struct { Disabled *bool `json:"disabled,omitempty"` } -func (c *Client) AutoscalerUpdate(app, id string, params AutoscalerUpdateParams) (*Autoscaler, error) { +func (c *Client) AutoscalerUpdate(ctx context.Context, app, id string, params AutoscalerUpdateParams) (*Autoscaler, error) { var autoscalerRes AutoscalerRes - err := c.ScalingoAPI().SubresourceUpdate("apps", app, "autoscalers", id, params, &autoscalerRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "autoscalers", id, params, &autoscalerRes) if err != nil { return nil, errgo.Mask(err) } return &autoscalerRes.Autoscaler, nil } -func (c *Client) AutoscalerRemove(app, id string) error { - err := c.ScalingoAPI().SubresourceDelete("apps", app, "autoscalers", id) +func (c *Client) AutoscalerRemove(ctx context.Context, app, id string) error { + err := c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "autoscalers", id) if err != nil { return errgo.Mask(err) } diff --git a/backups.go b/backups.go index dadb45e1..26b77ac7 100644 --- a/backups.go +++ b/backups.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "time" @@ -10,10 +11,10 @@ import ( ) type BackupsService interface { - BackupList(app, addonID string) ([]Backup, error) - BackupCreate(app, addonID string) (*Backup, error) - BackupShow(app, addonID, backupID string) (*Backup, error) - BackupDownloadURL(app, addonID, backupID string) (string, error) + BackupList(ctx context.Context, app, addonID string) ([]Backup, error) + BackupCreate(ctx context.Context, app, addonID string) (*Backup, error) + BackupShow(ctx context.Context, app, addonID, backupID string) (*Backup, error) + BackupDownloadURL(ctx context.Context, app, addonID, backupID string) (string, error) } type BackupStatus string @@ -47,39 +48,39 @@ type DownloadURLRes struct { DownloadURL string `json:"download_url"` } -func (c *Client) BackupList(app string, addonID string) ([]Backup, error) { +func (c *Client) BackupList(ctx context.Context, app string, addonID string) ([]Backup, error) { var backupRes BackupsRes - err := c.DBAPI(app, addonID).SubresourceList("databases", addonID, "backups", nil, &backupRes) + err := c.DBAPI(app, addonID).SubresourceList(ctx, "databases", addonID, "backups", nil, &backupRes) if err != nil { return nil, errgo.Notef(err, "fail to get backup") } return backupRes.Backups, nil } -func (c *Client) BackupCreate(app, addonID string) (*Backup, error) { +func (c *Client) BackupCreate(ctx context.Context, app, addonID string) (*Backup, error) { var backupRes BackupRes - err := c.DBAPI(app, addonID).SubresourceAdd("databases", addonID, "backups", nil, &backupRes) + err := c.DBAPI(app, addonID).SubresourceAdd(ctx, "databases", addonID, "backups", nil, &backupRes) if err != nil { return nil, errgo.Notef(err, "fail to schedule a new backup") } return &backupRes.Backup, nil } -func (c *Client) BackupShow(app, addonID, backup string) (*Backup, error) { +func (c *Client) BackupShow(ctx context.Context, app, addonID, backup string) (*Backup, error) { var backupRes BackupRes - err := c.DBAPI(app, addonID).ResourceGet("backups", backup, nil, &backupRes) + err := c.DBAPI(app, addonID).ResourceGet(ctx, "backups", backup, nil, &backupRes) if err != nil { return nil, errgo.Notef(err, "fail to get backup") } return &backupRes.Backup, nil } -func (c *Client) BackupDownloadURL(app, addonID, backupID string) (string, error) { +func (c *Client) BackupDownloadURL(ctx context.Context, app, addonID, backupID string) (string, error) { req := &http.APIRequest{ Method: "GET", Endpoint: "/databases/" + addonID + "/backups/" + backupID + "/archive", } - resp, err := c.DBAPI(app, addonID).Do(req) + resp, err := c.DBAPI(app, addonID).Do(ctx, req) if err != nil { return "", errgo.Notef(err, "fail to get backup archive") } diff --git a/client.go b/client.go index dfabc570..3628befc 100644 --- a/client.go +++ b/client.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "crypto/tls" "time" @@ -74,7 +75,7 @@ type ClientConfig struct { StaticTokenGenerator *StaticTokenGenerator } -func New(cfg ClientConfig) (*Client, error) { +func New(ctx context.Context, cfg ClientConfig) (*Client, error) { // Apply defaults if cfg.AuthEndpoint == "" { cfg.AuthEndpoint = "https://auth.scalingo.com" @@ -96,7 +97,7 @@ func New(cfg ClientConfig) (*Client, error) { config: cfg, } - region, err := tmpClient.getRegion(cfg.Region) + region, err := tmpClient.getRegion(ctx, cfg.Region) if err == ErrRegionNotFound { return nil, err } else if err != nil { diff --git a/client_test.go b/client_test.go index 0cce0a4e..a95ba6e4 100644 --- a/client_test.go +++ b/client_test.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "fmt" "net/http" "net/http/httptest" @@ -8,13 +9,15 @@ import ( "testing" "time" - jwt "github.com/golang-jwt/jwt/v4" + "github.com/golang-jwt/jwt/v4" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestNewClient(t *testing.T) { t.Run("static token generator should be used if present", func(t *testing.T) { + ctx := context.Background() + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { auth := r.Header.Get("Authorization") require.NotEmpty(t, auth) @@ -26,17 +29,18 @@ func TestNewClient(t *testing.T) { })) defer server.Close() - client, err := New(ClientConfig{ + client, err := New(ctx, ClientConfig{ APIEndpoint: server.URL, StaticTokenGenerator: NewStaticTokenGenerator("static-token"), }) require.NoError(t, err) - _, err = client.AppsList() + _, err = client.AppsList(ctx) require.NoError(t, err) }) t.Run("it should exchange the API token for a JWT", func(t *testing.T) { + ctx := context.Background() claims := &jwt.RegisteredClaims{ ExpiresAt: jwt.NewNumericDate(time.Now().Add(5 * time.Minute)), } @@ -64,13 +68,13 @@ func TestNewClient(t *testing.T) { })) defer authserver.Close() - client, err := New(ClientConfig{ + client, err := New(ctx, ClientConfig{ AuthEndpoint: authserver.URL, APIToken: "api-token", }) require.NoError(t, err) - _, err = client.Self() + _, err = client.Self(ctx) require.NoError(t, err) }) } diff --git a/collaborators.go b/collaborators.go index 9a864498..f1950863 100644 --- a/collaborators.go +++ b/collaborators.go @@ -1,6 +1,10 @@ package scalingo -import "gopkg.in/errgo.v1" +import ( + "context" + + "gopkg.in/errgo.v1" +) type CollaboratorStatus string @@ -11,9 +15,9 @@ const ( ) type CollaboratorsService interface { - CollaboratorsList(app string) ([]Collaborator, error) - CollaboratorAdd(app string, email string) (Collaborator, error) - CollaboratorRemove(app string, id string) error + CollaboratorsList(ctx context.Context, app string) ([]Collaborator, error) + CollaboratorAdd(ctx context.Context, app string, email string) (Collaborator, error) + CollaboratorRemove(ctx context.Context, app string, id string) error } var _ CollaboratorsService = (*Client)(nil) @@ -35,18 +39,18 @@ type CollaboratorRes struct { Collaborator Collaborator `json:"collaborator"` } -func (c *Client) CollaboratorsList(app string) ([]Collaborator, error) { +func (c *Client) CollaboratorsList(ctx context.Context, app string) ([]Collaborator, error) { var collaboratorsRes CollaboratorsRes - err := c.ScalingoAPI().SubresourceList("apps", app, "collaborators", nil, &collaboratorsRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "collaborators", nil, &collaboratorsRes) if err != nil { return nil, errgo.Mask(err) } return collaboratorsRes.Collaborators, nil } -func (c *Client) CollaboratorAdd(app string, email string) (Collaborator, error) { +func (c *Client) CollaboratorAdd(ctx context.Context, app string, email string) (Collaborator, error) { var collaboratorRes CollaboratorRes - err := c.ScalingoAPI().SubresourceAdd("apps", app, "collaborators", CollaboratorRes{ + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "collaborators", CollaboratorRes{ Collaborator: Collaborator{Email: email}, }, &collaboratorRes) if err != nil { @@ -55,6 +59,6 @@ func (c *Client) CollaboratorAdd(app string, email string) (Collaborator, error) return collaboratorRes.Collaborator, nil } -func (c *Client) CollaboratorRemove(app string, id string) error { - return c.ScalingoAPI().SubresourceDelete("apps", app, "collaborators", id) +func (c *Client) CollaboratorRemove(ctx context.Context, app string, id string) error { + return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "collaborators", id) } diff --git a/container.go b/container.go index 5356017f..3a672bae 100644 --- a/container.go +++ b/container.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "fmt" "time" @@ -10,7 +11,7 @@ import ( ) type ContainersService interface { - ContainersStop(appName, containerID string) error + ContainersStop(ctx context.Context, appName, containerID string) error } var _ ContainersService = (*Client)(nil) @@ -31,13 +32,13 @@ type Container struct { ContainerSize ContainerSize `json:"container_size"` } -func (c *Client) ContainersStop(appName, containerID string) error { +func (c *Client) ContainersStop(ctx context.Context, appName, containerID string) error { req := &httpclient.APIRequest{ Method: "POST", Endpoint: fmt.Sprintf("/apps/%s/containers/%s/stop", appName, containerID), Expected: httpclient.Statuses{202}, } - err := c.ScalingoAPI().DoRequest(req, nil) + err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { return errgo.Notef(err, "fail to execute the POST request to stop a container") } diff --git a/container_sizes.go b/container_sizes.go index 225dc4bc..aaa7a8f5 100644 --- a/container_sizes.go +++ b/container_sizes.go @@ -1,6 +1,8 @@ package scalingo import ( + "context" + "gopkg.in/errgo.v1" httpclient "github.com/Scalingo/go-scalingo/v4/http" @@ -24,18 +26,18 @@ type ContainerSize struct { } type ContainerSizesService interface { - ContainerSizesList() ([]ContainerSize, error) + ContainerSizesList(ctx context.Context) ([]ContainerSize, error) } var _ ContainerSizesService = (*Client)(nil) -func (c *Client) ContainerSizesList() ([]ContainerSize, error) { +func (c *Client) ContainerSizesList(ctx context.Context) ([]ContainerSize, error) { req := &httpclient.APIRequest{ Endpoint: "/features/container_sizes", } resmap := map[string][]ContainerSize{} - err := c.ScalingoAPI().DoRequest(req, &resmap) + err := c.ScalingoAPI().DoRequest(ctx, req, &resmap) if err != nil { return nil, errgo.Notef(err, "fail to request Scalingo API to list the container sizes") } diff --git a/cron_tasks.go b/cron_tasks.go index 786ae9fa..89862eab 100644 --- a/cron_tasks.go +++ b/cron_tasks.go @@ -1,13 +1,14 @@ package scalingo import ( + "context" "time" "gopkg.in/errgo.v1" ) type CronTasksService interface { - CronTasksGet(app string) (CronTasks, error) + CronTasksGet(ctx context.Context, app string) (CronTasks, error) } var _ CronTasksService = (*Client)(nil) @@ -23,9 +24,9 @@ type CronTasks struct { Jobs []Job `json:"jobs"` } -func (c *Client) CronTasksGet(app string) (CronTasks, error) { +func (c *Client) CronTasksGet(ctx context.Context, app string) (CronTasks, error) { resp := CronTasks{} - err := c.ScalingoAPI().SubresourceList("apps", app, "cron_tasks", nil, &resp) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "cron_tasks", nil, &resp) if err != nil { return CronTasks{}, errgo.Notef(err, "fail to get cron tasks") } diff --git a/cron_tasks_test.go b/cron_tasks_test.go index 0eb7c385..14c1487c 100644 --- a/cron_tasks_test.go +++ b/cron_tasks_test.go @@ -1,17 +1,19 @@ package scalingo import ( + "context" "encoding/json" "net/http" "net/http/httptest" "testing" - gomock "github.com/golang/mock/gomock" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestCronTasksClient_CronTasksGet(t *testing.T) { + ctx := context.Background() appName := "my-app" tests := []struct { @@ -25,7 +27,7 @@ func TestCronTasksClient_CronTasksGet(t *testing.T) { { action: "get", testedClientCall: func(c CronTasksService) error { - _, err := c.CronTasksGet(appName) + _, err := c.CronTasksGet(ctx, appName) return err }, expectedEndpoint: "/v1/apps/my-app/cron_tasks", @@ -68,7 +70,7 @@ func TestCronTasksClient_CronTasksGet(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(handler)) defer ts.Close() - c, err := New(ClientConfig{ + c, err := New(ctx, ClientConfig{ APIEndpoint: ts.URL, APIToken: "test", }) diff --git a/database_type_versions.go b/database_type_versions.go index 17a16e4a..25542955 100644 --- a/database_type_versions.go +++ b/database_type_versions.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "fmt" "time" @@ -39,9 +40,9 @@ type DatabaseTypeVersionShowResponse struct { DatabaseTypeVersion DatabaseTypeVersion `json:"database_type_version"` } -func (c Client) DatabaseTypeVersion(appID, addonID, versionID string) (DatabaseTypeVersion, error) { +func (c Client) DatabaseTypeVersion(ctx context.Context, appID, addonID, versionID string) (DatabaseTypeVersion, error) { var res DatabaseTypeVersionShowResponse - err := c.DBAPI(appID, addonID).DoRequest(&http.APIRequest{ + err := c.DBAPI(appID, addonID).DoRequest(ctx, &http.APIRequest{ Method: "GET", Endpoint: "/database_type_versions/" + versionID, Expected: http.Statuses{200}, diff --git a/databases.go b/databases.go index bdda09a1..b79589a1 100644 --- a/databases.go +++ b/databases.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "time" "gopkg.in/errgo.v1" @@ -80,9 +81,9 @@ type DatabaseRes struct { Database Database `json:"database"` } -func (c *Client) DatabaseShow(app, addonID string) (Database, error) { +func (c *Client) DatabaseShow(ctx context.Context, app, addonID string) (Database, error) { var res DatabaseRes - err := c.DBAPI(app, addonID).ResourceGet("databases", addonID, nil, &res) + err := c.DBAPI(app, addonID).ResourceGet(ctx, "databases", addonID, nil, &res) if err != nil { return Database{}, errgo.Notef(err, "fail to get the database") } @@ -94,9 +95,9 @@ type PeriodicBackupsConfigParams struct { Enabled *bool `json:"periodic_backups_enabled,omitempty"` } -func (c *Client) PeriodicBackupsConfig(app, addonID string, params PeriodicBackupsConfigParams) (Database, error) { +func (c *Client) PeriodicBackupsConfig(ctx context.Context, app, addonID string, params PeriodicBackupsConfigParams) (Database, error) { var dbRes DatabaseRes - err := c.DBAPI(app, addonID).ResourceUpdate("databases", addonID, map[string]PeriodicBackupsConfigParams{ + err := c.DBAPI(app, addonID).ResourceUpdate(ctx, "databases", addonID, map[string]PeriodicBackupsConfigParams{ "database": params, }, &dbRes) if err != nil { diff --git a/deployments.go b/deployments.go index 04691fbf..95a28b7d 100644 --- a/deployments.go +++ b/deployments.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "net/http" "net/url" @@ -13,12 +14,12 @@ import ( ) type DeploymentsService interface { - DeploymentList(app string) ([]*Deployment, error) - DeploymentListWithPagination(app string, opts PaginationOpts) ([]*Deployment, PaginationMeta, error) - Deployment(app string, deploy string) (*Deployment, error) - DeploymentLogs(deployURL string) (*http.Response, error) - DeploymentStream(deployURL string) (*websocket.Conn, error) - DeploymentsCreate(app string, params *DeploymentsCreateParams) (*Deployment, error) + DeploymentList(ctx context.Context, app string) ([]*Deployment, error) + DeploymentListWithPagination(ctx context.Context, app string, opts PaginationOpts) ([]*Deployment, PaginationMeta, error) + Deployment(ctx context.Context, app string, deploy string) (*Deployment, error) + DeploymentLogs(ctx context.Context, deployURL string) (*http.Response, error) + DeploymentStream(ctx context.Context, deployURL string) (*websocket.Conn, error) + DeploymentsCreate(ctx context.Context, app string, params *DeploymentsCreateParams) (*Deployment, error) } var _ DeploymentsService = (*Client)(nil) @@ -133,12 +134,12 @@ type AuthStruct struct { Data AuthenticationData `json:"data"` } -func (c *Client) DeploymentList(app string) ([]*Deployment, error) { +func (c *Client) DeploymentList(ctx context.Context, app string) ([]*Deployment, error) { var deployments DeploymentList req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/deployments", } - err := c.ScalingoAPI().DoRequest(req, &deployments) + err := c.ScalingoAPI().DoRequest(ctx, req, &deployments) if err != nil { return []*Deployment{}, errgo.Notef(err, "fail to list the deployments") } @@ -146,9 +147,9 @@ func (c *Client) DeploymentList(app string) ([]*Deployment, error) { return deployments.Deployments, nil } -func (c *Client) DeploymentListWithPagination(app string, opts PaginationOpts) ([]*Deployment, PaginationMeta, error) { +func (c *Client) DeploymentListWithPagination(ctx context.Context, app string, opts PaginationOpts) ([]*Deployment, PaginationMeta, error) { var deployments DeploymentList - err := c.ScalingoAPI().SubresourceList("apps", app, "deployments", opts.ToMap(), &deployments) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "deployments", opts.ToMap(), &deployments) if err != nil { return []*Deployment{}, PaginationMeta{}, errgo.Notef(err, "fail to list the deployments with pagination") } @@ -156,20 +157,20 @@ func (c *Client) DeploymentListWithPagination(app string, opts PaginationOpts) ( return deployments.Deployments, deployments.Meta.PaginationMeta, nil } -func (c *Client) Deployment(app string, deploy string) (*Deployment, error) { +func (c *Client) Deployment(ctx context.Context, app string, deploy string) (*Deployment, error) { var deploymentMap map[string]*Deployment req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/deployments/" + deploy, } - err := c.ScalingoAPI().DoRequest(req, &deploymentMap) + err := c.ScalingoAPI().DoRequest(ctx, req, &deploymentMap) if err != nil { return nil, errgo.Mask(err, errgo.Any) } return deploymentMap["deployment"], nil } -func (c *Client) DeploymentLogs(deployURL string) (*http.Response, error) { +func (c *Client) DeploymentLogs(ctx context.Context, deployURL string) (*http.Response, error) { u, err := url.Parse(deployURL) if err != nil { return nil, errgo.Mask(err, errgo.Any) @@ -180,12 +181,12 @@ func (c *Client) DeploymentLogs(deployURL string) (*http.Response, error) { URL: u.Scheme + "://" + u.Host, } - return c.ScalingoAPI().Do(req) + return c.ScalingoAPI().Do(ctx, req) } // DeploymentStream returns a websocket connection to follow the various deployment events happening on an application. The type of the data sent on this connection is DeployEvent. -func (c *Client) DeploymentStream(deployURL string) (*websocket.Conn, error) { - token, err := c.ScalingoAPI().TokenGenerator().GetAccessToken() +func (c *Client) DeploymentStream(ctx context.Context, deployURL string) (*websocket.Conn, error) { + token, err := c.ScalingoAPI().TokenGenerator().GetAccessToken(ctx) if err != nil { return nil, errgo.Notef(err, "fail to generate token") } @@ -212,7 +213,7 @@ func (c *Client) DeploymentStream(deployURL string) (*websocket.Conn, error) { return conn, nil } -func (c *Client) DeploymentsCreate(app string, params *DeploymentsCreateParams) (*Deployment, error) { +func (c *Client) DeploymentsCreate(ctx context.Context, app string, params *DeploymentsCreateParams) (*Deployment, error) { var response *DeploymentsCreateRes req := &httpclient.APIRequest{ Method: "POST", @@ -223,7 +224,7 @@ func (c *Client) DeploymentsCreate(app string, params *DeploymentsCreateParams) }, } - err := c.ScalingoAPI().DoRequest(req, &response) + err := c.ScalingoAPI().DoRequest(ctx, req, &response) if err != nil { return nil, errgo.Mask(err, errgo.Any) } @@ -231,13 +232,13 @@ func (c *Client) DeploymentsCreate(app string, params *DeploymentsCreateParams) return response.Deployment, nil } -func (c *Client) DeploymentCacheReset(app string) error { +func (c *Client) DeploymentCacheReset(ctx context.Context, app string) error { req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/caches/deployment", Method: "DELETE", Expected: httpclient.Statuses{204}, } - err := c.ScalingoAPI().DoRequest(req, nil) + err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { return errgo.Mask(err) } diff --git a/domains.go b/domains.go index 8dda6c90..9d16d7bb 100644 --- a/domains.go +++ b/domains.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "errors" "time" @@ -8,14 +9,14 @@ import ( ) type DomainsService interface { - DomainsList(app string) ([]Domain, error) - DomainsAdd(app string, d Domain) (Domain, error) - DomainsRemove(app string, id string) error - DomainsUpdate(app, id, cert, key string) (Domain, error) - DomainSetCanonical(app, id string) (Domain, error) - DomainUnsetCanonical(app string) (Domain, error) - DomainSetCertificate(app, id, tlsCert, tlsKey string) (Domain, error) - DomainUnsetCertificate(app, id string) (Domain, error) + DomainsList(ctx context.Context, app string) ([]Domain, error) + DomainsAdd(ctx context.Context, app string, d Domain) (Domain, error) + DomainsRemove(ctx context.Context, app string, id string) error + DomainsUpdate(ctx context.Context, app, id, cert, key string) (Domain, error) + DomainSetCanonical(ctx context.Context, app, id string) (Domain, error) + DomainUnsetCanonical(ctx context.Context, app string) (Domain, error) + DomainSetCertificate(ctx context.Context, app, id, tlsCert, tlsKey string) (Domain, error) + DomainUnsetCertificate(ctx context.Context, app, id string) (Domain, error) } var _ DomainsService = (*Client)(nil) @@ -75,37 +76,37 @@ type DomainRes struct { Domain Domain `json:"domain"` } -func (c *Client) DomainsList(app string) ([]Domain, error) { +func (c *Client) DomainsList(ctx context.Context, app string) ([]Domain, error) { var domainRes DomainsRes - err := c.ScalingoAPI().SubresourceList("apps", app, "domains", nil, &domainRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "domains", nil, &domainRes) if err != nil { return nil, errgo.Notef(err, "fail to list the domains") } return domainRes.Domains, nil } -func (c *Client) DomainsAdd(app string, d Domain) (Domain, error) { +func (c *Client) DomainsAdd(ctx context.Context, app string, d Domain) (Domain, error) { var domainRes DomainRes - err := c.ScalingoAPI().SubresourceAdd("apps", app, "domains", DomainRes{d}, &domainRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "domains", DomainRes{d}, &domainRes) if err != nil { return Domain{}, errgo.Notef(err, "fail to add a domain") } return domainRes.Domain, nil } -func (c *Client) DomainsRemove(app, id string) error { - return c.ScalingoAPI().SubresourceDelete("apps", app, "domains", id) +func (c *Client) DomainsRemove(ctx context.Context, app, id string) error { + return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "domains", id) } // Deprecated: use DomainsSetCanonical, DomainUnsetCanonical, DomainSetCertificate or DomainUnsetCertificate -func (c *Client) DomainsUpdate(app, id, tlsCert, tlsKey string) (Domain, error) { - return c.domainsUpdate(app, id, Domain{TLSCert: tlsCert, TLSKey: tlsKey}) +func (c *Client) DomainsUpdate(ctx context.Context, app, id, tlsCert, tlsKey string) (Domain, error) { + return c.domainsUpdate(ctx, app, id, Domain{TLSCert: tlsCert, TLSKey: tlsKey}) } -func (c *Client) DomainsShow(app, id string) (Domain, error) { +func (c *Client) DomainsShow(ctx context.Context, app, id string) (Domain, error) { var domainRes DomainRes - err := c.ScalingoAPI().SubresourceGet("apps", app, "domains", id, nil, &domainRes) + err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "domains", id, nil, &domainRes) if err != nil { return Domain{}, errgo.Notef(err, "fail to show the domain") } @@ -113,27 +114,27 @@ func (c *Client) DomainsShow(app, id string) (Domain, error) { return domainRes.Domain, nil } -func (c *Client) domainsUpdate(app, id string, domain Domain) (Domain, error) { +func (c *Client) domainsUpdate(ctx context.Context, app, id string, domain Domain) (Domain, error) { var domainRes DomainRes - err := c.ScalingoAPI().SubresourceUpdate("apps", app, "domains", id, DomainRes{Domain: domain}, &domainRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "domains", id, DomainRes{Domain: domain}, &domainRes) if err != nil { return Domain{}, errgo.Notef(err, "fail to update the domain") } return domainRes.Domain, nil } -func (c *Client) DomainSetCertificate(app, id, tlsCert, tlsKey string) (Domain, error) { - domain, err := c.domainsUpdate(app, id, Domain{TLSCert: tlsCert, TLSKey: tlsKey}) +func (c *Client) DomainSetCertificate(ctx context.Context, app, id, tlsCert, tlsKey string) (Domain, error) { + domain, err := c.domainsUpdate(ctx, app, id, Domain{TLSCert: tlsCert, TLSKey: tlsKey}) if err != nil { return Domain{}, errgo.Notef(err, "fail to set the domain certificate") } return domain, nil } -func (c *Client) DomainUnsetCertificate(app, id string) (Domain, error) { +func (c *Client) DomainUnsetCertificate(ctx context.Context, app, id string) (Domain, error) { var domainRes DomainRes err := c.ScalingoAPI().SubresourceUpdate( - "apps", app, "domains", id, map[string]domainUnsetCertificateParams{ + ctx, "apps", app, "domains", id, map[string]domainUnsetCertificateParams{ "domain": {TLSCert: "", TLSKey: ""}, }, &domainRes, ) @@ -143,23 +144,23 @@ func (c *Client) DomainUnsetCertificate(app, id string) (Domain, error) { return domainRes.Domain, nil } -func (c *Client) DomainSetCanonical(app, id string) (Domain, error) { - domain, err := c.domainsUpdate(app, id, Domain{Canonical: true}) +func (c *Client) DomainSetCanonical(ctx context.Context, app, id string) (Domain, error) { + domain, err := c.domainsUpdate(ctx, app, id, Domain{Canonical: true}) if err != nil { return Domain{}, errgo.Notef(err, "fail to set the domain as canonical") } return domain, nil } -func (c *Client) DomainUnsetCanonical(app string) (Domain, error) { - domains, err := c.DomainsList(app) +func (c *Client) DomainUnsetCanonical(ctx context.Context, app string) (Domain, error) { + domains, err := c.DomainsList(ctx, app) if err != nil { return Domain{}, errgo.Notef(err, "fail to list the domains to unset the canonical one") } for _, domain := range domains { if domain.Canonical { - domain, err := c.domainsUpdate(app, domain.ID, Domain{Canonical: false}) + domain, err := c.domainsUpdate(ctx, app, domain.ID, Domain{Canonical: false}) if err != nil { return Domain{}, errgo.Notef(err, "fail to unset the domain as canonical") } diff --git a/domains_test.go b/domains_test.go index 9728b138..39839c38 100644 --- a/domains_test.go +++ b/domains_test.go @@ -2,6 +2,7 @@ package scalingo import ( "bytes" + "context" "encoding/json" "net/http" "net/http/httptest" @@ -13,6 +14,7 @@ import ( ) func TestDomainsClient_DomainCanonical(t *testing.T) { + ctx := context.Background() appName := "my-app" domainID := "domain-id" @@ -27,7 +29,7 @@ func TestDomainsClient_DomainCanonical(t *testing.T) { }{ "it should set the domain as canonical": { testedClientCall: func(c DomainsService) error { - _, err := c.DomainSetCanonical(appName, domainID) + _, err := c.DomainSetCanonical(ctx, appName, domainID) return err }, expectedEndpoint: "/v1/apps/my-app/domains/domain-id", @@ -47,7 +49,7 @@ func TestDomainsClient_DomainCanonical(t *testing.T) { assert.NoError(t, err) }, testedClientCall: func(c DomainsService) error { - _, err := c.DomainUnsetCanonical(appName) + _, err := c.DomainUnsetCanonical(ctx, appName) return err }, expectedEndpoint: "/v1/apps/my-app/domains/domain-id", @@ -57,7 +59,7 @@ func TestDomainsClient_DomainCanonical(t *testing.T) { }, "it should unset the domain certificate": { testedClientCall: func(c DomainsService) error { - _, err := c.DomainUnsetCertificate(appName, domainID) + _, err := c.DomainUnsetCertificate(ctx, appName, domainID) return err }, expectedEndpoint: "/v1/apps/my-app/domains/domain-id", @@ -72,7 +74,7 @@ func TestDomainsClient_DomainCanonical(t *testing.T) { assert.NoError(t, err) }, testedClientCall: func(c DomainsService) error { - _, err := c.DomainUnsetCanonical(appName) + _, err := c.DomainUnsetCanonical(ctx, appName) return err }, expectedError: "no canonical domain configured", @@ -105,7 +107,7 @@ func TestDomainsClient_DomainCanonical(t *testing.T) { })) defer ts.Close() - scalingoClient, err := New(ClientConfig{ + scalingoClient, err := New(ctx, ClientConfig{ APIEndpoint: ts.URL, APIToken: "test", }) diff --git a/env.go b/env.go index eb9a62e0..fe9c06c4 100644 --- a/env.go +++ b/env.go @@ -1,19 +1,20 @@ package scalingo import ( + "context" "encoding/json" - "github.com/Scalingo/go-scalingo/v4/http" - "gopkg.in/errgo.v1" + + "github.com/Scalingo/go-scalingo/v4/http" ) type VariablesService interface { - VariablesList(app string) (Variables, error) - VariablesListWithoutAlias(app string) (Variables, error) - VariableSet(app string, name string, value string) (*Variable, int, error) - VariableMultipleSet(app string, variables Variables) (Variables, int, error) - VariableUnset(app string, id string) error + VariablesList(ctx context.Context, app string) (Variables, error) + VariablesListWithoutAlias(ctx context.Context, app string) (Variables, error) + VariableSet(ctx context.Context, app string, name string, value string) (*Variable, int, error) + VariableMultipleSet(ctx context.Context, app string, variables Variables) (Variables, int, error) + VariableUnset(ctx context.Context, app string, id string) error } var _ VariablesService = (*Client)(nil) @@ -43,24 +44,24 @@ type VariableSetParams struct { Variable *Variable `json:"variable"` } -func (c *Client) VariablesList(app string) (Variables, error) { - return c.variableList(app, true) +func (c *Client) VariablesList(ctx context.Context, app string) (Variables, error) { + return c.variableList(ctx, app, true) } -func (c *Client) VariablesListWithoutAlias(app string) (Variables, error) { - return c.variableList(app, false) +func (c *Client) VariablesListWithoutAlias(ctx context.Context, app string) (Variables, error) { + return c.variableList(ctx, app, false) } -func (c *Client) variableList(app string, aliases bool) (Variables, error) { +func (c *Client) variableList(ctx context.Context, app string, aliases bool) (Variables, error) { var variablesRes VariablesRes - err := c.ScalingoAPI().SubresourceList("apps", app, "variables", map[string]bool{"aliases": aliases}, &variablesRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "variables", map[string]bool{"aliases": aliases}, &variablesRes) if err != nil { return nil, errgo.Mask(err, errgo.Any) } return variablesRes.Variables, nil } -func (c *Client) VariableSet(app string, name string, value string) (*Variable, int, error) { +func (c *Client) VariableSet(ctx context.Context, app string, name string, value string) (*Variable, int, error) { req := &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/variables", @@ -72,7 +73,7 @@ func (c *Client) VariableSet(app string, name string, value string) (*Variable, }, Expected: http.Statuses{200, 201}, } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, 0, errgo.Mask(err, errgo.Any) } @@ -87,7 +88,7 @@ func (c *Client) VariableSet(app string, name string, value string) (*Variable, return params.Variable, res.StatusCode, nil } -func (c *Client) VariableMultipleSet(app string, variables Variables) (Variables, int, error) { +func (c *Client) VariableMultipleSet(ctx context.Context, app string, variables Variables) (Variables, int, error) { req := &http.APIRequest{ Method: "PUT", Endpoint: "/apps/" + app + "/variables", @@ -96,7 +97,7 @@ func (c *Client) VariableMultipleSet(app string, variables Variables) (Variables }, Expected: http.Statuses{200, 201}, } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, 0, errgo.Mask(err, errgo.Any) } @@ -111,6 +112,6 @@ func (c *Client) VariableMultipleSet(app string, variables Variables) (Variables return params.Variables, res.StatusCode, nil } -func (c *Client) VariableUnset(app string, id string) error { - return c.ScalingoAPI().SubresourceDelete("apps", app, "variables", id) +func (c *Client) VariableUnset(ctx context.Context, app string, id string) error { + return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "variables", id) } diff --git a/events.go b/events.go index da261fad..76a79a3b 100644 --- a/events.go +++ b/events.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "gopkg.in/errgo.v1" @@ -9,10 +10,10 @@ import ( ) type EventsService interface { - EventTypesList() ([]EventType, error) - EventCategoriesList() ([]EventCategory, error) - EventsList(app string, opts PaginationOpts) (Events, PaginationMeta, error) - UserEventsList(opts PaginationOpts) (Events, PaginationMeta, error) + EventTypesList(context.Context) ([]EventType, error) + EventCategoriesList(context.Context) ([]EventCategory, error) + EventsList(ctx context.Context, app string, opts PaginationOpts) (Events, PaginationMeta, error) + UserEventsList(context.Context, PaginationOpts) (Events, PaginationMeta, error) } var _ EventsService = (*Client)(nil) @@ -24,9 +25,9 @@ type EventsRes struct { } } -func (c *Client) EventsList(app string, opts PaginationOpts) (Events, PaginationMeta, error) { +func (c *Client) EventsList(ctx context.Context, app string, opts PaginationOpts) (Events, PaginationMeta, error) { var eventsRes EventsRes - err := c.ScalingoAPI().SubresourceList("apps", app, "events", opts.ToMap(), &eventsRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "events", opts.ToMap(), &eventsRes) if err != nil { return nil, PaginationMeta{}, errgo.Mask(err) } @@ -37,14 +38,14 @@ func (c *Client) EventsList(app string, opts PaginationOpts) (Events, Pagination return events, eventsRes.Meta.PaginationMeta, nil } -func (c *Client) UserEventsList(opts PaginationOpts) (Events, PaginationMeta, error) { +func (c *Client) UserEventsList(ctx context.Context, opts PaginationOpts) (Events, PaginationMeta, error) { req := &http.APIRequest{ Endpoint: "/events", Params: opts.ToMap(), } var eventsRes EventsRes - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, PaginationMeta{}, errgo.Mask(err, errgo.Any) } diff --git a/events_test.go b/events_test.go index 13fcd2af..bb9cb8db 100644 --- a/events_test.go +++ b/events_test.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "testing" @@ -36,21 +37,23 @@ var eventsListCases = map[string]struct { } func TestEventsList(t *testing.T) { + ctx := context.Background() + for msg, c := range eventsListCases { t.Run(msg, func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - client, err := New(ClientConfig{}) + client, err := New(ctx, ClientConfig{}) require.NoError(t, err) apiMock := httpmock.NewMockClient(ctrl) client.apiClient = apiMock - apiMock.EXPECT().SubresourceList("apps", c.App, "events", c.PaginationOpts.ToMap(), gomock.Any()).Do(func(_, _, _ string, _ interface{}, res interface{}) { + apiMock.EXPECT().SubresourceList(gomock.Any(), "apps", c.App, "events", c.PaginationOpts.ToMap(), gomock.Any()).Do(func(_ context.Context, _, _, _ string, _ interface{}, res interface{}) { err := json.Unmarshal([]byte(c.Body), &res) require.NoError(t, err) }).Return(nil) - events, _, err := client.EventsList(c.App, c.PaginationOpts) + events, _, err := client.EventsList(ctx, c.App, c.PaginationOpts) if len(events) != c.EventsCount { t.Errorf("expected %d event, got %v", c.EventsCount, len(events)) } diff --git a/events_types.go b/events_types.go index 104f191b..183b03ab 100644 --- a/events_types.go +++ b/events_types.go @@ -1,6 +1,8 @@ package scalingo import ( + "context" + "gopkg.in/errgo.v1" "github.com/Scalingo/go-scalingo/v4/http" @@ -21,13 +23,13 @@ type EventType struct { Template string `json:"template"` } -func (c *Client) EventTypesList() ([]EventType, error) { +func (c *Client) EventTypesList(ctx context.Context) ([]EventType, error) { req := &http.APIRequest{ Endpoint: "/event_types", } var res map[string][]EventType - err := c.ScalingoAPI().DoRequest(req, &res) + err := c.ScalingoAPI().DoRequest(ctx, req, &res) if err != nil { return nil, errgo.Notef(err, "fail to make request to Scalingo API") } @@ -35,13 +37,13 @@ func (c *Client) EventTypesList() ([]EventType, error) { return res["event_types"], nil } -func (c *Client) EventCategoriesList() ([]EventCategory, error) { +func (c *Client) EventCategoriesList(ctx context.Context) ([]EventCategory, error) { req := &http.APIRequest{ Endpoint: "/event_categories", } var res map[string][]EventCategory - err := c.ScalingoAPI().DoRequest(req, &res) + err := c.ScalingoAPI().DoRequest(ctx, req, &res) if err != nil { return nil, errgo.Notef(err, "fail to make request to Scalingo API") } diff --git a/examples/app_show/main.go b/examples/app_show/main.go index db5c43ae..8ba6ee23 100644 --- a/examples/app_show/main.go +++ b/examples/app_show/main.go @@ -1,13 +1,16 @@ package main import ( + "context" "fmt" "os" - scalingo "github.com/Scalingo/go-scalingo/v4" + "github.com/Scalingo/go-scalingo/v4" ) func main() { + ctx := context.Background() + if len(os.Args) != 3 { fmt.Fprintf(os.Stderr, "Usage: ./app_show [REGION] [APP_NAME]\n") os.Exit(1) @@ -21,7 +24,7 @@ func main() { os.Exit(1) } - client, err := scalingo.New(scalingo.ClientConfig{ + client, err := scalingo.New(ctx, scalingo.ClientConfig{ Region: region, APIToken: token, }) @@ -30,7 +33,7 @@ func main() { os.Exit(1) } - app, err := client.AppsShow(appName) + app, err := client.AppsShow(ctx, appName) if err != nil { fmt.Fprintf(os.Stderr, "fail to show app: %s\n", err.Error()) os.Exit(1) diff --git a/examples/backup_download/main.go b/examples/backup_download/main.go index 9c26e0f7..9395d7c9 100644 --- a/examples/backup_download/main.go +++ b/examples/backup_download/main.go @@ -1,15 +1,17 @@ package main import ( + "context" "fmt" "io" "net/http" "os" - scalingo "github.com/Scalingo/go-scalingo/v4" + "github.com/Scalingo/go-scalingo/v4" ) func main() { + ctx := context.Background() // ---- PARSE ARGS ---- if len(os.Args) != 5 { @@ -29,7 +31,7 @@ func main() { os.Exit(1) } - client, err := scalingo.New(scalingo.ClientConfig{ + client, err := scalingo.New(ctx, scalingo.ClientConfig{ Region: region, APIToken: token, }) @@ -39,7 +41,7 @@ func main() { } // ---- GET BACKUP DOWNLOAD URL ---- - backupURL, err := client.BackupDownloadURL(appName, addonId, backupId) + backupURL, err := client.BackupDownloadURL(ctx, appName, addonId, backupId) if err != nil { fmt.Fprintf(os.Stderr, "fail to get backup URL: %s\n", err.Error()) os.Exit(1) diff --git a/github_link.go b/github_link.go index 9ef5efcf..0a232061 100644 --- a/github_link.go +++ b/github_link.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "errors" "time" @@ -12,11 +13,11 @@ var ( ) type GithubLinkService interface { - GithubLinkShow(app string) (*GithubLink, error) - GithubLinkAdd(app string, params GithubLinkParams) (*GithubLink, error) - GithubLinkUpdate(app, id string, params GithubLinkParams) (*GithubLink, error) - GithubLinkDelete(app string, id string) error - GithubLinkManualDeploy(app, id, branch string) error + GithubLinkShow(ctx context.Context, app string) (*GithubLink, error) + GithubLinkAdd(ctx context.Context, app string, params GithubLinkParams) (*GithubLink, error) + GithubLinkUpdate(ctx context.Context, app, id string, params GithubLinkParams) (*GithubLink, error) + GithubLinkDelete(ctx context.Context, app string, id string) error + GithubLinkManualDeploy(ctx context.Context, app, id, branch string) error } type GithubLinkParams struct { @@ -63,9 +64,9 @@ type GithubLinksResponse struct { var _ GithubLinkService = (*Client)(nil) -func (c *Client) GithubLinkShow(app string) (*GithubLink, error) { +func (c *Client) GithubLinkShow(ctx context.Context, app string) (*GithubLink, error) { var link GithubLinksResponse - err := c.ScalingoAPI().SubresourceList("apps", app, "github_repo_links", nil, &link) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "github_repo_links", nil, &link) if err != nil { return nil, err } @@ -77,37 +78,37 @@ func (c *Client) GithubLinkShow(app string) (*GithubLink, error) { return link.GithubLinks[0], nil } -func (c *Client) GithubLinkAdd(app string, params GithubLinkParams) (*GithubLink, error) { +func (c *Client) GithubLinkAdd(ctx context.Context, app string, params GithubLinkParams) (*GithubLink, error) { linkParams := map[string]GithubLinkParams{ "github_repo_link": params, } var link GithubLinkResponse - err := c.ScalingoAPI().SubresourceAdd("apps", app, "github_repo_links", linkParams, &link) + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "github_repo_links", linkParams, &link) if err != nil { return nil, err } return link.GithubLink, nil } -func (c *Client) GithubLinkUpdate(app, id string, params GithubLinkParams) (*GithubLink, error) { +func (c *Client) GithubLinkUpdate(ctx context.Context, app, id string, params GithubLinkParams) (*GithubLink, error) { linkParams := map[string]GithubLinkParams{ "github_repo_link": params, } var link GithubLinkResponse - err := c.ScalingoAPI().SubresourceUpdate("apps", app, "github_repo_links", id, linkParams, &link) + err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "github_repo_links", id, linkParams, &link) if err != nil { return nil, err } return link.GithubLink, nil } -func (c *Client) GithubLinkDelete(app, id string) error { - return c.ScalingoAPI().SubresourceDelete("apps", app, "github_repo_links", id) +func (c *Client) GithubLinkDelete(ctx context.Context, app, id string) error { + return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "github_repo_links", id) } -func (c *Client) GithubLinkManualDeploy(app, id, branch string) error { +func (c *Client) GithubLinkManualDeploy(ctx context.Context, app, id, branch string) error { req := &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/github_repo_links/" + id + "/manual_deploy", @@ -116,6 +117,8 @@ func (c *Client) GithubLinkManualDeploy(app, id, branch string) error { "branch": branch, }, } - _, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) + defer res.Body.Close() + return err } diff --git a/http/addon_token_generator.go b/http/addon_token_generator.go index 61dbbed3..4baadb04 100644 --- a/http/addon_token_generator.go +++ b/http/addon_token_generator.go @@ -1,6 +1,8 @@ package http import ( + "context" + "gopkg.in/errgo.v1" ) @@ -11,7 +13,7 @@ type AddonTokenGenerator struct { } type AdddonTokenExchanger interface { - AddonToken(app, addonID string) (string, error) + AddonToken(ctx context.Context, app, addonID string) (string, error) } func NewAddonTokenGenerator(app, addon string, exchanger AdddonTokenExchanger) TokenGenerator { @@ -22,8 +24,8 @@ func NewAddonTokenGenerator(app, addon string, exchanger AdddonTokenExchanger) T } } -func (c *AddonTokenGenerator) GetAccessToken() (string, error) { - token, err := c.exchanger.AddonToken(c.appID, c.addonID) +func (c *AddonTokenGenerator) GetAccessToken(ctx context.Context) (string, error) { + token, err := c.exchanger.AddonToken(ctx, c.appID, c.addonID) if err != nil { return "", errgo.Notef(err, "fail to get addon token") } diff --git a/http/api_request.go b/http/api_request.go index afbc1725..3c403f49 100644 --- a/http/api_request.go +++ b/http/api_request.go @@ -2,6 +2,7 @@ package http import ( "bytes" + "context" "encoding/json" "fmt" "io" @@ -32,7 +33,7 @@ type APIRequest struct { type Statuses []int -func (c *client) FillDefaultValues(req *APIRequest) error { +func (c *client) FillDefaultValues(ctx context.Context, req *APIRequest) error { if req.Method == "" { req.Method = "GET" } @@ -45,7 +46,7 @@ func (c *client) FillDefaultValues(req *APIRequest) error { if !req.NoAuth && c.IsAuthenticatedClient() { var err error - req.Token, err = c.TokenGenerator().GetAccessToken() + req.Token, err = c.TokenGenerator().GetAccessToken(ctx) if err != nil { return errgo.Notef(err, "fail to get the access token for this request") } @@ -67,8 +68,8 @@ func (statuses Statuses) Contains(status int) bool { } // Execute an API request and return its response/error -func (c *client) Do(req *APIRequest) (*http.Response, error) { - err := c.FillDefaultValues(req) +func (c *client) Do(ctx context.Context, req *APIRequest) (*http.Response, error) { + err := c.FillDefaultValues(ctx, req) if err != nil { return nil, errgo.Notef(err, "fail to fill client with default values") } @@ -103,6 +104,10 @@ func (c *client) Do(req *APIRequest) (*http.Response, error) { return nil, errgo.Notef(err, "fail to initialize the '%s' query", req.Method) } req.HTTPRequest.Header.Add("User-Agent", c.userAgent) + requestID, ok := ctx.Value("request_id").(string) + if ok { + req.HTTPRequest.Header.Add("X-Request-ID", requestID) + } debug.Printf("[API] %v %v\n", req.HTTPRequest.Method, req.HTTPRequest.URL) debug.Printf(pkgio.Indent(fmt.Sprintf("User Agent: %v", req.HTTPRequest.UserAgent()), 6)) diff --git a/http/api_token_generator.go b/http/api_token_generator.go index ed686c2e..bc8f2eb6 100644 --- a/http/api_token_generator.go +++ b/http/api_token_generator.go @@ -1,6 +1,7 @@ package http import ( + "context" "time" "github.com/golang-jwt/jwt/v4" @@ -8,7 +9,7 @@ import ( ) type TokensService interface { - TokenExchange(token string) (string, error) + TokenExchange(ctx context.Context, token string) (string, error) } type APITokenGenerator struct { @@ -31,10 +32,10 @@ func NewAPITokenGenerator(tokensService TokensService, apiToken string) *APIToke } } -func (t *APITokenGenerator) GetAccessToken() (string, error) { +func (t *APITokenGenerator) GetAccessToken(ctx context.Context) (string, error) { // Ask for a new JWT if there wasn't any or if the current token will expire in less than 5 minutes if t.currentJWTexp.IsZero() || t.currentJWTexp.Sub(time.Now()) < 5*time.Minute { - jwtToken, err := t.TokensService.TokenExchange(t.APIToken) + jwtToken, err := t.TokensService.TokenExchange(ctx, t.APIToken) if err != nil { return "", errgo.Notef(err, "fail to get access token") } diff --git a/http/api_token_generator_test.go b/http/api_token_generator_test.go index 17f81309..5d97cf32 100644 --- a/http/api_token_generator_test.go +++ b/http/api_token_generator_test.go @@ -1,6 +1,7 @@ package http import ( + "context" "testing" "time" @@ -12,6 +13,7 @@ import ( ) func TestAPITokenGenerator_GetAccessToken(t *testing.T) { + ctx := context.Background() apiToken := "tk-token-test" ctrl := gomock.NewController(t) @@ -25,10 +27,10 @@ func TestAPITokenGenerator_GetAccessToken(t *testing.T) { "it should return a JWT queried to the TokenService": { tokenTTL: time.Hour, expect: func(t *testing.T, s *tokensservicemock.MockTokensService, token string) { - s.EXPECT().TokenExchange(apiToken).Return(token, nil) + s.EXPECT().TokenExchange(gomock.Any(), apiToken).Return(token, nil) }, call: func(t *testing.T, gen *APITokenGenerator, token string) { - accessToken, err := gen.GetAccessToken() + accessToken, err := gen.GetAccessToken(ctx) require.NoError(t, err) require.Equal(t, token, accessToken) }, @@ -36,14 +38,14 @@ func TestAPITokenGenerator_GetAccessToken(t *testing.T) { "it should return twice the same JWT with one call to TokenService if stil valid": { tokenTTL: time.Hour, expect: func(t *testing.T, s *tokensservicemock.MockTokensService, token string) { - s.EXPECT().TokenExchange(apiToken).Return(token, nil) + s.EXPECT().TokenExchange(gomock.Any(), apiToken).Return(token, nil) }, call: func(t *testing.T, gen *APITokenGenerator, token string) { - accessToken, err := gen.GetAccessToken() + accessToken, err := gen.GetAccessToken(ctx) require.NoError(t, err) require.Equal(t, token, accessToken) - accessToken, err = gen.GetAccessToken() + accessToken, err = gen.GetAccessToken(ctx) require.NoError(t, err) require.Equal(t, token, accessToken) }, @@ -51,7 +53,7 @@ func TestAPITokenGenerator_GetAccessToken(t *testing.T) { "it should requery a another JWT if the token is less than 5 minutes to expire": { tokenTTL: 4 * time.Minute, expect: func(t *testing.T, s *tokensservicemock.MockTokensService, token string) { - s.EXPECT().TokenExchange(apiToken).Return(token, nil) + s.EXPECT().TokenExchange(gomock.Any(), apiToken).Return(token, nil) claims := &jwt.RegisteredClaims{ ExpiresAt: jwt.NewNumericDate(time.Now().Add(5 * time.Minute)), @@ -60,14 +62,14 @@ func TestAPITokenGenerator_GetAccessToken(t *testing.T) { jwt, err := jwtToken.SignedString(jwt.UnsafeAllowNoneSignatureType) require.NoError(t, err) - s.EXPECT().TokenExchange(apiToken).Return(jwt, nil) + s.EXPECT().TokenExchange(gomock.Any(), apiToken).Return(jwt, nil) }, call: func(t *testing.T, gen *APITokenGenerator, token string) { - accessToken, err := gen.GetAccessToken() + accessToken, err := gen.GetAccessToken(ctx) require.NoError(t, err) require.Equal(t, token, accessToken) - accessToken, err = gen.GetAccessToken() + accessToken, err = gen.GetAccessToken(ctx) require.NoError(t, err) require.NotEmpty(t, accessToken) require.NotEqual(t, token, accessToken) diff --git a/http/client.go b/http/client.go index 852d49b4..6ea6d7e5 100644 --- a/http/client.go +++ b/http/client.go @@ -1,6 +1,7 @@ package http import ( + "context" "crypto/tls" "fmt" "net/http" @@ -20,19 +21,19 @@ type APIConfig struct { } type Client interface { - ResourceList(resource string, payload, data interface{}) error - ResourceAdd(resource string, payload, data interface{}) error - ResourceGet(resource, resourceID string, payload, data interface{}) error - ResourceUpdate(resource, resourceID string, payload, data interface{}) error - ResourceDelete(resource, resourceID string) error - - SubresourceList(resource, resourceID, subresource string, payload, data interface{}) error - SubresourceAdd(resource, resourceID, subresource string, payload, data interface{}) error - SubresourceGet(resource, resourceID, subresource, id string, payload, data interface{}) error - SubresourceUpdate(resource, resourceID, subresource, id string, payload, data interface{}) error - SubresourceDelete(resource, resourceID, subresource, id string) error - DoRequest(req *APIRequest, data interface{}) error - Do(req *APIRequest) (*http.Response, error) + ResourceList(ctx context.Context, resource string, payload, data interface{}) error + ResourceAdd(ctx context.Context, resource string, payload, data interface{}) error + ResourceGet(ctx context.Context, resource, resourceID string, payload, data interface{}) error + ResourceUpdate(ctx context.Context, resource, resourceID string, payload, data interface{}) error + ResourceDelete(ctx context.Context, resource, resourceID string) error + + SubresourceList(ctx context.Context, resource, resourceID, subresource string, payload, data interface{}) error + SubresourceAdd(ctx context.Context, resource, resourceID, subresource string, payload, data interface{}) error + SubresourceGet(ctx context.Context, resource, resourceID, subresource, id string, payload, data interface{}) error + SubresourceUpdate(rctx context.Context, esource, resourceID, subresource, id string, payload, data interface{}) error + SubresourceDelete(ctx context.Context, resource, resourceID, subresource, id string) error + DoRequest(ctx context.Context, req *APIRequest, data interface{}) error + Do(context.Context, *APIRequest) (*http.Response, error) TokenGenerator() TokenGenerator IsAuthenticatedClient() bool @@ -84,24 +85,24 @@ func NewClient(api string, cfg ClientConfig) Client { return &c } -func (c *client) ResourceGet(resource, resourceID string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c *client) ResourceGet(ctx context.Context, resource, resourceID string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "GET", Endpoint: "/" + resource + "/" + resourceID, Params: payload, }, data) } -func (c *client) ResourceList(resource string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c *client) ResourceList(ctx context.Context, resource string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "GET", Endpoint: "/" + resource, Params: payload, }, data) } -func (c *client) ResourceAdd(resource string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c *client) ResourceAdd(ctx context.Context, resource string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "POST", Endpoint: "/" + resource, Expected: Statuses{201}, @@ -109,40 +110,40 @@ func (c *client) ResourceAdd(resource string, payload, data interface{}) error { }, data) } -func (c client) ResourceUpdate(resource, resourceID string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c client) ResourceUpdate(ctx context.Context, resource, resourceID string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "PATCH", Endpoint: "/" + resource + "/" + resourceID, Params: payload, }, data) } -func (c *client) ResourceDelete(resource, resourceID string) error { - return c.DoRequest(&APIRequest{ +func (c *client) ResourceDelete(ctx context.Context, resource, resourceID string) error { + return c.DoRequest(ctx, &APIRequest{ Method: "DELETE", Endpoint: "/" + resource + "/" + resourceID, Expected: Statuses{204}, }, nil) } -func (c *client) SubresourceGet(resource, resourceID, subresource, id string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c *client) SubresourceGet(ctx context.Context, resource, resourceID, subresource, id string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "GET", Endpoint: "/" + resource + "/" + resourceID + "/" + subresource + "/" + id, Params: payload, }, data) } -func (c *client) SubresourceList(resource, resourceID, subresource string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c *client) SubresourceList(ctx context.Context, resource, resourceID, subresource string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "GET", Endpoint: "/" + resource + "/" + resourceID + "/" + subresource, Params: payload, }, data) } -func (c *client) SubresourceAdd(resource, resourceID, subresource string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c *client) SubresourceAdd(ctx context.Context, resource, resourceID, subresource string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "POST", Endpoint: "/" + resource + "/" + resourceID + "/" + subresource, Expected: Statuses{201}, @@ -150,28 +151,28 @@ func (c *client) SubresourceAdd(resource, resourceID, subresource string, payloa }, data) } -func (c *client) SubresourceDelete(resource, resourceID, subresource, id string) error { - return c.DoRequest(&APIRequest{ +func (c *client) SubresourceDelete(ctx context.Context, resource, resourceID, subresource, id string) error { + return c.DoRequest(ctx, &APIRequest{ Method: "DELETE", Endpoint: "/" + resource + "/" + resourceID + "/" + subresource + "/" + id, Expected: Statuses{204}, }, nil) } -func (c *client) SubresourceUpdate(resource, resourceID, subresource, id string, payload, data interface{}) error { - return c.DoRequest(&APIRequest{ +func (c *client) SubresourceUpdate(ctx context.Context, resource, resourceID, subresource, id string, payload, data interface{}) error { + return c.DoRequest(ctx, &APIRequest{ Method: "PATCH", Endpoint: "/" + resource + "/" + resourceID + "/" + subresource + "/" + id, Params: payload, }, data) } -func (c *client) DoRequest(req *APIRequest, data interface{}) error { +func (c *client) DoRequest(ctx context.Context, req *APIRequest, data interface{}) error { if c.endpoint == "" { return errgo.New("API Endpoint is not defined, did you forget to pass the Region field to the New method?") } - res, err := c.Do(req) + res, err := c.Do(ctx, req) if err != nil { return err } diff --git a/http/httpmock/client_mock.go b/http/httpmock/client_mock.go index 27705e50..2c2b004b 100644 --- a/http/httpmock/client_mock.go +++ b/http/httpmock/client_mock.go @@ -5,6 +5,7 @@ package httpmock import ( + context "context" http0 "net/http" reflect "reflect" @@ -12,30 +13,30 @@ import ( gomock "github.com/golang/mock/gomock" ) -// MockClient is a mock of Client interface +// MockClient is a mock of Client interface. type MockClient struct { ctrl *gomock.Controller recorder *MockClientMockRecorder } -// MockClientMockRecorder is the mock recorder for MockClient +// MockClientMockRecorder is the mock recorder for MockClient. type MockClientMockRecorder struct { mock *MockClient } -// NewMockClient creates a new mock instance +// NewMockClient creates a new mock instance. func NewMockClient(ctrl *gomock.Controller) *MockClient { mock := &MockClient{ctrl: ctrl} mock.recorder = &MockClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockClient) EXPECT() *MockClientMockRecorder { return m.recorder } -// BaseURL mocks base method +// BaseURL mocks base method. func (m *MockClient) BaseURL() string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "BaseURL") @@ -43,42 +44,42 @@ func (m *MockClient) BaseURL() string { return ret0 } -// BaseURL indicates an expected call of BaseURL +// BaseURL indicates an expected call of BaseURL. func (mr *MockClientMockRecorder) BaseURL() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BaseURL", reflect.TypeOf((*MockClient)(nil).BaseURL)) } -// Do mocks base method -func (m *MockClient) Do(arg0 *http.APIRequest) (*http0.Response, error) { +// Do mocks base method. +func (m *MockClient) Do(arg0 context.Context, arg1 *http.APIRequest) (*http0.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Do", arg0) + ret := m.ctrl.Call(m, "Do", arg0, arg1) ret0, _ := ret[0].(*http0.Response) ret1, _ := ret[1].(error) return ret0, ret1 } -// Do indicates an expected call of Do -func (mr *MockClientMockRecorder) Do(arg0 interface{}) *gomock.Call { +// Do indicates an expected call of Do. +func (mr *MockClientMockRecorder) Do(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Do", reflect.TypeOf((*MockClient)(nil).Do), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Do", reflect.TypeOf((*MockClient)(nil).Do), arg0, arg1) } -// DoRequest mocks base method -func (m *MockClient) DoRequest(arg0 *http.APIRequest, arg1 interface{}) error { +// DoRequest mocks base method. +func (m *MockClient) DoRequest(arg0 context.Context, arg1 *http.APIRequest, arg2 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DoRequest", arg0, arg1) + ret := m.ctrl.Call(m, "DoRequest", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// DoRequest indicates an expected call of DoRequest -func (mr *MockClientMockRecorder) DoRequest(arg0, arg1 interface{}) *gomock.Call { +// DoRequest indicates an expected call of DoRequest. +func (mr *MockClientMockRecorder) DoRequest(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DoRequest", reflect.TypeOf((*MockClient)(nil).DoRequest), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DoRequest", reflect.TypeOf((*MockClient)(nil).DoRequest), arg0, arg1, arg2) } -// HTTPClient mocks base method +// HTTPClient mocks base method. func (m *MockClient) HTTPClient() *http0.Client { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "HTTPClient") @@ -86,13 +87,13 @@ func (m *MockClient) HTTPClient() *http0.Client { return ret0 } -// HTTPClient indicates an expected call of HTTPClient +// HTTPClient indicates an expected call of HTTPClient. func (mr *MockClientMockRecorder) HTTPClient() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HTTPClient", reflect.TypeOf((*MockClient)(nil).HTTPClient)) } -// IsAuthenticatedClient mocks base method +// IsAuthenticatedClient mocks base method. func (m *MockClient) IsAuthenticatedClient() bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsAuthenticatedClient") @@ -100,153 +101,153 @@ func (m *MockClient) IsAuthenticatedClient() bool { return ret0 } -// IsAuthenticatedClient indicates an expected call of IsAuthenticatedClient +// IsAuthenticatedClient indicates an expected call of IsAuthenticatedClient. func (mr *MockClientMockRecorder) IsAuthenticatedClient() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAuthenticatedClient", reflect.TypeOf((*MockClient)(nil).IsAuthenticatedClient)) } -// ResourceAdd mocks base method -func (m *MockClient) ResourceAdd(arg0 string, arg1, arg2 interface{}) error { +// ResourceAdd mocks base method. +func (m *MockClient) ResourceAdd(arg0 context.Context, arg1 string, arg2, arg3 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResourceAdd", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ResourceAdd", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 } -// ResourceAdd indicates an expected call of ResourceAdd -func (mr *MockClientMockRecorder) ResourceAdd(arg0, arg1, arg2 interface{}) *gomock.Call { +// ResourceAdd indicates an expected call of ResourceAdd. +func (mr *MockClientMockRecorder) ResourceAdd(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceAdd", reflect.TypeOf((*MockClient)(nil).ResourceAdd), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceAdd", reflect.TypeOf((*MockClient)(nil).ResourceAdd), arg0, arg1, arg2, arg3) } -// ResourceDelete mocks base method -func (m *MockClient) ResourceDelete(arg0, arg1 string) error { +// ResourceDelete mocks base method. +func (m *MockClient) ResourceDelete(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResourceDelete", arg0, arg1) + ret := m.ctrl.Call(m, "ResourceDelete", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// ResourceDelete indicates an expected call of ResourceDelete -func (mr *MockClientMockRecorder) ResourceDelete(arg0, arg1 interface{}) *gomock.Call { +// ResourceDelete indicates an expected call of ResourceDelete. +func (mr *MockClientMockRecorder) ResourceDelete(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceDelete", reflect.TypeOf((*MockClient)(nil).ResourceDelete), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceDelete", reflect.TypeOf((*MockClient)(nil).ResourceDelete), arg0, arg1, arg2) } -// ResourceGet mocks base method -func (m *MockClient) ResourceGet(arg0, arg1 string, arg2, arg3 interface{}) error { +// ResourceGet mocks base method. +func (m *MockClient) ResourceGet(arg0 context.Context, arg1, arg2 string, arg3, arg4 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResourceGet", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "ResourceGet", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(error) return ret0 } -// ResourceGet indicates an expected call of ResourceGet -func (mr *MockClientMockRecorder) ResourceGet(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +// ResourceGet indicates an expected call of ResourceGet. +func (mr *MockClientMockRecorder) ResourceGet(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceGet", reflect.TypeOf((*MockClient)(nil).ResourceGet), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceGet", reflect.TypeOf((*MockClient)(nil).ResourceGet), arg0, arg1, arg2, arg3, arg4) } -// ResourceList mocks base method -func (m *MockClient) ResourceList(arg0 string, arg1, arg2 interface{}) error { +// ResourceList mocks base method. +func (m *MockClient) ResourceList(arg0 context.Context, arg1 string, arg2, arg3 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResourceList", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ResourceList", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 } -// ResourceList indicates an expected call of ResourceList -func (mr *MockClientMockRecorder) ResourceList(arg0, arg1, arg2 interface{}) *gomock.Call { +// ResourceList indicates an expected call of ResourceList. +func (mr *MockClientMockRecorder) ResourceList(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceList", reflect.TypeOf((*MockClient)(nil).ResourceList), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceList", reflect.TypeOf((*MockClient)(nil).ResourceList), arg0, arg1, arg2, arg3) } -// ResourceUpdate mocks base method -func (m *MockClient) ResourceUpdate(arg0, arg1 string, arg2, arg3 interface{}) error { +// ResourceUpdate mocks base method. +func (m *MockClient) ResourceUpdate(arg0 context.Context, arg1, arg2 string, arg3, arg4 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResourceUpdate", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "ResourceUpdate", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(error) return ret0 } -// ResourceUpdate indicates an expected call of ResourceUpdate -func (mr *MockClientMockRecorder) ResourceUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +// ResourceUpdate indicates an expected call of ResourceUpdate. +func (mr *MockClientMockRecorder) ResourceUpdate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceUpdate", reflect.TypeOf((*MockClient)(nil).ResourceUpdate), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceUpdate", reflect.TypeOf((*MockClient)(nil).ResourceUpdate), arg0, arg1, arg2, arg3, arg4) } -// SubresourceAdd mocks base method -func (m *MockClient) SubresourceAdd(arg0, arg1, arg2 string, arg3, arg4 interface{}) error { +// SubresourceAdd mocks base method. +func (m *MockClient) SubresourceAdd(arg0 context.Context, arg1, arg2, arg3 string, arg4, arg5 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SubresourceAdd", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "SubresourceAdd", arg0, arg1, arg2, arg3, arg4, arg5) ret0, _ := ret[0].(error) return ret0 } -// SubresourceAdd indicates an expected call of SubresourceAdd -func (mr *MockClientMockRecorder) SubresourceAdd(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +// SubresourceAdd indicates an expected call of SubresourceAdd. +func (mr *MockClientMockRecorder) SubresourceAdd(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceAdd", reflect.TypeOf((*MockClient)(nil).SubresourceAdd), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceAdd", reflect.TypeOf((*MockClient)(nil).SubresourceAdd), arg0, arg1, arg2, arg3, arg4, arg5) } -// SubresourceDelete mocks base method -func (m *MockClient) SubresourceDelete(arg0, arg1, arg2, arg3 string) error { +// SubresourceDelete mocks base method. +func (m *MockClient) SubresourceDelete(arg0 context.Context, arg1, arg2, arg3, arg4 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SubresourceDelete", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "SubresourceDelete", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(error) return ret0 } -// SubresourceDelete indicates an expected call of SubresourceDelete -func (mr *MockClientMockRecorder) SubresourceDelete(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +// SubresourceDelete indicates an expected call of SubresourceDelete. +func (mr *MockClientMockRecorder) SubresourceDelete(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceDelete", reflect.TypeOf((*MockClient)(nil).SubresourceDelete), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceDelete", reflect.TypeOf((*MockClient)(nil).SubresourceDelete), arg0, arg1, arg2, arg3, arg4) } -// SubresourceGet mocks base method -func (m *MockClient) SubresourceGet(arg0, arg1, arg2, arg3 string, arg4, arg5 interface{}) error { +// SubresourceGet mocks base method. +func (m *MockClient) SubresourceGet(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5, arg6 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SubresourceGet", arg0, arg1, arg2, arg3, arg4, arg5) + ret := m.ctrl.Call(m, "SubresourceGet", arg0, arg1, arg2, arg3, arg4, arg5, arg6) ret0, _ := ret[0].(error) return ret0 } -// SubresourceGet indicates an expected call of SubresourceGet -func (mr *MockClientMockRecorder) SubresourceGet(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +// SubresourceGet indicates an expected call of SubresourceGet. +func (mr *MockClientMockRecorder) SubresourceGet(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceGet", reflect.TypeOf((*MockClient)(nil).SubresourceGet), arg0, arg1, arg2, arg3, arg4, arg5) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceGet", reflect.TypeOf((*MockClient)(nil).SubresourceGet), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } -// SubresourceList mocks base method -func (m *MockClient) SubresourceList(arg0, arg1, arg2 string, arg3, arg4 interface{}) error { +// SubresourceList mocks base method. +func (m *MockClient) SubresourceList(arg0 context.Context, arg1, arg2, arg3 string, arg4, arg5 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SubresourceList", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "SubresourceList", arg0, arg1, arg2, arg3, arg4, arg5) ret0, _ := ret[0].(error) return ret0 } -// SubresourceList indicates an expected call of SubresourceList -func (mr *MockClientMockRecorder) SubresourceList(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +// SubresourceList indicates an expected call of SubresourceList. +func (mr *MockClientMockRecorder) SubresourceList(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceList", reflect.TypeOf((*MockClient)(nil).SubresourceList), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceList", reflect.TypeOf((*MockClient)(nil).SubresourceList), arg0, arg1, arg2, arg3, arg4, arg5) } -// SubresourceUpdate mocks base method -func (m *MockClient) SubresourceUpdate(arg0, arg1, arg2, arg3 string, arg4, arg5 interface{}) error { +// SubresourceUpdate mocks base method. +func (m *MockClient) SubresourceUpdate(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5, arg6 interface{}) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SubresourceUpdate", arg0, arg1, arg2, arg3, arg4, arg5) + ret := m.ctrl.Call(m, "SubresourceUpdate", arg0, arg1, arg2, arg3, arg4, arg5, arg6) ret0, _ := ret[0].(error) return ret0 } -// SubresourceUpdate indicates an expected call of SubresourceUpdate -func (mr *MockClientMockRecorder) SubresourceUpdate(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +// SubresourceUpdate indicates an expected call of SubresourceUpdate. +func (mr *MockClientMockRecorder) SubresourceUpdate(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceUpdate", reflect.TypeOf((*MockClient)(nil).SubresourceUpdate), arg0, arg1, arg2, arg3, arg4, arg5) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceUpdate", reflect.TypeOf((*MockClient)(nil).SubresourceUpdate), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } -// TokenGenerator mocks base method +// TokenGenerator mocks base method. func (m *MockClient) TokenGenerator() http.TokenGenerator { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "TokenGenerator") @@ -254,7 +255,7 @@ func (m *MockClient) TokenGenerator() http.TokenGenerator { return ret0 } -// TokenGenerator indicates an expected call of TokenGenerator +// TokenGenerator indicates an expected call of TokenGenerator. func (mr *MockClientMockRecorder) TokenGenerator() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenGenerator", reflect.TypeOf((*MockClient)(nil).TokenGenerator)) diff --git a/http/tokens.go b/http/tokens.go index 46da528b..04939798 100644 --- a/http/tokens.go +++ b/http/tokens.go @@ -1,5 +1,7 @@ package http +import "context" + type TokenGenerator interface { - GetAccessToken() (string, error) + GetAccessToken(context.Context) (string, error) } diff --git a/http/tokensservicemock/tokensservice_mock.go b/http/tokensservicemock/tokensservice_mock.go index 623bb5d4..5bf08249 100644 --- a/http/tokensservicemock/tokensservice_mock.go +++ b/http/tokensservicemock/tokensservice_mock.go @@ -5,45 +5,46 @@ package tokensservicemock import ( + context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" ) -// MockTokensService is a mock of TokensService interface +// MockTokensService is a mock of TokensService interface. type MockTokensService struct { ctrl *gomock.Controller recorder *MockTokensServiceMockRecorder } -// MockTokensServiceMockRecorder is the mock recorder for MockTokensService +// MockTokensServiceMockRecorder is the mock recorder for MockTokensService. type MockTokensServiceMockRecorder struct { mock *MockTokensService } -// NewMockTokensService creates a new mock instance +// NewMockTokensService creates a new mock instance. func NewMockTokensService(ctrl *gomock.Controller) *MockTokensService { mock := &MockTokensService{ctrl: ctrl} mock.recorder = &MockTokensServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockTokensService) EXPECT() *MockTokensServiceMockRecorder { return m.recorder } -// TokenExchange mocks base method -func (m *MockTokensService) TokenExchange(arg0 string) (string, error) { +// TokenExchange mocks base method. +func (m *MockTokensService) TokenExchange(arg0 context.Context, arg1 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokenExchange", arg0) + ret := m.ctrl.Call(m, "TokenExchange", arg0, arg1) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } -// TokenExchange indicates an expected call of TokenExchange -func (mr *MockTokensServiceMockRecorder) TokenExchange(arg0 interface{}) *gomock.Call { +// TokenExchange indicates an expected call of TokenExchange. +func (mr *MockTokensServiceMockRecorder) TokenExchange(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenExchange", reflect.TypeOf((*MockTokensService)(nil).TokenExchange), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenExchange", reflect.TypeOf((*MockTokensService)(nil).TokenExchange), arg0, arg1) } diff --git a/keys.go b/keys.go index 97553d52..9ed44dbb 100644 --- a/keys.go +++ b/keys.go @@ -1,11 +1,15 @@ package scalingo -import "gopkg.in/errgo.v1" +import ( + "context" + + "gopkg.in/errgo.v1" +) type KeysService interface { - KeysList() ([]Key, error) - KeysAdd(name string, content string) (*Key, error) - KeysDelete(id string) error + KeysList(context.Context) ([]Key, error) + KeysAdd(ctx context.Context, name string, content string) (*Key, error) + KeysDelete(ctx context.Context, id string) error } var _ KeysService = (*Client)(nil) @@ -24,23 +28,23 @@ type KeysRes struct { Keys []Key `json:"keys"` } -func (c *Client) KeysList() ([]Key, error) { +func (c *Client) KeysList(ctx context.Context) ([]Key, error) { var res KeysRes - err := c.AuthAPI().ResourceList("keys", nil, &res) + err := c.AuthAPI().ResourceList(ctx, "keys", nil, &res) if err != nil { return nil, errgo.Mask(err) } return res.Keys, nil } -func (c *Client) KeysAdd(name string, content string) (*Key, error) { +func (c *Client) KeysAdd(ctx context.Context, name string, content string) (*Key, error) { payload := KeyRes{Key{ Name: name, Content: content, }} var res KeyRes - err := c.AuthAPI().ResourceAdd("keys", payload, &res) + err := c.AuthAPI().ResourceAdd(ctx, "keys", payload, &res) if err != nil { return nil, errgo.Mask(err) } @@ -48,8 +52,8 @@ func (c *Client) KeysAdd(name string, content string) (*Key, error) { return &res.Key, nil } -func (c *Client) KeysDelete(id string) error { - err := c.AuthAPI().ResourceDelete("keys", id) +func (c *Client) KeysDelete(ctx context.Context, id string) error { + err := c.AuthAPI().ResourceDelete(ctx, "keys", id) if err != nil { return errgo.Mask(err) } diff --git a/log_drains.go b/log_drains.go index aeecdd59..c8304e3d 100644 --- a/log_drains.go +++ b/log_drains.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "net/http" "gopkg.in/errgo.v1" @@ -9,12 +10,12 @@ import ( ) type LogDrainsService interface { - LogDrainsList(app string) ([]LogDrain, error) - LogDrainAdd(app string, params LogDrainAddParams) (*LogDrainRes, error) - LogDrainRemove(app, URL string) error - LogDrainAddonRemove(app, addonID string, URL string) error - LogDrainsAddonList(app string, addonID string) ([]LogDrain, error) - LogDrainAddonAdd(app string, addonID string, params LogDrainAddParams) (*LogDrainRes, error) + LogDrainsList(ctx context.Context, app string) ([]LogDrain, error) + LogDrainAdd(ctx context.Context, app string, params LogDrainAddParams) (*LogDrainRes, error) + LogDrainRemove(ctx context.Context, app, URL string) error + LogDrainAddonRemove(ctx context.Context, app, addonID string, URL string) error + LogDrainsAddonList(ctx context.Context, app string, addonID string) ([]LogDrain, error) + LogDrainAddonAdd(ctx context.Context, app string, addonID string, params LogDrainAddParams) (*LogDrainRes, error) } var _ LogDrainsService = (*Client)(nil) @@ -32,19 +33,19 @@ type LogDrainsRes struct { Drains []LogDrain `json:"drains"` } -func (c *Client) LogDrainsList(app string) ([]LogDrain, error) { +func (c *Client) LogDrainsList(ctx context.Context, app string) ([]LogDrain, error) { var logDrainsRes LogDrainsRes - err := c.ScalingoAPI().SubresourceList("apps", app, "log_drains", nil, &logDrainsRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "log_drains", nil, &logDrainsRes) if err != nil { return nil, errgo.Notef(err, "fail to list the log drains") } return logDrainsRes.Drains, nil } -func (c *Client) LogDrainsAddonList(app string, addonID string) ([]LogDrain, error) { +func (c *Client) LogDrainsAddonList(ctx context.Context, app string, addonID string) ([]LogDrain, error) { var logDrainsRes LogDrainsRes - err := c.ScalingoAPI().SubresourceList("apps", app, "addons/"+addonID+"/log_drains", nil, &logDrainsRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "addons/"+addonID+"/log_drains", nil, &logDrainsRes) if err != nil { return nil, errgo.Notef(err, "fail to list the log drains of the addon %s", addonID) } @@ -64,13 +65,13 @@ type LogDrainAddParams struct { DrainRegion string `json:"drain_region"` } -func (c *Client) LogDrainAdd(app string, params LogDrainAddParams) (*LogDrainRes, error) { +func (c *Client) LogDrainAdd(ctx context.Context, app string, params LogDrainAddParams) (*LogDrainRes, error) { var logDrainRes LogDrainRes payload := LogDrainAddPayload{ Drain: params, } - err := c.ScalingoAPI().SubresourceAdd("apps", app, "log_drains", payload, &logDrainRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "log_drains", payload, &logDrainRes) if err != nil { return nil, errgo.Notef(err, "fail to add drain") } @@ -78,7 +79,7 @@ func (c *Client) LogDrainAdd(app string, params LogDrainAddParams) (*LogDrainRes return &logDrainRes, nil } -func (c *Client) LogDrainRemove(app, URL string) error { +func (c *Client) LogDrainRemove(ctx context.Context, app, URL string) error { payload := map[string]string{ "url": URL, } @@ -90,7 +91,7 @@ func (c *Client) LogDrainRemove(app, URL string) error { Params: payload, } - err := c.ScalingoAPI().DoRequest(req, nil) + err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { return errgo.Notef(err, "fail to delete log drain") } @@ -98,7 +99,7 @@ func (c *Client) LogDrainRemove(app, URL string) error { return nil } -func (c *Client) LogDrainAddonRemove(app, addonID string, URL string) error { +func (c *Client) LogDrainAddonRemove(ctx context.Context, app, addonID string, URL string) error { payload := map[string]string{ "url": URL, } @@ -110,7 +111,7 @@ func (c *Client) LogDrainAddonRemove(app, addonID string, URL string) error { Params: payload, } - err := c.ScalingoAPI().DoRequest(req, nil) + err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { return errgo.Notef(err, "fail to delete log drain %s from the addon %s", URL, addonID) } @@ -118,13 +119,13 @@ func (c *Client) LogDrainAddonRemove(app, addonID string, URL string) error { return nil } -func (c *Client) LogDrainAddonAdd(app string, addonID string, params LogDrainAddParams) (*LogDrainRes, error) { +func (c *Client) LogDrainAddonAdd(ctx context.Context, app string, addonID string, params LogDrainAddParams) (*LogDrainRes, error) { var logDrainRes LogDrainRes payload := LogDrainAddPayload{ Drain: params, } - err := c.ScalingoAPI().SubresourceAdd("apps", app, "addons/"+addonID+"/log_drains", payload, &logDrainRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "addons/"+addonID+"/log_drains", payload, &logDrainRes) if err != nil { return nil, errgo.Notef(err, "fail to add log drain to the addon %s", addonID) } diff --git a/log_drains_test.go b/log_drains_test.go index c3937b83..6d374897 100644 --- a/log_drains_test.go +++ b/log_drains_test.go @@ -1,17 +1,19 @@ package scalingo import ( + "context" "encoding/json" "net/http" "net/http/httptest" "testing" - gomock "github.com/golang/mock/gomock" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestLogDrainsClient(t *testing.T) { + ctx := context.Background() appName := "my-app" logDrainID := "my-id" logDrainURL := "tcp+tls://localhost:8080" @@ -29,7 +31,7 @@ func TestLogDrainsClient(t *testing.T) { { action: "list", testedClientCall: func(c LogDrainsService) error { - _, err := c.LogDrainsList(appName) + _, err := c.LogDrainsList(ctx, appName) return err }, expectedEndpoint: "/v1/apps/my-app/log_drains", @@ -45,7 +47,7 @@ func TestLogDrainsClient(t *testing.T) { { action: "addon list", testedClientCall: func(c LogDrainsService) error { - _, err := c.LogDrainsAddonList(appName, addonID) + _, err := c.LogDrainsAddonList(ctx, appName, addonID) return err }, expectedEndpoint: "/v1/apps/my-app/addons/" + addonID + "/log_drains", @@ -61,7 +63,7 @@ func TestLogDrainsClient(t *testing.T) { { action: "add", testedClientCall: func(c LogDrainsService) error { - _, err := c.LogDrainAdd(appName, LogDrainAddParams{ + _, err := c.LogDrainAdd(ctx, appName, LogDrainAddParams{ Type: "syslog", Host: "localhost", Port: "8080", @@ -79,7 +81,7 @@ func TestLogDrainsClient(t *testing.T) { { action: "addon add", testedClientCall: func(c LogDrainsService) error { - _, err := c.LogDrainAddonAdd(appName, addonID, LogDrainAddParams{ + _, err := c.LogDrainAddonAdd(ctx, appName, addonID, LogDrainAddParams{ Type: "syslog", Host: "localhost", Port: "8080", @@ -97,7 +99,7 @@ func TestLogDrainsClient(t *testing.T) { { action: "remove", testedClientCall: func(c LogDrainsService) error { - err := c.LogDrainRemove(appName, logDrainURL) + err := c.LogDrainRemove(ctx, appName, logDrainURL) return err }, expectedEndpoint: "/v1/apps/my-app/log_drains", @@ -108,7 +110,7 @@ func TestLogDrainsClient(t *testing.T) { { action: "addon remove", testedClientCall: func(c LogDrainsService) error { - err := c.LogDrainAddonRemove(appName, addonID, logDrainURL) + err := c.LogDrainAddonRemove(ctx, appName, addonID, logDrainURL) return err }, expectedEndpoint: "/v1/apps/my-app/addons/" + addonID + "/log_drains", @@ -151,7 +153,7 @@ func TestLogDrainsClient(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(handler)) defer ts.Close() - c, err := New(ClientConfig{ + c, err := New(ctx, ClientConfig{ APIEndpoint: ts.URL, APIToken: "test", }) diff --git a/login.go b/login.go index ddf10411..a147e166 100644 --- a/login.go +++ b/login.go @@ -1,16 +1,17 @@ package scalingo import ( + "context" "encoding/json" "fmt" - "github.com/Scalingo/go-scalingo/v4/http" - "gopkg.in/errgo.v1" + + "github.com/Scalingo/go-scalingo/v4/http" ) type LoginService interface { - Login(email, password string) (*LoginResponse, error) + Login(ctx context.Context, email, password string) (*LoginResponse, error) } var _ LoginService = (*Client)(nil) @@ -28,7 +29,7 @@ func (err *LoginError) Error() string { return err.Message } -func (c *Client) Login(email, password string) (*LoginResponse, error) { +func (c *Client) Login(ctx context.Context, email, password string) (*LoginResponse, error) { fmt.Println("[GO-SCALINGO] You are using the Login method. This method is deprecated, please use the OAuth flow") req := &http.APIRequest{ NoAuth: true, @@ -42,7 +43,7 @@ func (c *Client) Login(email, password string) (*LoginResponse, error) { }, }, } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, errgo.NoteMask(err, "fail to login", errgo.Any) } diff --git a/logs-archives.go b/logs-archives.go index e960b047..44609c75 100644 --- a/logs-archives.go +++ b/logs-archives.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "io" "strconv" @@ -11,8 +12,8 @@ import ( ) type LogsArchivesService interface { - LogsArchivesByCursor(app string, cursor string) (*LogsArchivesResponse, error) - LogsArchives(app string, page int) (*LogsArchivesResponse, error) + LogsArchivesByCursor(ctx context.Context, app string, cursor string) (*LogsArchivesResponse, error) + LogsArchives(ctx context.Context, app string, page int) (*LogsArchivesResponse, error) } var _ LogsArchivesService = (*Client)(nil) @@ -30,7 +31,7 @@ type LogsArchivesResponse struct { Archives []LogsArchiveItem `json:"archives"` } -func (c *Client) LogsArchivesByCursor(app string, cursor string) (*LogsArchivesResponse, error) { +func (c *Client) LogsArchivesByCursor(ctx context.Context, app string, cursor string) (*LogsArchivesResponse, error) { req := &http.APIRequest{ Endpoint: "/apps/" + app + "/logs_archives", Params: map[string]string{ @@ -38,10 +39,11 @@ func (c *Client) LogsArchivesByCursor(app string, cursor string) (*LogsArchivesR }, } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, errgo.Mask(err) } + defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { @@ -57,7 +59,7 @@ func (c *Client) LogsArchivesByCursor(app string, cursor string) (*LogsArchivesR return &logsRes, nil } -func (c *Client) LogsArchives(app string, page int) (*LogsArchivesResponse, error) { +func (c *Client) LogsArchives(ctx context.Context, app string, page int) (*LogsArchivesResponse, error) { if page < 1 { return nil, errgo.New("Page must be greater than 0.") } @@ -69,7 +71,7 @@ func (c *Client) LogsArchives(app string, page int) (*LogsArchivesResponse, erro }, } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, errgo.Mask(err) } diff --git a/logs.go b/logs.go index 20a7fc10..1d5edec1 100644 --- a/logs.go +++ b/logs.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "net/http" "net/url" @@ -10,20 +11,20 @@ import ( ) type LogsService interface { - LogsURL(app string) (*http.Response, error) - Logs(logsURL string, n int, filter string) (*http.Response, error) + LogsURL(ctx context.Context, app string) (*http.Response, error) + Logs(ctx context.Context, logsURL string, n int, filter string) (*http.Response, error) } var _ LogsService = (*Client)(nil) -func (c *Client) LogsURL(app string) (*http.Response, error) { +func (c *Client) LogsURL(ctx context.Context, app string) (*http.Response, error) { req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/logs", } - return c.ScalingoAPI().Do(req) + return c.ScalingoAPI().Do(ctx, req) } -func (c *Client) Logs(logsURL string, n int, filter string) (*http.Response, error) { +func (c *Client) Logs(ctx context.Context, logsURL string, n int, filter string) (*http.Response, error) { u, err := url.Parse(logsURL) if err != nil { return nil, errgo.Mask(err) @@ -39,5 +40,5 @@ func (c *Client) Logs(logsURL string, n int, filter string) (*http.Response, err "filter": filter, }, } - return c.ScalingoAPI().Do(req) + return c.ScalingoAPI().Do(ctx, req) } diff --git a/mocks_sig.json b/mocks_sig.json index 5d638fa5..5177231f 100644 --- a/mocks_sig.json +++ b/mocks_sig.json @@ -1,35 +1,35 @@ { "github.com/Scalingo/go-scalingo.API": "FORCE_REGENERATE", - "github.com/Scalingo/go-scalingo.AddonProvidersService": "84 c0 e6 0e c4 9d 80 57 79 b4 47 c0 79 c8 2e 51 b9 f9 64 c9", - "github.com/Scalingo/go-scalingo.AddonsService": "3d 31 10 00 28 16 00 8d 69 aa 21 19 7a bc dd 59 41 f4 1f 6d", - "github.com/Scalingo/go-scalingo.AlertsService": "8f 72 2e 6a 5f 31 c7 26 7c 09 10 93 38 d2 eb 6e 5a 26 ed 62", - "github.com/Scalingo/go-scalingo.AppsService": "1f 2b a9 dc 2b 84 7e ed 6f b2 ce 54 3f 95 f0 a7 7f 99 e9 7f", - "github.com/Scalingo/go-scalingo.AutoscalersService": "fe 33 e3 88 66 3e 25 c1 40 79 fc 01 6c aa 19 5e ce f6 f1 e7", - "github.com/Scalingo/go-scalingo.BackupsService": "fd c3 88 a9 d7 18 80 fa 25 a8 fc ca 9c a1 40 2e 2d 26 ea 36", - "github.com/Scalingo/go-scalingo.CollaboratorsService": "f7 7e 83 62 5b 67 9c 6c aa 79 f5 94 c7 90 d8 3f f8 42 95 81", - "github.com/Scalingo/go-scalingo.ContainerSizesService": "f4 b8 33 47 79 4f a6 76 96 a8 53 c4 67 0f 95 50 95 da 3b f6", - "github.com/Scalingo/go-scalingo.ContainersService": "99 3d 27 af 4a bb b2 96 d9 7a e9 1a 40 6b eb 66 bb 9b 72 03", - "github.com/Scalingo/go-scalingo.CronTasksService": "fa a6 29 83 98 5e 10 22 8c 87 3f fb 91 35 cd fb f2 8b 89 de", - "github.com/Scalingo/go-scalingo.DeploymentsService": "e3 3d 3b 12 fd 76 aa ac 2c 6b c4 75 bb 04 ee 11 cd 44 1f 48", - "github.com/Scalingo/go-scalingo.DomainsService": "e6 ac fe a0 8d 5d bf cf 74 06 d8 96 28 d1 93 24 a9 a5 c7 20", - "github.com/Scalingo/go-scalingo.EventsService": "61 1a ac 54 41 28 f4 7b 66 09 e1 fd 35 79 29 70 f2 a6 5a 61", - "github.com/Scalingo/go-scalingo.KeysService": "0c 8e c5 b3 f6 66 f0 f2 77 00 69 1e a5 a5 df 25 d7 2e 70 37", - "github.com/Scalingo/go-scalingo.LogDrainsService": "1f 6c b7 8e a1 b9 fd 25 ae 5d 20 2b 52 c8 fd a6 09 ef 22 89", - "github.com/Scalingo/go-scalingo.LoginService": "cb 29 02 54 e3 97 cb f0 93 1b 71 3d b6 4e 00 e0 01 4c d8 ae", - "github.com/Scalingo/go-scalingo.LogsArchivesService": "7b 15 9d 8b 22 0f 4e 76 f7 cd 5f 77 2b 5a 20 60 f4 9f 9f 75", - "github.com/Scalingo/go-scalingo.LogsService": "74 62 24 af 28 88 67 16 15 a5 f7 90 42 2a 71 09 bb 19 aa a4", - "github.com/Scalingo/go-scalingo.NotificationPlatformsService": "e3 f0 7b 0f 01 c3 98 1f c5 17 ae 50 b5 da 00 88 b5 45 88 40", - "github.com/Scalingo/go-scalingo.NotifiersService": "2a b8 12 f4 67 cb e9 c8 d3 82 f7 f0 6e fb c6 a9 c3 a5 d6 0d", - "github.com/Scalingo/go-scalingo.OperationsService": "27 e6 55 69 6a ff 74 7a 7f 37 b1 9d 96 41 68 41 51 bf c5 33", - "github.com/Scalingo/go-scalingo.RegionMigrationsService": "ed 50 aa c2 e6 58 be fe ce 17 d5 0d df 91 b1 47 bf 55 88 04", - "github.com/Scalingo/go-scalingo.RegionsService": "d2 55 32 ef 32 50 5a 93 b3 26 4e c5 b5 31 21 b7 73 93 e7 ff", - "github.com/Scalingo/go-scalingo.RunsService": "55 f8 2c 5d f5 fb 99 10 d1 90 bb 33 45 3b db f5 fd 11 6d f7", - "github.com/Scalingo/go-scalingo.SCMRepoLinkService": "d6 88 be ed 23 13 c4 a0 32 06 8b 9b 1f 22 53 14 27 90 15 cb", - "github.com/Scalingo/go-scalingo.SignUpService": "fa 3a 32 a3 5a 34 f1 d6 05 2b d3 75 9d c9 5a cc 36 e9 16 10", - "github.com/Scalingo/go-scalingo.SourcesService": "f7 49 05 a0 75 6b a3 55 98 5b b5 8c 9c bc 6c d4 f4 7a aa 53", - "github.com/Scalingo/go-scalingo.TokensService": "ef 7a fa 50 20 42 e6 3d 43 cf 7f 61 a7 03 04 ed 8d 77 b0 9b", - "github.com/Scalingo/go-scalingo.UsersService": "26 6b b3 c2 50 d6 82 42 ab c5 7a 9b 19 d9 c9 2f 52 f5 f1 c0", - "github.com/Scalingo/go-scalingo.VariablesService": "25 4e f1 b5 59 14 1a f4 a8 62 8d 58 6b e6 ce 15 99 cb cb d7", - "github.com/Scalingo/go-scalingo/http.Client": "b9 36 b9 0f 07 fc 0b e2 7e 54 90 d3 9c 9c 95 b8 20 82 41 77", - "github.com/Scalingo/go-scalingo/http.TokensService": "dc 4a 63 7e df 41 96 3f c6 9f d1 ee bf 9f c8 f7 25 75 e2 cb" + "github.com/Scalingo/go-scalingo.AddonProvidersService": "1b 30 45 96 1b 58 41 b8 06 55 b0 8a 42 81 fb d7 55 20 df f4", + "github.com/Scalingo/go-scalingo.AddonsService": "e5 fd 9a 36 39 fc 08 7d 37 ef 0d a9 5c a5 ba dc 53 db e8 39", + "github.com/Scalingo/go-scalingo.AlertsService": "31 44 7d d3 3f 5b 0b 61 26 03 79 65 a2 16 77 a1 66 66 e8 05", + "github.com/Scalingo/go-scalingo.AppsService": "fc 6c 24 07 be a2 cb 9b 58 65 7b 27 a1 2f c3 2c c5 42 31 d2", + "github.com/Scalingo/go-scalingo.AutoscalersService": "9f cf 1b 7a dc 9d e3 d3 62 89 41 0f d4 30 83 28 7b 40 f1 72", + "github.com/Scalingo/go-scalingo.BackupsService": "66 59 74 49 68 65 69 e4 b0 97 8e a2 45 e6 ff fc 71 85 06 16", + "github.com/Scalingo/go-scalingo.CollaboratorsService": "b2 c5 1f df 12 d0 a9 44 da f5 ee 8c 83 ba 80 3e 32 98 eb 84", + "github.com/Scalingo/go-scalingo.ContainerSizesService": "e2 db 25 a1 01 52 dc e9 6f 7b f4 59 68 95 86 b9 5e 39 8a 61", + "github.com/Scalingo/go-scalingo.ContainersService": "ef 14 ae 81 c9 b4 6a 13 48 e8 bf 44 7d b5 b2 a6 4d e5 02 11", + "github.com/Scalingo/go-scalingo.CronTasksService": "9b d9 a3 ca 9f 9a f7 73 cb b1 aa 80 df 90 21 ff 14 92 b4 4d", + "github.com/Scalingo/go-scalingo.DeploymentsService": "aa b5 25 87 ff f0 d2 9f 3a 32 42 2d d6 02 33 5f 63 14 2b 9a", + "github.com/Scalingo/go-scalingo.DomainsService": "12 f0 eb 67 20 78 0e cc 8b b0 fc ea 5e 55 5c 24 8f 58 41 60", + "github.com/Scalingo/go-scalingo.EventsService": "29 cf 29 33 fb 33 ce 86 3b 49 db ae 25 2d 5d 22 d6 60 21 95", + "github.com/Scalingo/go-scalingo.KeysService": "b9 5f 5d 8e 88 9d db 82 d6 69 e5 bd 94 6c 7e 08 14 69 23 48", + "github.com/Scalingo/go-scalingo.LogDrainsService": "d4 05 d0 5e a7 7f b7 3e 58 19 07 8d 25 c5 af ca dc d3 6e d9", + "github.com/Scalingo/go-scalingo.LoginService": "f9 91 68 50 36 0a 09 aa 5d 18 7e 3d 1a bf fe 7e e1 45 79 fd", + "github.com/Scalingo/go-scalingo.LogsArchivesService": "35 b6 c3 7b 41 1a 47 5c 3c df ab a6 d6 93 1e 6e b1 b1 f9 11", + "github.com/Scalingo/go-scalingo.LogsService": "19 3c 84 31 5a a6 7b 8f af 8a 9a 89 d5 5f 9b b8 50 75 9e b7", + "github.com/Scalingo/go-scalingo.NotificationPlatformsService": "9b a8 93 13 ed 36 09 92 be dc cb 95 17 02 93 28 18 53 ae 01", + "github.com/Scalingo/go-scalingo.NotifiersService": "b7 82 f2 c1 a1 81 70 05 ed 5a 65 c0 56 13 de 6e 2c 13 ca 1f", + "github.com/Scalingo/go-scalingo.OperationsService": "28 1a bc 62 4c bd 9f e2 ef 45 90 7f 0d 82 5f 30 23 07 93 2a", + "github.com/Scalingo/go-scalingo.RegionMigrationsService": "79 37 8f 49 6a 2f 79 d7 91 a7 6b 5c 8a 8f 66 54 5d 32 0f 5d", + "github.com/Scalingo/go-scalingo.RegionsService": "bc d0 b0 22 5b 7c df 31 02 b7 b3 4d 1f b4 9a 88 a2 7c 8a 6a", + "github.com/Scalingo/go-scalingo.RunsService": "b3 27 40 57 21 c2 64 f8 08 89 c9 0e 06 45 0d 1b ff 5b 5a 45", + "github.com/Scalingo/go-scalingo.SCMRepoLinkService": "bd d9 5a a3 19 18 70 9e 5c 0e 18 a3 76 ea 6e 9d d1 19 18 41", + "github.com/Scalingo/go-scalingo.SignUpService": "ae 46 80 88 8e b6 bd c3 ea d9 2c e5 d4 b5 37 ac a9 e8 4f cf", + "github.com/Scalingo/go-scalingo.SourcesService": "05 1f 06 73 0a 43 2a 6a 35 d2 b9 41 d2 be 8e 7c ad b0 63 3e", + "github.com/Scalingo/go-scalingo.TokensService": "32 2d 05 42 b4 9c a9 3b 1b 6c ce 0e da 18 cf 6f 8f cb fc 2a", + "github.com/Scalingo/go-scalingo.UsersService": "9e c5 75 1e aa 05 dd a7 a3 17 5f 4e 82 80 e2 34 55 a2 70 df", + "github.com/Scalingo/go-scalingo.VariablesService": "77 27 0b 8a 6b ac c9 c8 c3 b0 e0 f8 cf 7d 6e a0 63 9d 95 03", + "github.com/Scalingo/go-scalingo/http.Client": "38 db 18 6f d4 6d e3 3c 4f 78 81 7c 96 b3 50 cf 23 47 14 1b", + "github.com/Scalingo/go-scalingo/http.TokensService": "e0 cf 0b 06 6f 07 a7 2b f2 c9 14 0f 3e aa d1 6b 83 5b 95 73" } \ No newline at end of file diff --git a/notification_platforms.go b/notification_platforms.go index d64ff9c9..c7d4e999 100644 --- a/notification_platforms.go +++ b/notification_platforms.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "gopkg.in/errgo.v1" @@ -10,8 +11,8 @@ import ( ) type NotificationPlatformsService interface { - NotificationPlatformsList() ([]*NotificationPlatform, error) - NotificationPlatformByName(name string) ([]*NotificationPlatform, error) + NotificationPlatformsList(context.Context) ([]*NotificationPlatform, error) + NotificationPlatformByName(ctx context.Context, name string) ([]*NotificationPlatform, error) } var _ NotificationPlatformsService = (*Client)(nil) @@ -33,12 +34,12 @@ type PlatformsRes struct { NotificationPlatforms []*NotificationPlatform `json:"notification_platforms"` } -func (c *Client) NotificationPlatformsList() ([]*NotificationPlatform, error) { +func (c *Client) NotificationPlatformsList(ctx context.Context) ([]*NotificationPlatform, error) { req := &http.APIRequest{ NoAuth: true, Endpoint: "/notification_platforms", } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, errgo.Mask(err) } @@ -53,14 +54,14 @@ func (c *Client) NotificationPlatformsList() ([]*NotificationPlatform, error) { return response.NotificationPlatforms, nil } -func (c *Client) NotificationPlatformByName(name string) ([]*NotificationPlatform, error) { +func (c *Client) NotificationPlatformByName(ctx context.Context, name string) ([]*NotificationPlatform, error) { debug.Printf("[NotificationPlatformByName] name: %s", name) req := &http.APIRequest{ NoAuth: true, Endpoint: "/notification_platforms/search", Params: map[string]string{"name": name}, } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, errgo.Mask(err) } diff --git a/notifiers.go b/notifiers.go index 21a45ae2..333b2bca 100644 --- a/notifiers.go +++ b/notifiers.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "time" @@ -10,11 +11,11 @@ import ( ) type NotifiersService interface { - NotifiersList(app string) (Notifiers, error) - NotifierProvision(app string, params NotifierParams) (*Notifier, error) - NotifierByID(app, ID string) (*Notifier, error) - NotifierUpdate(app, ID string, params NotifierParams) (*Notifier, error) - NotifierDestroy(app, ID string) error + NotifiersList(ctx context.Context, app string) (Notifiers, error) + NotifierProvision(ctx context.Context, app string, params NotifierParams) (*Notifier, error) + NotifierByID(ctx context.Context, app, ID string) (*Notifier, error) + NotifierUpdate(ctx context.Context, app, ID string, params NotifierParams) (*Notifier, error) + NotifierDestroy(ctx context.Context, app, ID string) error } var _ NotifiersService = (*Client)(nil) @@ -66,9 +67,9 @@ type notifiersRequestRes struct { Notifiers []*Notifier `json:"notifiers"` } -func (c *Client) NotifiersList(app string) (Notifiers, error) { +func (c *Client) NotifiersList(ctx context.Context, app string) (Notifiers, error) { var notifiersRes notifiersRequestRes - err := c.ScalingoAPI().SubresourceList("apps", app, "notifiers", nil, ¬ifiersRes) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "notifiers", nil, ¬ifiersRes) if err != nil { return nil, errgo.Mask(err) } @@ -79,12 +80,12 @@ func (c *Client) NotifiersList(app string) (Notifiers, error) { return notifiers, nil } -func (c *Client) NotifierProvision(app string, params NotifierParams) (*Notifier, error) { +func (c *Client) NotifierProvision(ctx context.Context, app string, params NotifierParams) (*Notifier, error) { var notifierRes notifierRequestRes notifier := newOutputNotifier(params) notifierRequestParams := ¬ifierRequestParams{notifier} - err := c.ScalingoAPI().SubresourceAdd("apps", app, "notifiers", notifierRequestParams, ¬ifierRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "notifiers", notifierRequestParams, ¬ifierRes) if err != nil { return nil, errgo.Mask(err, errgo.Any) @@ -92,9 +93,9 @@ func (c *Client) NotifierProvision(app string, params NotifierParams) (*Notifier return ¬ifierRes.Notifier, nil } -func (c *Client) NotifierByID(app, ID string) (*Notifier, error) { +func (c *Client) NotifierByID(ctx context.Context, app, ID string) (*Notifier, error) { var notifierRes notifierRequestRes - err := c.ScalingoAPI().SubresourceGet("apps", app, "notifiers", ID, nil, ¬ifierRes) + err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "notifiers", ID, nil, ¬ifierRes) if err != nil { return nil, errgo.Mask(err) } @@ -102,20 +103,20 @@ func (c *Client) NotifierByID(app, ID string) (*Notifier, error) { return ¬ifierRes.Notifier, nil } -func (c *Client) NotifierUpdate(app, ID string, params NotifierParams) (*Notifier, error) { +func (c *Client) NotifierUpdate(ctx context.Context, app, ID string, params NotifierParams) (*Notifier, error) { var notifierRes notifierRequestRes notifier := newOutputNotifier(params) notifierRequestParams := ¬ifierRequestParams{notifier} debug.Printf("[Notifier params]\n%+v", notifier) - err := c.ScalingoAPI().SubresourceUpdate("apps", app, "notifiers", ID, notifierRequestParams, ¬ifierRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "notifiers", ID, notifierRequestParams, ¬ifierRes) if err != nil { return nil, errgo.Mask(err, errgo.Any) } return ¬ifierRes.Notifier, nil } -func (c *Client) NotifierDestroy(app, ID string) error { - return c.ScalingoAPI().SubresourceDelete("apps", app, "notifiers", ID) +func (c *Client) NotifierDestroy(ctx context.Context, app, ID string) error { + return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "notifiers", ID) } diff --git a/operations.go b/operations.go index c12aace3..db82df71 100644 --- a/operations.go +++ b/operations.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "time" "gopkg.in/errgo.v1" @@ -9,7 +10,7 @@ import ( ) type OperationsService interface { - OperationsShow(app string, opID string) (*Operation, error) + OperationsShow(ctx context.Context, app, opID string) (*Operation, error) } var _ OperationsService = (*Client)(nil) @@ -48,9 +49,9 @@ func (op *Operation) ElapsedDuration() float64 { return op.FinishedAt.Sub(op.CreatedAt).Seconds() } -func (c *Client) OperationsShowFromURL(url string) (*Operation, error) { +func (c *Client) OperationsShowFromURL(ctx context.Context, url string) (*Operation, error) { var opRes OperationResponse - err := c.ScalingoAPI().DoRequest(&httpclient.APIRequest{ + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ Method: "GET", URL: url, }, &opRes) if err != nil { @@ -59,9 +60,9 @@ func (c *Client) OperationsShowFromURL(url string) (*Operation, error) { return &opRes.Op, nil } -func (c *Client) OperationsShow(app string, opID string) (*Operation, error) { +func (c *Client) OperationsShow(ctx context.Context, app, opID string) (*Operation, error) { var opRes OperationResponse - err := c.ScalingoAPI().SubresourceGet("apps", app, "operations", opID, nil, &opRes) + err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "operations", opID, nil, &opRes) if err != nil { return nil, errgo.Mask(err) } diff --git a/region_migrations.go b/region_migrations.go index 852c8ce0..f1d3fbe2 100644 --- a/region_migrations.go +++ b/region_migrations.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "time" "gopkg.in/errgo.v1" @@ -32,10 +33,10 @@ const ( ) type RegionMigrationsService interface { - CreateRegionMigration(appID string, params RegionMigrationParams) (RegionMigration, error) - RunRegionMigrationStep(appID, migrationID string, step RegionMigrationStep) error - ShowRegionMigration(appID, migrationID string) (RegionMigration, error) - ListRegionMigrations(appID string) ([]RegionMigration, error) + CreateRegionMigration(ctx context.Context, appID string, params RegionMigrationParams) (RegionMigration, error) + RunRegionMigrationStep(ctx context.Context, appID, migrationID string, step RegionMigrationStep) error + ShowRegionMigration(ctx context.Context, appID, migrationID string) (RegionMigration, error) + ListRegionMigrations(ctx context.Context, appID string) ([]RegionMigration, error) } type RegionMigrationParams struct { @@ -69,10 +70,10 @@ type Step struct { Logs string `json:"logs"` } -func (c *Client) CreateRegionMigration(appID string, params RegionMigrationParams) (RegionMigration, error) { +func (c *Client) CreateRegionMigration(ctx context.Context, appID string, params RegionMigrationParams) (RegionMigration, error) { var migration RegionMigration - err := c.ScalingoAPI().SubresourceAdd("apps", appID, "region_migrations", map[string]RegionMigrationParams{ + err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", appID, "region_migrations", map[string]RegionMigrationParams{ "migration": params, }, &migration) if err != nil { @@ -82,8 +83,8 @@ func (c *Client) CreateRegionMigration(appID string, params RegionMigrationParam return migration, nil } -func (c *Client) RunRegionMigrationStep(appID, migrationID string, step RegionMigrationStep) error { - err := c.ScalingoAPI().DoRequest(&http.APIRequest{ +func (c *Client) RunRegionMigrationStep(ctx context.Context, appID, migrationID string, step RegionMigrationStep) error { + err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + appID + "/region_migrations/" + migrationID + "/run", Params: map[string]RegionMigrationStep{"step": step}, @@ -95,10 +96,10 @@ func (c *Client) RunRegionMigrationStep(appID, migrationID string, step RegionMi return nil } -func (c *Client) ShowRegionMigration(appID, migrationID string) (RegionMigration, error) { +func (c *Client) ShowRegionMigration(ctx context.Context, appID, migrationID string) (RegionMigration, error) { var migration RegionMigration - err := c.ScalingoAPI().SubresourceGet("apps", appID, "region_migrations", migrationID, nil, &migration) + err := c.ScalingoAPI().SubresourceGet(ctx, "apps", appID, "region_migrations", migrationID, nil, &migration) if err != nil { return migration, errgo.Notef(err, "fail to get migration") } @@ -106,10 +107,10 @@ func (c *Client) ShowRegionMigration(appID, migrationID string) (RegionMigration return migration, nil } -func (c *Client) ListRegionMigrations(appID string) ([]RegionMigration, error) { +func (c *Client) ListRegionMigrations(ctx context.Context, appID string) ([]RegionMigration, error) { var migrations []RegionMigration - err := c.ScalingoAPI().SubresourceList("apps", appID, "region_migrations", nil, &migrations) + err := c.ScalingoAPI().SubresourceList(ctx, "apps", appID, "region_migrations", nil, &migrations) if err != nil { return migrations, errgo.Notef(err, "fail to list migrations") } diff --git a/regions.go b/regions.go index a52d3a73..a46a217c 100644 --- a/regions.go +++ b/regions.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "sync" "gopkg.in/errgo.v1" @@ -16,7 +17,7 @@ var ( ) type RegionsService interface { - RegionsList() ([]Region, error) + RegionsList(context.Context) ([]Region, error) } type Region struct { @@ -33,9 +34,9 @@ type regionsRes struct { Regions []Region `json:"regions"` } -func (c *Client) RegionsList() ([]Region, error) { +func (c *Client) RegionsList(ctx context.Context) ([]Region, error) { var res regionsRes - err := c.AuthAPI().DoRequest(&http.APIRequest{ + err := c.AuthAPI().DoRequest(ctx, &http.APIRequest{ Method: "GET", Endpoint: "/regions", }, &res) @@ -45,12 +46,12 @@ func (c *Client) RegionsList() ([]Region, error) { return res.Regions, nil } -func (c *Client) getRegion(regionName string) (Region, error) { +func (c *Client) getRegion(ctx context.Context, regionName string) (Region, error) { regionCacheMutex.Lock() defer regionCacheMutex.Unlock() if _, ok := regionCache[regionName]; !ok { - regions, err := c.RegionsList() + regions, err := c.RegionsList(ctx) if err != nil { return Region{}, errgo.Notef(err, "fail to list regions") } diff --git a/run.go b/run.go index d8c10897..a753a6e2 100644 --- a/run.go +++ b/run.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "strings" @@ -10,7 +11,7 @@ import ( ) type RunsService interface { - Run(opts RunOpts) (*RunRes, error) + Run(ctx context.Context, opts RunOpts) (*RunRes, error) } var _ RunsService = (*Client)(nil) @@ -29,7 +30,7 @@ type RunRes struct { AttachURL string `json:"attach_url"` } -func (c *Client) Run(opts RunOpts) (*RunRes, error) { +func (c *Client) Run(ctx context.Context, opts RunOpts) (*RunRes, error) { req := &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + opts.App + "/run", @@ -41,7 +42,7 @@ func (c *Client) Run(opts RunOpts) (*RunRes, error) { "has_uploads": opts.HasUploads, }, } - res, err := c.ScalingoAPI().Do(req) + res, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return nil, errgo.Mask(err) } diff --git a/scalingomock/addonprovidersservice_mock.go b/scalingomock/addonprovidersservice_mock.go index 7a9a4d9d..3d608069 100644 --- a/scalingomock/addonprovidersservice_mock.go +++ b/scalingomock/addonprovidersservice_mock.go @@ -5,61 +5,62 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockAddonProvidersService is a mock of AddonProvidersService interface +// MockAddonProvidersService is a mock of AddonProvidersService interface. type MockAddonProvidersService struct { ctrl *gomock.Controller recorder *MockAddonProvidersServiceMockRecorder } -// MockAddonProvidersServiceMockRecorder is the mock recorder for MockAddonProvidersService +// MockAddonProvidersServiceMockRecorder is the mock recorder for MockAddonProvidersService. type MockAddonProvidersServiceMockRecorder struct { mock *MockAddonProvidersService } -// NewMockAddonProvidersService creates a new mock instance +// NewMockAddonProvidersService creates a new mock instance. func NewMockAddonProvidersService(ctrl *gomock.Controller) *MockAddonProvidersService { mock := &MockAddonProvidersService{ctrl: ctrl} mock.recorder = &MockAddonProvidersServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockAddonProvidersService) EXPECT() *MockAddonProvidersServiceMockRecorder { return m.recorder } -// AddonProviderPlansList mocks base method -func (m *MockAddonProvidersService) AddonProviderPlansList(arg0 string) ([]*scalingo.Plan, error) { +// AddonProviderPlansList mocks base method. +func (m *MockAddonProvidersService) AddonProviderPlansList(arg0 context.Context, arg1 string) ([]*scalingo.Plan, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonProviderPlansList", arg0) + ret := m.ctrl.Call(m, "AddonProviderPlansList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Plan) ret1, _ := ret[1].(error) return ret0, ret1 } -// AddonProviderPlansList indicates an expected call of AddonProviderPlansList -func (mr *MockAddonProvidersServiceMockRecorder) AddonProviderPlansList(arg0 interface{}) *gomock.Call { +// AddonProviderPlansList indicates an expected call of AddonProviderPlansList. +func (mr *MockAddonProvidersServiceMockRecorder) AddonProviderPlansList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProviderPlansList", reflect.TypeOf((*MockAddonProvidersService)(nil).AddonProviderPlansList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProviderPlansList", reflect.TypeOf((*MockAddonProvidersService)(nil).AddonProviderPlansList), arg0, arg1) } -// AddonProvidersList mocks base method -func (m *MockAddonProvidersService) AddonProvidersList() ([]*scalingo.AddonProvider, error) { +// AddonProvidersList mocks base method. +func (m *MockAddonProvidersService) AddonProvidersList(arg0 context.Context) ([]*scalingo.AddonProvider, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonProvidersList") + ret := m.ctrl.Call(m, "AddonProvidersList", arg0) ret0, _ := ret[0].([]*scalingo.AddonProvider) ret1, _ := ret[1].(error) return ret0, ret1 } -// AddonProvidersList indicates an expected call of AddonProvidersList -func (mr *MockAddonProvidersServiceMockRecorder) AddonProvidersList() *gomock.Call { +// AddonProvidersList indicates an expected call of AddonProvidersList. +func (mr *MockAddonProvidersServiceMockRecorder) AddonProvidersList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvidersList", reflect.TypeOf((*MockAddonProvidersService)(nil).AddonProvidersList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvidersList", reflect.TypeOf((*MockAddonProvidersService)(nil).AddonProvidersList), arg0) } diff --git a/scalingomock/addonsservice_mock.go b/scalingomock/addonsservice_mock.go index d2be2714..30fafaa0 100644 --- a/scalingomock/addonsservice_mock.go +++ b/scalingomock/addonsservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" @@ -35,105 +36,105 @@ func (m *MockAddonsService) EXPECT() *MockAddonsServiceMockRecorder { } // AddonDestroy mocks base method. -func (m *MockAddonsService) AddonDestroy(arg0, arg1 string) error { +func (m *MockAddonsService) AddonDestroy(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonDestroy", arg0, arg1) + ret := m.ctrl.Call(m, "AddonDestroy", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // AddonDestroy indicates an expected call of AddonDestroy. -func (mr *MockAddonsServiceMockRecorder) AddonDestroy(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAddonsServiceMockRecorder) AddonDestroy(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonDestroy", reflect.TypeOf((*MockAddonsService)(nil).AddonDestroy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonDestroy", reflect.TypeOf((*MockAddonsService)(nil).AddonDestroy), arg0, arg1, arg2) } // AddonLogsArchives mocks base method. -func (m *MockAddonsService) AddonLogsArchives(arg0, arg1 string, arg2 int) (*scalingo.LogsArchivesResponse, error) { +func (m *MockAddonsService) AddonLogsArchives(arg0 context.Context, arg1, arg2 string, arg3 int) (*scalingo.LogsArchivesResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonLogsArchives", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddonLogsArchives", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.LogsArchivesResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonLogsArchives indicates an expected call of AddonLogsArchives. -func (mr *MockAddonsServiceMockRecorder) AddonLogsArchives(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAddonsServiceMockRecorder) AddonLogsArchives(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsArchives", reflect.TypeOf((*MockAddonsService)(nil).AddonLogsArchives), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsArchives", reflect.TypeOf((*MockAddonsService)(nil).AddonLogsArchives), arg0, arg1, arg2, arg3) } // AddonLogsURL mocks base method. -func (m *MockAddonsService) AddonLogsURL(arg0, arg1 string) (string, error) { +func (m *MockAddonsService) AddonLogsURL(arg0 context.Context, arg1, arg2 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonLogsURL", arg0, arg1) + ret := m.ctrl.Call(m, "AddonLogsURL", arg0, arg1, arg2) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonLogsURL indicates an expected call of AddonLogsURL. -func (mr *MockAddonsServiceMockRecorder) AddonLogsURL(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAddonsServiceMockRecorder) AddonLogsURL(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsURL", reflect.TypeOf((*MockAddonsService)(nil).AddonLogsURL), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsURL", reflect.TypeOf((*MockAddonsService)(nil).AddonLogsURL), arg0, arg1, arg2) } // AddonProvision mocks base method. -func (m *MockAddonsService) AddonProvision(arg0 string, arg1 scalingo.AddonProvisionParams) (scalingo.AddonRes, error) { +func (m *MockAddonsService) AddonProvision(arg0 context.Context, arg1 string, arg2 scalingo.AddonProvisionParams) (scalingo.AddonRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonProvision", arg0, arg1) + ret := m.ctrl.Call(m, "AddonProvision", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.AddonRes) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonProvision indicates an expected call of AddonProvision. -func (mr *MockAddonsServiceMockRecorder) AddonProvision(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAddonsServiceMockRecorder) AddonProvision(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvision", reflect.TypeOf((*MockAddonsService)(nil).AddonProvision), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvision", reflect.TypeOf((*MockAddonsService)(nil).AddonProvision), arg0, arg1, arg2) } // AddonToken mocks base method. -func (m *MockAddonsService) AddonToken(arg0, arg1 string) (string, error) { +func (m *MockAddonsService) AddonToken(arg0 context.Context, arg1, arg2 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonToken", arg0, arg1) + ret := m.ctrl.Call(m, "AddonToken", arg0, arg1, arg2) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonToken indicates an expected call of AddonToken. -func (mr *MockAddonsServiceMockRecorder) AddonToken(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAddonsServiceMockRecorder) AddonToken(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonToken", reflect.TypeOf((*MockAddonsService)(nil).AddonToken), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonToken", reflect.TypeOf((*MockAddonsService)(nil).AddonToken), arg0, arg1, arg2) } // AddonUpgrade mocks base method. -func (m *MockAddonsService) AddonUpgrade(arg0, arg1 string, arg2 scalingo.AddonUpgradeParams) (scalingo.AddonRes, error) { +func (m *MockAddonsService) AddonUpgrade(arg0 context.Context, arg1, arg2 string, arg3 scalingo.AddonUpgradeParams) (scalingo.AddonRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonUpgrade", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddonUpgrade", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(scalingo.AddonRes) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonUpgrade indicates an expected call of AddonUpgrade. -func (mr *MockAddonsServiceMockRecorder) AddonUpgrade(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAddonsServiceMockRecorder) AddonUpgrade(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonUpgrade", reflect.TypeOf((*MockAddonsService)(nil).AddonUpgrade), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonUpgrade", reflect.TypeOf((*MockAddonsService)(nil).AddonUpgrade), arg0, arg1, arg2, arg3) } // AddonsList mocks base method. -func (m *MockAddonsService) AddonsList(arg0 string) ([]*scalingo.Addon, error) { +func (m *MockAddonsService) AddonsList(arg0 context.Context, arg1 string) ([]*scalingo.Addon, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonsList", arg0) + ret := m.ctrl.Call(m, "AddonsList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Addon) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonsList indicates an expected call of AddonsList. -func (mr *MockAddonsServiceMockRecorder) AddonsList(arg0 interface{}) *gomock.Call { +func (mr *MockAddonsServiceMockRecorder) AddonsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonsList", reflect.TypeOf((*MockAddonsService)(nil).AddonsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonsList", reflect.TypeOf((*MockAddonsService)(nil).AddonsList), arg0, arg1) } diff --git a/scalingomock/alertsservice_mock.go b/scalingomock/alertsservice_mock.go index f3616941..5b218ce2 100644 --- a/scalingomock/alertsservice_mock.go +++ b/scalingomock/alertsservice_mock.go @@ -5,105 +5,106 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockAlertsService is a mock of AlertsService interface +// MockAlertsService is a mock of AlertsService interface. type MockAlertsService struct { ctrl *gomock.Controller recorder *MockAlertsServiceMockRecorder } -// MockAlertsServiceMockRecorder is the mock recorder for MockAlertsService +// MockAlertsServiceMockRecorder is the mock recorder for MockAlertsService. type MockAlertsServiceMockRecorder struct { mock *MockAlertsService } -// NewMockAlertsService creates a new mock instance +// NewMockAlertsService creates a new mock instance. func NewMockAlertsService(ctrl *gomock.Controller) *MockAlertsService { mock := &MockAlertsService{ctrl: ctrl} mock.recorder = &MockAlertsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockAlertsService) EXPECT() *MockAlertsServiceMockRecorder { return m.recorder } -// AlertAdd mocks base method -func (m *MockAlertsService) AlertAdd(arg0 string, arg1 scalingo.AlertAddParams) (*scalingo.Alert, error) { +// AlertAdd mocks base method. +func (m *MockAlertsService) AlertAdd(arg0 context.Context, arg1 string, arg2 scalingo.AlertAddParams) (*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertAdd", arg0, arg1) + ret := m.ctrl.Call(m, "AlertAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } -// AlertAdd indicates an expected call of AlertAdd -func (mr *MockAlertsServiceMockRecorder) AlertAdd(arg0, arg1 interface{}) *gomock.Call { +// AlertAdd indicates an expected call of AlertAdd. +func (mr *MockAlertsServiceMockRecorder) AlertAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertAdd", reflect.TypeOf((*MockAlertsService)(nil).AlertAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertAdd", reflect.TypeOf((*MockAlertsService)(nil).AlertAdd), arg0, arg1, arg2) } -// AlertRemove mocks base method -func (m *MockAlertsService) AlertRemove(arg0, arg1 string) error { +// AlertRemove mocks base method. +func (m *MockAlertsService) AlertRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertRemove", arg0, arg1) + ret := m.ctrl.Call(m, "AlertRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AlertRemove indicates an expected call of AlertRemove -func (mr *MockAlertsServiceMockRecorder) AlertRemove(arg0, arg1 interface{}) *gomock.Call { +// AlertRemove indicates an expected call of AlertRemove. +func (mr *MockAlertsServiceMockRecorder) AlertRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertRemove", reflect.TypeOf((*MockAlertsService)(nil).AlertRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertRemove", reflect.TypeOf((*MockAlertsService)(nil).AlertRemove), arg0, arg1, arg2) } -// AlertShow mocks base method -func (m *MockAlertsService) AlertShow(arg0, arg1 string) (*scalingo.Alert, error) { +// AlertShow mocks base method. +func (m *MockAlertsService) AlertShow(arg0 context.Context, arg1, arg2 string) (*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertShow", arg0, arg1) + ret := m.ctrl.Call(m, "AlertShow", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } -// AlertShow indicates an expected call of AlertShow -func (mr *MockAlertsServiceMockRecorder) AlertShow(arg0, arg1 interface{}) *gomock.Call { +// AlertShow indicates an expected call of AlertShow. +func (mr *MockAlertsServiceMockRecorder) AlertShow(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertShow", reflect.TypeOf((*MockAlertsService)(nil).AlertShow), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertShow", reflect.TypeOf((*MockAlertsService)(nil).AlertShow), arg0, arg1, arg2) } -// AlertUpdate mocks base method -func (m *MockAlertsService) AlertUpdate(arg0, arg1 string, arg2 scalingo.AlertUpdateParams) (*scalingo.Alert, error) { +// AlertUpdate mocks base method. +func (m *MockAlertsService) AlertUpdate(arg0 context.Context, arg1, arg2 string, arg3 scalingo.AlertUpdateParams) (*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertUpdate", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AlertUpdate", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } -// AlertUpdate indicates an expected call of AlertUpdate -func (mr *MockAlertsServiceMockRecorder) AlertUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { +// AlertUpdate indicates an expected call of AlertUpdate. +func (mr *MockAlertsServiceMockRecorder) AlertUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertUpdate", reflect.TypeOf((*MockAlertsService)(nil).AlertUpdate), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertUpdate", reflect.TypeOf((*MockAlertsService)(nil).AlertUpdate), arg0, arg1, arg2, arg3) } -// AlertsList mocks base method -func (m *MockAlertsService) AlertsList(arg0 string) ([]*scalingo.Alert, error) { +// AlertsList mocks base method. +func (m *MockAlertsService) AlertsList(arg0 context.Context, arg1 string) ([]*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertsList", arg0) + ret := m.ctrl.Call(m, "AlertsList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } -// AlertsList indicates an expected call of AlertsList -func (mr *MockAlertsServiceMockRecorder) AlertsList(arg0 interface{}) *gomock.Call { +// AlertsList indicates an expected call of AlertsList. +func (mr *MockAlertsServiceMockRecorder) AlertsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertsList", reflect.TypeOf((*MockAlertsService)(nil).AlertsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertsList", reflect.TypeOf((*MockAlertsService)(nil).AlertsList), arg0, arg1) } diff --git a/scalingomock/api_mock.go b/scalingomock/api_mock.go index 871dfd78..e03e1c12 100644 --- a/scalingomock/api_mock.go +++ b/scalingomock/api_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" http0 "net/http" reflect "reflect" @@ -38,450 +39,450 @@ func (m *MockAPI) EXPECT() *MockAPIMockRecorder { } // AddonDestroy mocks base method. -func (m *MockAPI) AddonDestroy(arg0, arg1 string) error { +func (m *MockAPI) AddonDestroy(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonDestroy", arg0, arg1) + ret := m.ctrl.Call(m, "AddonDestroy", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // AddonDestroy indicates an expected call of AddonDestroy. -func (mr *MockAPIMockRecorder) AddonDestroy(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonDestroy(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonDestroy", reflect.TypeOf((*MockAPI)(nil).AddonDestroy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonDestroy", reflect.TypeOf((*MockAPI)(nil).AddonDestroy), arg0, arg1, arg2) } // AddonLogsArchives mocks base method. -func (m *MockAPI) AddonLogsArchives(arg0, arg1 string, arg2 int) (*scalingo.LogsArchivesResponse, error) { +func (m *MockAPI) AddonLogsArchives(arg0 context.Context, arg1, arg2 string, arg3 int) (*scalingo.LogsArchivesResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonLogsArchives", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddonLogsArchives", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.LogsArchivesResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonLogsArchives indicates an expected call of AddonLogsArchives. -func (mr *MockAPIMockRecorder) AddonLogsArchives(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonLogsArchives(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsArchives", reflect.TypeOf((*MockAPI)(nil).AddonLogsArchives), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsArchives", reflect.TypeOf((*MockAPI)(nil).AddonLogsArchives), arg0, arg1, arg2, arg3) } // AddonLogsURL mocks base method. -func (m *MockAPI) AddonLogsURL(arg0, arg1 string) (string, error) { +func (m *MockAPI) AddonLogsURL(arg0 context.Context, arg1, arg2 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonLogsURL", arg0, arg1) + ret := m.ctrl.Call(m, "AddonLogsURL", arg0, arg1, arg2) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonLogsURL indicates an expected call of AddonLogsURL. -func (mr *MockAPIMockRecorder) AddonLogsURL(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonLogsURL(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsURL", reflect.TypeOf((*MockAPI)(nil).AddonLogsURL), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonLogsURL", reflect.TypeOf((*MockAPI)(nil).AddonLogsURL), arg0, arg1, arg2) } // AddonProviderPlansList mocks base method. -func (m *MockAPI) AddonProviderPlansList(arg0 string) ([]*scalingo.Plan, error) { +func (m *MockAPI) AddonProviderPlansList(arg0 context.Context, arg1 string) ([]*scalingo.Plan, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonProviderPlansList", arg0) + ret := m.ctrl.Call(m, "AddonProviderPlansList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Plan) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonProviderPlansList indicates an expected call of AddonProviderPlansList. -func (mr *MockAPIMockRecorder) AddonProviderPlansList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonProviderPlansList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProviderPlansList", reflect.TypeOf((*MockAPI)(nil).AddonProviderPlansList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProviderPlansList", reflect.TypeOf((*MockAPI)(nil).AddonProviderPlansList), arg0, arg1) } // AddonProvidersList mocks base method. -func (m *MockAPI) AddonProvidersList() ([]*scalingo.AddonProvider, error) { +func (m *MockAPI) AddonProvidersList(arg0 context.Context) ([]*scalingo.AddonProvider, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonProvidersList") + ret := m.ctrl.Call(m, "AddonProvidersList", arg0) ret0, _ := ret[0].([]*scalingo.AddonProvider) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonProvidersList indicates an expected call of AddonProvidersList. -func (mr *MockAPIMockRecorder) AddonProvidersList() *gomock.Call { +func (mr *MockAPIMockRecorder) AddonProvidersList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvidersList", reflect.TypeOf((*MockAPI)(nil).AddonProvidersList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvidersList", reflect.TypeOf((*MockAPI)(nil).AddonProvidersList), arg0) } // AddonProvision mocks base method. -func (m *MockAPI) AddonProvision(arg0 string, arg1 scalingo.AddonProvisionParams) (scalingo.AddonRes, error) { +func (m *MockAPI) AddonProvision(arg0 context.Context, arg1 string, arg2 scalingo.AddonProvisionParams) (scalingo.AddonRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonProvision", arg0, arg1) + ret := m.ctrl.Call(m, "AddonProvision", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.AddonRes) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonProvision indicates an expected call of AddonProvision. -func (mr *MockAPIMockRecorder) AddonProvision(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonProvision(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvision", reflect.TypeOf((*MockAPI)(nil).AddonProvision), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonProvision", reflect.TypeOf((*MockAPI)(nil).AddonProvision), arg0, arg1, arg2) } // AddonToken mocks base method. -func (m *MockAPI) AddonToken(arg0, arg1 string) (string, error) { +func (m *MockAPI) AddonToken(arg0 context.Context, arg1, arg2 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonToken", arg0, arg1) + ret := m.ctrl.Call(m, "AddonToken", arg0, arg1, arg2) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonToken indicates an expected call of AddonToken. -func (mr *MockAPIMockRecorder) AddonToken(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonToken(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonToken", reflect.TypeOf((*MockAPI)(nil).AddonToken), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonToken", reflect.TypeOf((*MockAPI)(nil).AddonToken), arg0, arg1, arg2) } // AddonUpgrade mocks base method. -func (m *MockAPI) AddonUpgrade(arg0, arg1 string, arg2 scalingo.AddonUpgradeParams) (scalingo.AddonRes, error) { +func (m *MockAPI) AddonUpgrade(arg0 context.Context, arg1, arg2 string, arg3 scalingo.AddonUpgradeParams) (scalingo.AddonRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonUpgrade", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddonUpgrade", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(scalingo.AddonRes) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonUpgrade indicates an expected call of AddonUpgrade. -func (mr *MockAPIMockRecorder) AddonUpgrade(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonUpgrade(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonUpgrade", reflect.TypeOf((*MockAPI)(nil).AddonUpgrade), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonUpgrade", reflect.TypeOf((*MockAPI)(nil).AddonUpgrade), arg0, arg1, arg2, arg3) } // AddonsList mocks base method. -func (m *MockAPI) AddonsList(arg0 string) ([]*scalingo.Addon, error) { +func (m *MockAPI) AddonsList(arg0 context.Context, arg1 string) ([]*scalingo.Addon, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddonsList", arg0) + ret := m.ctrl.Call(m, "AddonsList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Addon) ret1, _ := ret[1].(error) return ret0, ret1 } // AddonsList indicates an expected call of AddonsList. -func (mr *MockAPIMockRecorder) AddonsList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AddonsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonsList", reflect.TypeOf((*MockAPI)(nil).AddonsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddonsList", reflect.TypeOf((*MockAPI)(nil).AddonsList), arg0, arg1) } // AlertAdd mocks base method. -func (m *MockAPI) AlertAdd(arg0 string, arg1 scalingo.AlertAddParams) (*scalingo.Alert, error) { +func (m *MockAPI) AlertAdd(arg0 context.Context, arg1 string, arg2 scalingo.AlertAddParams) (*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertAdd", arg0, arg1) + ret := m.ctrl.Call(m, "AlertAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } // AlertAdd indicates an expected call of AlertAdd. -func (mr *MockAPIMockRecorder) AlertAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AlertAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertAdd", reflect.TypeOf((*MockAPI)(nil).AlertAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertAdd", reflect.TypeOf((*MockAPI)(nil).AlertAdd), arg0, arg1, arg2) } // AlertRemove mocks base method. -func (m *MockAPI) AlertRemove(arg0, arg1 string) error { +func (m *MockAPI) AlertRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertRemove", arg0, arg1) + ret := m.ctrl.Call(m, "AlertRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // AlertRemove indicates an expected call of AlertRemove. -func (mr *MockAPIMockRecorder) AlertRemove(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AlertRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertRemove", reflect.TypeOf((*MockAPI)(nil).AlertRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertRemove", reflect.TypeOf((*MockAPI)(nil).AlertRemove), arg0, arg1, arg2) } // AlertShow mocks base method. -func (m *MockAPI) AlertShow(arg0, arg1 string) (*scalingo.Alert, error) { +func (m *MockAPI) AlertShow(arg0 context.Context, arg1, arg2 string) (*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertShow", arg0, arg1) + ret := m.ctrl.Call(m, "AlertShow", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } // AlertShow indicates an expected call of AlertShow. -func (mr *MockAPIMockRecorder) AlertShow(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AlertShow(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertShow", reflect.TypeOf((*MockAPI)(nil).AlertShow), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertShow", reflect.TypeOf((*MockAPI)(nil).AlertShow), arg0, arg1, arg2) } // AlertUpdate mocks base method. -func (m *MockAPI) AlertUpdate(arg0, arg1 string, arg2 scalingo.AlertUpdateParams) (*scalingo.Alert, error) { +func (m *MockAPI) AlertUpdate(arg0 context.Context, arg1, arg2 string, arg3 scalingo.AlertUpdateParams) (*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertUpdate", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AlertUpdate", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } // AlertUpdate indicates an expected call of AlertUpdate. -func (mr *MockAPIMockRecorder) AlertUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AlertUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertUpdate", reflect.TypeOf((*MockAPI)(nil).AlertUpdate), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertUpdate", reflect.TypeOf((*MockAPI)(nil).AlertUpdate), arg0, arg1, arg2, arg3) } // AlertsList mocks base method. -func (m *MockAPI) AlertsList(arg0 string) ([]*scalingo.Alert, error) { +func (m *MockAPI) AlertsList(arg0 context.Context, arg1 string) ([]*scalingo.Alert, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AlertsList", arg0) + ret := m.ctrl.Call(m, "AlertsList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Alert) ret1, _ := ret[1].(error) return ret0, ret1 } // AlertsList indicates an expected call of AlertsList. -func (mr *MockAPIMockRecorder) AlertsList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AlertsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertsList", reflect.TypeOf((*MockAPI)(nil).AlertsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AlertsList", reflect.TypeOf((*MockAPI)(nil).AlertsList), arg0, arg1) } // AppsContainerTypes mocks base method. -func (m *MockAPI) AppsContainerTypes(arg0 string) ([]scalingo.ContainerType, error) { +func (m *MockAPI) AppsContainerTypes(arg0 context.Context, arg1 string) ([]scalingo.ContainerType, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsContainerTypes", arg0) + ret := m.ctrl.Call(m, "AppsContainerTypes", arg0, arg1) ret0, _ := ret[0].([]scalingo.ContainerType) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsContainerTypes indicates an expected call of AppsContainerTypes. -func (mr *MockAPIMockRecorder) AppsContainerTypes(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsContainerTypes(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainerTypes", reflect.TypeOf((*MockAPI)(nil).AppsContainerTypes), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainerTypes", reflect.TypeOf((*MockAPI)(nil).AppsContainerTypes), arg0, arg1) } // AppsContainersPs mocks base method. -func (m *MockAPI) AppsContainersPs(arg0 string) ([]scalingo.Container, error) { +func (m *MockAPI) AppsContainersPs(arg0 context.Context, arg1 string) ([]scalingo.Container, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsContainersPs", arg0) + ret := m.ctrl.Call(m, "AppsContainersPs", arg0, arg1) ret0, _ := ret[0].([]scalingo.Container) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsContainersPs indicates an expected call of AppsContainersPs. -func (mr *MockAPIMockRecorder) AppsContainersPs(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsContainersPs(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainersPs", reflect.TypeOf((*MockAPI)(nil).AppsContainersPs), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainersPs", reflect.TypeOf((*MockAPI)(nil).AppsContainersPs), arg0, arg1) } // AppsCreate mocks base method. -func (m *MockAPI) AppsCreate(arg0 scalingo.AppsCreateOpts) (*scalingo.App, error) { +func (m *MockAPI) AppsCreate(arg0 context.Context, arg1 scalingo.AppsCreateOpts) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsCreate", arg0) + ret := m.ctrl.Call(m, "AppsCreate", arg0, arg1) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsCreate indicates an expected call of AppsCreate. -func (mr *MockAPIMockRecorder) AppsCreate(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsCreate(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsCreate", reflect.TypeOf((*MockAPI)(nil).AppsCreate), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsCreate", reflect.TypeOf((*MockAPI)(nil).AppsCreate), arg0, arg1) } // AppsDestroy mocks base method. -func (m *MockAPI) AppsDestroy(arg0, arg1 string) error { +func (m *MockAPI) AppsDestroy(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsDestroy", arg0, arg1) + ret := m.ctrl.Call(m, "AppsDestroy", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // AppsDestroy indicates an expected call of AppsDestroy. -func (mr *MockAPIMockRecorder) AppsDestroy(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsDestroy(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsDestroy", reflect.TypeOf((*MockAPI)(nil).AppsDestroy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsDestroy", reflect.TypeOf((*MockAPI)(nil).AppsDestroy), arg0, arg1, arg2) } // AppsForceHTTPS mocks base method. -func (m *MockAPI) AppsForceHTTPS(arg0 string, arg1 bool) (*scalingo.App, error) { +func (m *MockAPI) AppsForceHTTPS(arg0 context.Context, arg1 string, arg2 bool) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsForceHTTPS", arg0, arg1) + ret := m.ctrl.Call(m, "AppsForceHTTPS", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsForceHTTPS indicates an expected call of AppsForceHTTPS. -func (mr *MockAPIMockRecorder) AppsForceHTTPS(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsForceHTTPS(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsForceHTTPS", reflect.TypeOf((*MockAPI)(nil).AppsForceHTTPS), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsForceHTTPS", reflect.TypeOf((*MockAPI)(nil).AppsForceHTTPS), arg0, arg1, arg2) } // AppsList mocks base method. -func (m *MockAPI) AppsList() ([]*scalingo.App, error) { +func (m *MockAPI) AppsList(arg0 context.Context) ([]*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsList") + ret := m.ctrl.Call(m, "AppsList", arg0) ret0, _ := ret[0].([]*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsList indicates an expected call of AppsList. -func (mr *MockAPIMockRecorder) AppsList() *gomock.Call { +func (mr *MockAPIMockRecorder) AppsList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsList", reflect.TypeOf((*MockAPI)(nil).AppsList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsList", reflect.TypeOf((*MockAPI)(nil).AppsList), arg0) } // AppsPs mocks base method. -func (m *MockAPI) AppsPs(arg0 string) ([]scalingo.ContainerType, error) { +func (m *MockAPI) AppsPs(arg0 context.Context, arg1 string) ([]scalingo.ContainerType, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsPs", arg0) + ret := m.ctrl.Call(m, "AppsPs", arg0, arg1) ret0, _ := ret[0].([]scalingo.ContainerType) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsPs indicates an expected call of AppsPs. -func (mr *MockAPIMockRecorder) AppsPs(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsPs(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsPs", reflect.TypeOf((*MockAPI)(nil).AppsPs), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsPs", reflect.TypeOf((*MockAPI)(nil).AppsPs), arg0, arg1) } // AppsRename mocks base method. -func (m *MockAPI) AppsRename(arg0, arg1 string) (*scalingo.App, error) { +func (m *MockAPI) AppsRename(arg0 context.Context, arg1, arg2 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsRename", arg0, arg1) + ret := m.ctrl.Call(m, "AppsRename", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsRename indicates an expected call of AppsRename. -func (mr *MockAPIMockRecorder) AppsRename(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsRename(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRename", reflect.TypeOf((*MockAPI)(nil).AppsRename), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRename", reflect.TypeOf((*MockAPI)(nil).AppsRename), arg0, arg1, arg2) } // AppsRestart mocks base method. -func (m *MockAPI) AppsRestart(arg0 string, arg1 *scalingo.AppsRestartParams) (*http0.Response, error) { +func (m *MockAPI) AppsRestart(arg0 context.Context, arg1 string, arg2 *scalingo.AppsRestartParams) (*http0.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsRestart", arg0, arg1) + ret := m.ctrl.Call(m, "AppsRestart", arg0, arg1, arg2) ret0, _ := ret[0].(*http0.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsRestart indicates an expected call of AppsRestart. -func (mr *MockAPIMockRecorder) AppsRestart(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsRestart(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRestart", reflect.TypeOf((*MockAPI)(nil).AppsRestart), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRestart", reflect.TypeOf((*MockAPI)(nil).AppsRestart), arg0, arg1, arg2) } // AppsRouterLogs mocks base method. -func (m *MockAPI) AppsRouterLogs(arg0 string, arg1 bool) (*scalingo.App, error) { +func (m *MockAPI) AppsRouterLogs(arg0 context.Context, arg1 string, arg2 bool) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsRouterLogs", arg0, arg1) + ret := m.ctrl.Call(m, "AppsRouterLogs", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsRouterLogs indicates an expected call of AppsRouterLogs. -func (mr *MockAPIMockRecorder) AppsRouterLogs(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsRouterLogs(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRouterLogs", reflect.TypeOf((*MockAPI)(nil).AppsRouterLogs), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRouterLogs", reflect.TypeOf((*MockAPI)(nil).AppsRouterLogs), arg0, arg1, arg2) } // AppsScale mocks base method. -func (m *MockAPI) AppsScale(arg0 string, arg1 *scalingo.AppsScaleParams) (*http0.Response, error) { +func (m *MockAPI) AppsScale(arg0 context.Context, arg1 string, arg2 *scalingo.AppsScaleParams) (*http0.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsScale", arg0, arg1) + ret := m.ctrl.Call(m, "AppsScale", arg0, arg1, arg2) ret0, _ := ret[0].(*http0.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsScale indicates an expected call of AppsScale. -func (mr *MockAPIMockRecorder) AppsScale(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsScale(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsScale", reflect.TypeOf((*MockAPI)(nil).AppsScale), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsScale", reflect.TypeOf((*MockAPI)(nil).AppsScale), arg0, arg1, arg2) } // AppsSetStack mocks base method. -func (m *MockAPI) AppsSetStack(arg0, arg1 string) (*scalingo.App, error) { +func (m *MockAPI) AppsSetStack(arg0 context.Context, arg1, arg2 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsSetStack", arg0, arg1) + ret := m.ctrl.Call(m, "AppsSetStack", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsSetStack indicates an expected call of AppsSetStack. -func (mr *MockAPIMockRecorder) AppsSetStack(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsSetStack(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsSetStack", reflect.TypeOf((*MockAPI)(nil).AppsSetStack), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsSetStack", reflect.TypeOf((*MockAPI)(nil).AppsSetStack), arg0, arg1, arg2) } // AppsShow mocks base method. -func (m *MockAPI) AppsShow(arg0 string) (*scalingo.App, error) { +func (m *MockAPI) AppsShow(arg0 context.Context, arg1 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsShow", arg0) + ret := m.ctrl.Call(m, "AppsShow", arg0, arg1) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsShow indicates an expected call of AppsShow. -func (mr *MockAPIMockRecorder) AppsShow(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsShow(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsShow", reflect.TypeOf((*MockAPI)(nil).AppsShow), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsShow", reflect.TypeOf((*MockAPI)(nil).AppsShow), arg0, arg1) } // AppsStats mocks base method. -func (m *MockAPI) AppsStats(arg0 string) (*scalingo.AppStatsRes, error) { +func (m *MockAPI) AppsStats(arg0 context.Context, arg1 string) (*scalingo.AppStatsRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsStats", arg0) + ret := m.ctrl.Call(m, "AppsStats", arg0, arg1) ret0, _ := ret[0].(*scalingo.AppStatsRes) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsStats indicates an expected call of AppsStats. -func (mr *MockAPIMockRecorder) AppsStats(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsStats(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStats", reflect.TypeOf((*MockAPI)(nil).AppsStats), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStats", reflect.TypeOf((*MockAPI)(nil).AppsStats), arg0, arg1) } // AppsStickySession mocks base method. -func (m *MockAPI) AppsStickySession(arg0 string, arg1 bool) (*scalingo.App, error) { +func (m *MockAPI) AppsStickySession(arg0 context.Context, arg1 string, arg2 bool) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsStickySession", arg0, arg1) + ret := m.ctrl.Call(m, "AppsStickySession", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsStickySession indicates an expected call of AppsStickySession. -func (mr *MockAPIMockRecorder) AppsStickySession(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsStickySession(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStickySession", reflect.TypeOf((*MockAPI)(nil).AppsStickySession), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStickySession", reflect.TypeOf((*MockAPI)(nil).AppsStickySession), arg0, arg1, arg2) } // AppsTransfer mocks base method. -func (m *MockAPI) AppsTransfer(arg0, arg1 string) (*scalingo.App, error) { +func (m *MockAPI) AppsTransfer(arg0 context.Context, arg1, arg2 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsTransfer", arg0, arg1) + ret := m.ctrl.Call(m, "AppsTransfer", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsTransfer indicates an expected call of AppsTransfer. -func (mr *MockAPIMockRecorder) AppsTransfer(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AppsTransfer(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsTransfer", reflect.TypeOf((*MockAPI)(nil).AppsTransfer), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsTransfer", reflect.TypeOf((*MockAPI)(nil).AppsTransfer), arg0, arg1, arg2) } // AuthAPI mocks base method. @@ -499,210 +500,210 @@ func (mr *MockAPIMockRecorder) AuthAPI() *gomock.Call { } // AutoscalerAdd mocks base method. -func (m *MockAPI) AutoscalerAdd(arg0 string, arg1 scalingo.AutoscalerAddParams) (*scalingo.Autoscaler, error) { +func (m *MockAPI) AutoscalerAdd(arg0 context.Context, arg1 string, arg2 scalingo.AutoscalerAddParams) (*scalingo.Autoscaler, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AutoscalerAdd", arg0, arg1) + ret := m.ctrl.Call(m, "AutoscalerAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Autoscaler) ret1, _ := ret[1].(error) return ret0, ret1 } // AutoscalerAdd indicates an expected call of AutoscalerAdd. -func (mr *MockAPIMockRecorder) AutoscalerAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AutoscalerAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerAdd", reflect.TypeOf((*MockAPI)(nil).AutoscalerAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerAdd", reflect.TypeOf((*MockAPI)(nil).AutoscalerAdd), arg0, arg1, arg2) } // AutoscalerRemove mocks base method. -func (m *MockAPI) AutoscalerRemove(arg0, arg1 string) error { +func (m *MockAPI) AutoscalerRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AutoscalerRemove", arg0, arg1) + ret := m.ctrl.Call(m, "AutoscalerRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // AutoscalerRemove indicates an expected call of AutoscalerRemove. -func (mr *MockAPIMockRecorder) AutoscalerRemove(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AutoscalerRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerRemove", reflect.TypeOf((*MockAPI)(nil).AutoscalerRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerRemove", reflect.TypeOf((*MockAPI)(nil).AutoscalerRemove), arg0, arg1, arg2) } // AutoscalersList mocks base method. -func (m *MockAPI) AutoscalersList(arg0 string) ([]scalingo.Autoscaler, error) { +func (m *MockAPI) AutoscalersList(arg0 context.Context, arg1 string) ([]scalingo.Autoscaler, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AutoscalersList", arg0) + ret := m.ctrl.Call(m, "AutoscalersList", arg0, arg1) ret0, _ := ret[0].([]scalingo.Autoscaler) ret1, _ := ret[1].(error) return ret0, ret1 } // AutoscalersList indicates an expected call of AutoscalersList. -func (mr *MockAPIMockRecorder) AutoscalersList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) AutoscalersList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalersList", reflect.TypeOf((*MockAPI)(nil).AutoscalersList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalersList", reflect.TypeOf((*MockAPI)(nil).AutoscalersList), arg0, arg1) } // BackupCreate mocks base method. -func (m *MockAPI) BackupCreate(arg0, arg1 string) (*scalingo.Backup, error) { +func (m *MockAPI) BackupCreate(arg0 context.Context, arg1, arg2 string) (*scalingo.Backup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupCreate", arg0, arg1) + ret := m.ctrl.Call(m, "BackupCreate", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Backup) ret1, _ := ret[1].(error) return ret0, ret1 } // BackupCreate indicates an expected call of BackupCreate. -func (mr *MockAPIMockRecorder) BackupCreate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) BackupCreate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupCreate", reflect.TypeOf((*MockAPI)(nil).BackupCreate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupCreate", reflect.TypeOf((*MockAPI)(nil).BackupCreate), arg0, arg1, arg2) } // BackupDownloadURL mocks base method. -func (m *MockAPI) BackupDownloadURL(arg0, arg1, arg2 string) (string, error) { +func (m *MockAPI) BackupDownloadURL(arg0 context.Context, arg1, arg2, arg3 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupDownloadURL", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "BackupDownloadURL", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // BackupDownloadURL indicates an expected call of BackupDownloadURL. -func (mr *MockAPIMockRecorder) BackupDownloadURL(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) BackupDownloadURL(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupDownloadURL", reflect.TypeOf((*MockAPI)(nil).BackupDownloadURL), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupDownloadURL", reflect.TypeOf((*MockAPI)(nil).BackupDownloadURL), arg0, arg1, arg2, arg3) } // BackupList mocks base method. -func (m *MockAPI) BackupList(arg0, arg1 string) ([]scalingo.Backup, error) { +func (m *MockAPI) BackupList(arg0 context.Context, arg1, arg2 string) ([]scalingo.Backup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupList", arg0, arg1) + ret := m.ctrl.Call(m, "BackupList", arg0, arg1, arg2) ret0, _ := ret[0].([]scalingo.Backup) ret1, _ := ret[1].(error) return ret0, ret1 } // BackupList indicates an expected call of BackupList. -func (mr *MockAPIMockRecorder) BackupList(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) BackupList(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupList", reflect.TypeOf((*MockAPI)(nil).BackupList), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupList", reflect.TypeOf((*MockAPI)(nil).BackupList), arg0, arg1, arg2) } // BackupShow mocks base method. -func (m *MockAPI) BackupShow(arg0, arg1, arg2 string) (*scalingo.Backup, error) { +func (m *MockAPI) BackupShow(arg0 context.Context, arg1, arg2, arg3 string) (*scalingo.Backup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupShow", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "BackupShow", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Backup) ret1, _ := ret[1].(error) return ret0, ret1 } // BackupShow indicates an expected call of BackupShow. -func (mr *MockAPIMockRecorder) BackupShow(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) BackupShow(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupShow", reflect.TypeOf((*MockAPI)(nil).BackupShow), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupShow", reflect.TypeOf((*MockAPI)(nil).BackupShow), arg0, arg1, arg2, arg3) } // CollaboratorAdd mocks base method. -func (m *MockAPI) CollaboratorAdd(arg0, arg1 string) (scalingo.Collaborator, error) { +func (m *MockAPI) CollaboratorAdd(arg0 context.Context, arg1, arg2 string) (scalingo.Collaborator, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CollaboratorAdd", arg0, arg1) + ret := m.ctrl.Call(m, "CollaboratorAdd", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Collaborator) ret1, _ := ret[1].(error) return ret0, ret1 } // CollaboratorAdd indicates an expected call of CollaboratorAdd. -func (mr *MockAPIMockRecorder) CollaboratorAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) CollaboratorAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorAdd", reflect.TypeOf((*MockAPI)(nil).CollaboratorAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorAdd", reflect.TypeOf((*MockAPI)(nil).CollaboratorAdd), arg0, arg1, arg2) } // CollaboratorRemove mocks base method. -func (m *MockAPI) CollaboratorRemove(arg0, arg1 string) error { +func (m *MockAPI) CollaboratorRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CollaboratorRemove", arg0, arg1) + ret := m.ctrl.Call(m, "CollaboratorRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // CollaboratorRemove indicates an expected call of CollaboratorRemove. -func (mr *MockAPIMockRecorder) CollaboratorRemove(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) CollaboratorRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorRemove", reflect.TypeOf((*MockAPI)(nil).CollaboratorRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorRemove", reflect.TypeOf((*MockAPI)(nil).CollaboratorRemove), arg0, arg1, arg2) } // CollaboratorsList mocks base method. -func (m *MockAPI) CollaboratorsList(arg0 string) ([]scalingo.Collaborator, error) { +func (m *MockAPI) CollaboratorsList(arg0 context.Context, arg1 string) ([]scalingo.Collaborator, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CollaboratorsList", arg0) + ret := m.ctrl.Call(m, "CollaboratorsList", arg0, arg1) ret0, _ := ret[0].([]scalingo.Collaborator) ret1, _ := ret[1].(error) return ret0, ret1 } // CollaboratorsList indicates an expected call of CollaboratorsList. -func (mr *MockAPIMockRecorder) CollaboratorsList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) CollaboratorsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorsList", reflect.TypeOf((*MockAPI)(nil).CollaboratorsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorsList", reflect.TypeOf((*MockAPI)(nil).CollaboratorsList), arg0, arg1) } // ContainerSizesList mocks base method. -func (m *MockAPI) ContainerSizesList() ([]scalingo.ContainerSize, error) { +func (m *MockAPI) ContainerSizesList(arg0 context.Context) ([]scalingo.ContainerSize, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContainerSizesList") + ret := m.ctrl.Call(m, "ContainerSizesList", arg0) ret0, _ := ret[0].([]scalingo.ContainerSize) ret1, _ := ret[1].(error) return ret0, ret1 } // ContainerSizesList indicates an expected call of ContainerSizesList. -func (mr *MockAPIMockRecorder) ContainerSizesList() *gomock.Call { +func (mr *MockAPIMockRecorder) ContainerSizesList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSizesList", reflect.TypeOf((*MockAPI)(nil).ContainerSizesList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSizesList", reflect.TypeOf((*MockAPI)(nil).ContainerSizesList), arg0) } // ContainersStop mocks base method. -func (m *MockAPI) ContainersStop(arg0, arg1 string) error { +func (m *MockAPI) ContainersStop(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContainersStop", arg0, arg1) + ret := m.ctrl.Call(m, "ContainersStop", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // ContainersStop indicates an expected call of ContainersStop. -func (mr *MockAPIMockRecorder) ContainersStop(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) ContainersStop(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainersStop", reflect.TypeOf((*MockAPI)(nil).ContainersStop), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainersStop", reflect.TypeOf((*MockAPI)(nil).ContainersStop), arg0, arg1, arg2) } // CreateRegionMigration mocks base method. -func (m *MockAPI) CreateRegionMigration(arg0 string, arg1 scalingo.RegionMigrationParams) (scalingo.RegionMigration, error) { +func (m *MockAPI) CreateRegionMigration(arg0 context.Context, arg1 string, arg2 scalingo.RegionMigrationParams) (scalingo.RegionMigration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateRegionMigration", arg0, arg1) + ret := m.ctrl.Call(m, "CreateRegionMigration", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.RegionMigration) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateRegionMigration indicates an expected call of CreateRegionMigration. -func (mr *MockAPIMockRecorder) CreateRegionMigration(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) CreateRegionMigration(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRegionMigration", reflect.TypeOf((*MockAPI)(nil).CreateRegionMigration), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRegionMigration", reflect.TypeOf((*MockAPI)(nil).CreateRegionMigration), arg0, arg1, arg2) } // CronTasksGet mocks base method. -func (m *MockAPI) CronTasksGet(arg0 string) (scalingo.CronTasks, error) { +func (m *MockAPI) CronTasksGet(arg0 context.Context, arg1 string) (scalingo.CronTasks, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CronTasksGet", arg0) + ret := m.ctrl.Call(m, "CronTasksGet", arg0, arg1) ret0, _ := ret[0].(scalingo.CronTasks) ret1, _ := ret[1].(error) return ret0, ret1 } // CronTasksGet indicates an expected call of CronTasksGet. -func (mr *MockAPIMockRecorder) CronTasksGet(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) CronTasksGet(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CronTasksGet", reflect.TypeOf((*MockAPI)(nil).CronTasksGet), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CronTasksGet", reflect.TypeOf((*MockAPI)(nil).CronTasksGet), arg0, arg1) } // DBAPI mocks base method. @@ -720,39 +721,39 @@ func (mr *MockAPIMockRecorder) DBAPI(arg0, arg1 interface{}) *gomock.Call { } // Deployment mocks base method. -func (m *MockAPI) Deployment(arg0, arg1 string) (*scalingo.Deployment, error) { +func (m *MockAPI) Deployment(arg0 context.Context, arg1, arg2 string) (*scalingo.Deployment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Deployment", arg0, arg1) + ret := m.ctrl.Call(m, "Deployment", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Deployment) ret1, _ := ret[1].(error) return ret0, ret1 } // Deployment indicates an expected call of Deployment. -func (mr *MockAPIMockRecorder) Deployment(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) Deployment(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deployment", reflect.TypeOf((*MockAPI)(nil).Deployment), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deployment", reflect.TypeOf((*MockAPI)(nil).Deployment), arg0, arg1, arg2) } // DeploymentList mocks base method. -func (m *MockAPI) DeploymentList(arg0 string) ([]*scalingo.Deployment, error) { +func (m *MockAPI) DeploymentList(arg0 context.Context, arg1 string) ([]*scalingo.Deployment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentList", arg0) + ret := m.ctrl.Call(m, "DeploymentList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Deployment) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentList indicates an expected call of DeploymentList. -func (mr *MockAPIMockRecorder) DeploymentList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DeploymentList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentList", reflect.TypeOf((*MockAPI)(nil).DeploymentList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentList", reflect.TypeOf((*MockAPI)(nil).DeploymentList), arg0, arg1) } // DeploymentListWithPagination mocks base method. -func (m *MockAPI) DeploymentListWithPagination(arg0 string, arg1 scalingo.PaginationOpts) ([]*scalingo.Deployment, scalingo.PaginationMeta, error) { +func (m *MockAPI) DeploymentListWithPagination(arg0 context.Context, arg1 string, arg2 scalingo.PaginationOpts) ([]*scalingo.Deployment, scalingo.PaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentListWithPagination", arg0, arg1) + ret := m.ctrl.Call(m, "DeploymentListWithPagination", arg0, arg1, arg2) ret0, _ := ret[0].([]*scalingo.Deployment) ret1, _ := ret[1].(scalingo.PaginationMeta) ret2, _ := ret[2].(error) @@ -760,209 +761,209 @@ func (m *MockAPI) DeploymentListWithPagination(arg0 string, arg1 scalingo.Pagina } // DeploymentListWithPagination indicates an expected call of DeploymentListWithPagination. -func (mr *MockAPIMockRecorder) DeploymentListWithPagination(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DeploymentListWithPagination(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentListWithPagination", reflect.TypeOf((*MockAPI)(nil).DeploymentListWithPagination), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentListWithPagination", reflect.TypeOf((*MockAPI)(nil).DeploymentListWithPagination), arg0, arg1, arg2) } // DeploymentLogs mocks base method. -func (m *MockAPI) DeploymentLogs(arg0 string) (*http0.Response, error) { +func (m *MockAPI) DeploymentLogs(arg0 context.Context, arg1 string) (*http0.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentLogs", arg0) + ret := m.ctrl.Call(m, "DeploymentLogs", arg0, arg1) ret0, _ := ret[0].(*http0.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentLogs indicates an expected call of DeploymentLogs. -func (mr *MockAPIMockRecorder) DeploymentLogs(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DeploymentLogs(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentLogs", reflect.TypeOf((*MockAPI)(nil).DeploymentLogs), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentLogs", reflect.TypeOf((*MockAPI)(nil).DeploymentLogs), arg0, arg1) } // DeploymentStream mocks base method. -func (m *MockAPI) DeploymentStream(arg0 string) (*websocket.Conn, error) { +func (m *MockAPI) DeploymentStream(arg0 context.Context, arg1 string) (*websocket.Conn, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentStream", arg0) + ret := m.ctrl.Call(m, "DeploymentStream", arg0, arg1) ret0, _ := ret[0].(*websocket.Conn) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentStream indicates an expected call of DeploymentStream. -func (mr *MockAPIMockRecorder) DeploymentStream(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DeploymentStream(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentStream", reflect.TypeOf((*MockAPI)(nil).DeploymentStream), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentStream", reflect.TypeOf((*MockAPI)(nil).DeploymentStream), arg0, arg1) } // DeploymentsCreate mocks base method. -func (m *MockAPI) DeploymentsCreate(arg0 string, arg1 *scalingo.DeploymentsCreateParams) (*scalingo.Deployment, error) { +func (m *MockAPI) DeploymentsCreate(arg0 context.Context, arg1 string, arg2 *scalingo.DeploymentsCreateParams) (*scalingo.Deployment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentsCreate", arg0, arg1) + ret := m.ctrl.Call(m, "DeploymentsCreate", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Deployment) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentsCreate indicates an expected call of DeploymentsCreate. -func (mr *MockAPIMockRecorder) DeploymentsCreate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DeploymentsCreate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentsCreate", reflect.TypeOf((*MockAPI)(nil).DeploymentsCreate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentsCreate", reflect.TypeOf((*MockAPI)(nil).DeploymentsCreate), arg0, arg1, arg2) } // DomainSetCanonical mocks base method. -func (m *MockAPI) DomainSetCanonical(arg0, arg1 string) (scalingo.Domain, error) { +func (m *MockAPI) DomainSetCanonical(arg0 context.Context, arg1, arg2 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainSetCanonical", arg0, arg1) + ret := m.ctrl.Call(m, "DomainSetCanonical", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainSetCanonical indicates an expected call of DomainSetCanonical. -func (mr *MockAPIMockRecorder) DomainSetCanonical(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainSetCanonical(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCanonical", reflect.TypeOf((*MockAPI)(nil).DomainSetCanonical), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCanonical", reflect.TypeOf((*MockAPI)(nil).DomainSetCanonical), arg0, arg1, arg2) } // DomainSetCertificate mocks base method. -func (m *MockAPI) DomainSetCertificate(arg0, arg1, arg2, arg3 string) (scalingo.Domain, error) { +func (m *MockAPI) DomainSetCertificate(arg0 context.Context, arg1, arg2, arg3, arg4 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainSetCertificate", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "DomainSetCertificate", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainSetCertificate indicates an expected call of DomainSetCertificate. -func (mr *MockAPIMockRecorder) DomainSetCertificate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainSetCertificate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCertificate", reflect.TypeOf((*MockAPI)(nil).DomainSetCertificate), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCertificate", reflect.TypeOf((*MockAPI)(nil).DomainSetCertificate), arg0, arg1, arg2, arg3, arg4) } // DomainUnsetCanonical mocks base method. -func (m *MockAPI) DomainUnsetCanonical(arg0 string) (scalingo.Domain, error) { +func (m *MockAPI) DomainUnsetCanonical(arg0 context.Context, arg1 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainUnsetCanonical", arg0) + ret := m.ctrl.Call(m, "DomainUnsetCanonical", arg0, arg1) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainUnsetCanonical indicates an expected call of DomainUnsetCanonical. -func (mr *MockAPIMockRecorder) DomainUnsetCanonical(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainUnsetCanonical(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCanonical", reflect.TypeOf((*MockAPI)(nil).DomainUnsetCanonical), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCanonical", reflect.TypeOf((*MockAPI)(nil).DomainUnsetCanonical), arg0, arg1) } // DomainUnsetCertificate mocks base method. -func (m *MockAPI) DomainUnsetCertificate(arg0, arg1 string) (scalingo.Domain, error) { +func (m *MockAPI) DomainUnsetCertificate(arg0 context.Context, arg1, arg2 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainUnsetCertificate", arg0, arg1) + ret := m.ctrl.Call(m, "DomainUnsetCertificate", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainUnsetCertificate indicates an expected call of DomainUnsetCertificate. -func (mr *MockAPIMockRecorder) DomainUnsetCertificate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainUnsetCertificate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCertificate", reflect.TypeOf((*MockAPI)(nil).DomainUnsetCertificate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCertificate", reflect.TypeOf((*MockAPI)(nil).DomainUnsetCertificate), arg0, arg1, arg2) } // DomainsAdd mocks base method. -func (m *MockAPI) DomainsAdd(arg0 string, arg1 scalingo.Domain) (scalingo.Domain, error) { +func (m *MockAPI) DomainsAdd(arg0 context.Context, arg1 string, arg2 scalingo.Domain) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsAdd", arg0, arg1) + ret := m.ctrl.Call(m, "DomainsAdd", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainsAdd indicates an expected call of DomainsAdd. -func (mr *MockAPIMockRecorder) DomainsAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainsAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsAdd", reflect.TypeOf((*MockAPI)(nil).DomainsAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsAdd", reflect.TypeOf((*MockAPI)(nil).DomainsAdd), arg0, arg1, arg2) } // DomainsList mocks base method. -func (m *MockAPI) DomainsList(arg0 string) ([]scalingo.Domain, error) { +func (m *MockAPI) DomainsList(arg0 context.Context, arg1 string) ([]scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsList", arg0) + ret := m.ctrl.Call(m, "DomainsList", arg0, arg1) ret0, _ := ret[0].([]scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainsList indicates an expected call of DomainsList. -func (mr *MockAPIMockRecorder) DomainsList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsList", reflect.TypeOf((*MockAPI)(nil).DomainsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsList", reflect.TypeOf((*MockAPI)(nil).DomainsList), arg0, arg1) } // DomainsRemove mocks base method. -func (m *MockAPI) DomainsRemove(arg0, arg1 string) error { +func (m *MockAPI) DomainsRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsRemove", arg0, arg1) + ret := m.ctrl.Call(m, "DomainsRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // DomainsRemove indicates an expected call of DomainsRemove. -func (mr *MockAPIMockRecorder) DomainsRemove(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainsRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsRemove", reflect.TypeOf((*MockAPI)(nil).DomainsRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsRemove", reflect.TypeOf((*MockAPI)(nil).DomainsRemove), arg0, arg1, arg2) } // DomainsUpdate mocks base method. -func (m *MockAPI) DomainsUpdate(arg0, arg1, arg2, arg3 string) (scalingo.Domain, error) { +func (m *MockAPI) DomainsUpdate(arg0 context.Context, arg1, arg2, arg3, arg4 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsUpdate", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "DomainsUpdate", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainsUpdate indicates an expected call of DomainsUpdate. -func (mr *MockAPIMockRecorder) DomainsUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) DomainsUpdate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsUpdate", reflect.TypeOf((*MockAPI)(nil).DomainsUpdate), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsUpdate", reflect.TypeOf((*MockAPI)(nil).DomainsUpdate), arg0, arg1, arg2, arg3, arg4) } // EventCategoriesList mocks base method. -func (m *MockAPI) EventCategoriesList() ([]scalingo.EventCategory, error) { +func (m *MockAPI) EventCategoriesList(arg0 context.Context) ([]scalingo.EventCategory, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EventCategoriesList") + ret := m.ctrl.Call(m, "EventCategoriesList", arg0) ret0, _ := ret[0].([]scalingo.EventCategory) ret1, _ := ret[1].(error) return ret0, ret1 } // EventCategoriesList indicates an expected call of EventCategoriesList. -func (mr *MockAPIMockRecorder) EventCategoriesList() *gomock.Call { +func (mr *MockAPIMockRecorder) EventCategoriesList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventCategoriesList", reflect.TypeOf((*MockAPI)(nil).EventCategoriesList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventCategoriesList", reflect.TypeOf((*MockAPI)(nil).EventCategoriesList), arg0) } // EventTypesList mocks base method. -func (m *MockAPI) EventTypesList() ([]scalingo.EventType, error) { +func (m *MockAPI) EventTypesList(arg0 context.Context) ([]scalingo.EventType, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EventTypesList") + ret := m.ctrl.Call(m, "EventTypesList", arg0) ret0, _ := ret[0].([]scalingo.EventType) ret1, _ := ret[1].(error) return ret0, ret1 } // EventTypesList indicates an expected call of EventTypesList. -func (mr *MockAPIMockRecorder) EventTypesList() *gomock.Call { +func (mr *MockAPIMockRecorder) EventTypesList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventTypesList", reflect.TypeOf((*MockAPI)(nil).EventTypesList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventTypesList", reflect.TypeOf((*MockAPI)(nil).EventTypesList), arg0) } // EventsList mocks base method. -func (m *MockAPI) EventsList(arg0 string, arg1 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { +func (m *MockAPI) EventsList(arg0 context.Context, arg1 string, arg2 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EventsList", arg0, arg1) + ret := m.ctrl.Call(m, "EventsList", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Events) ret1, _ := ret[1].(scalingo.PaginationMeta) ret2, _ := ret[2].(error) @@ -970,409 +971,409 @@ func (m *MockAPI) EventsList(arg0 string, arg1 scalingo.PaginationOpts) (scaling } // EventsList indicates an expected call of EventsList. -func (mr *MockAPIMockRecorder) EventsList(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) EventsList(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventsList", reflect.TypeOf((*MockAPI)(nil).EventsList), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventsList", reflect.TypeOf((*MockAPI)(nil).EventsList), arg0, arg1, arg2) } // GetAccessToken mocks base method. -func (m *MockAPI) GetAccessToken() (string, error) { +func (m *MockAPI) GetAccessToken(arg0 context.Context) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAccessToken") + ret := m.ctrl.Call(m, "GetAccessToken", arg0) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAccessToken indicates an expected call of GetAccessToken. -func (mr *MockAPIMockRecorder) GetAccessToken() *gomock.Call { +func (mr *MockAPIMockRecorder) GetAccessToken(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccessToken", reflect.TypeOf((*MockAPI)(nil).GetAccessToken)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccessToken", reflect.TypeOf((*MockAPI)(nil).GetAccessToken), arg0) } // KeysAdd mocks base method. -func (m *MockAPI) KeysAdd(arg0, arg1 string) (*scalingo.Key, error) { +func (m *MockAPI) KeysAdd(arg0 context.Context, arg1, arg2 string) (*scalingo.Key, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "KeysAdd", arg0, arg1) + ret := m.ctrl.Call(m, "KeysAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Key) ret1, _ := ret[1].(error) return ret0, ret1 } // KeysAdd indicates an expected call of KeysAdd. -func (mr *MockAPIMockRecorder) KeysAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) KeysAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysAdd", reflect.TypeOf((*MockAPI)(nil).KeysAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysAdd", reflect.TypeOf((*MockAPI)(nil).KeysAdd), arg0, arg1, arg2) } // KeysDelete mocks base method. -func (m *MockAPI) KeysDelete(arg0 string) error { +func (m *MockAPI) KeysDelete(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "KeysDelete", arg0) + ret := m.ctrl.Call(m, "KeysDelete", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } // KeysDelete indicates an expected call of KeysDelete. -func (mr *MockAPIMockRecorder) KeysDelete(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) KeysDelete(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysDelete", reflect.TypeOf((*MockAPI)(nil).KeysDelete), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysDelete", reflect.TypeOf((*MockAPI)(nil).KeysDelete), arg0, arg1) } // KeysList mocks base method. -func (m *MockAPI) KeysList() ([]scalingo.Key, error) { +func (m *MockAPI) KeysList(arg0 context.Context) ([]scalingo.Key, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "KeysList") + ret := m.ctrl.Call(m, "KeysList", arg0) ret0, _ := ret[0].([]scalingo.Key) ret1, _ := ret[1].(error) return ret0, ret1 } // KeysList indicates an expected call of KeysList. -func (mr *MockAPIMockRecorder) KeysList() *gomock.Call { +func (mr *MockAPIMockRecorder) KeysList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysList", reflect.TypeOf((*MockAPI)(nil).KeysList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysList", reflect.TypeOf((*MockAPI)(nil).KeysList), arg0) } // ListRegionMigrations mocks base method. -func (m *MockAPI) ListRegionMigrations(arg0 string) ([]scalingo.RegionMigration, error) { +func (m *MockAPI) ListRegionMigrations(arg0 context.Context, arg1 string) ([]scalingo.RegionMigration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListRegionMigrations", arg0) + ret := m.ctrl.Call(m, "ListRegionMigrations", arg0, arg1) ret0, _ := ret[0].([]scalingo.RegionMigration) ret1, _ := ret[1].(error) return ret0, ret1 } // ListRegionMigrations indicates an expected call of ListRegionMigrations. -func (mr *MockAPIMockRecorder) ListRegionMigrations(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) ListRegionMigrations(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRegionMigrations", reflect.TypeOf((*MockAPI)(nil).ListRegionMigrations), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRegionMigrations", reflect.TypeOf((*MockAPI)(nil).ListRegionMigrations), arg0, arg1) } // LogDrainAdd mocks base method. -func (m *MockAPI) LogDrainAdd(arg0 string, arg1 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { +func (m *MockAPI) LogDrainAdd(arg0 context.Context, arg1 string, arg2 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainAdd", arg0, arg1) + ret := m.ctrl.Call(m, "LogDrainAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LogDrainRes) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainAdd indicates an expected call of LogDrainAdd. -func (mr *MockAPIMockRecorder) LogDrainAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogDrainAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAdd", reflect.TypeOf((*MockAPI)(nil).LogDrainAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAdd", reflect.TypeOf((*MockAPI)(nil).LogDrainAdd), arg0, arg1, arg2) } // LogDrainAddonAdd mocks base method. -func (m *MockAPI) LogDrainAddonAdd(arg0, arg1 string, arg2 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { +func (m *MockAPI) LogDrainAddonAdd(arg0 context.Context, arg1, arg2 string, arg3 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainAddonAdd", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "LogDrainAddonAdd", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.LogDrainRes) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainAddonAdd indicates an expected call of LogDrainAddonAdd. -func (mr *MockAPIMockRecorder) LogDrainAddonAdd(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogDrainAddonAdd(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonAdd", reflect.TypeOf((*MockAPI)(nil).LogDrainAddonAdd), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonAdd", reflect.TypeOf((*MockAPI)(nil).LogDrainAddonAdd), arg0, arg1, arg2, arg3) } // LogDrainAddonRemove mocks base method. -func (m *MockAPI) LogDrainAddonRemove(arg0, arg1, arg2 string) error { +func (m *MockAPI) LogDrainAddonRemove(arg0 context.Context, arg1, arg2, arg3 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainAddonRemove", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "LogDrainAddonRemove", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 } // LogDrainAddonRemove indicates an expected call of LogDrainAddonRemove. -func (mr *MockAPIMockRecorder) LogDrainAddonRemove(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogDrainAddonRemove(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonRemove", reflect.TypeOf((*MockAPI)(nil).LogDrainAddonRemove), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonRemove", reflect.TypeOf((*MockAPI)(nil).LogDrainAddonRemove), arg0, arg1, arg2, arg3) } // LogDrainRemove mocks base method. -func (m *MockAPI) LogDrainRemove(arg0, arg1 string) error { +func (m *MockAPI) LogDrainRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainRemove", arg0, arg1) + ret := m.ctrl.Call(m, "LogDrainRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // LogDrainRemove indicates an expected call of LogDrainRemove. -func (mr *MockAPIMockRecorder) LogDrainRemove(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogDrainRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainRemove", reflect.TypeOf((*MockAPI)(nil).LogDrainRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainRemove", reflect.TypeOf((*MockAPI)(nil).LogDrainRemove), arg0, arg1, arg2) } // LogDrainsAddonList mocks base method. -func (m *MockAPI) LogDrainsAddonList(arg0, arg1 string) ([]scalingo.LogDrain, error) { +func (m *MockAPI) LogDrainsAddonList(arg0 context.Context, arg1, arg2 string) ([]scalingo.LogDrain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainsAddonList", arg0, arg1) + ret := m.ctrl.Call(m, "LogDrainsAddonList", arg0, arg1, arg2) ret0, _ := ret[0].([]scalingo.LogDrain) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainsAddonList indicates an expected call of LogDrainsAddonList. -func (mr *MockAPIMockRecorder) LogDrainsAddonList(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogDrainsAddonList(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsAddonList", reflect.TypeOf((*MockAPI)(nil).LogDrainsAddonList), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsAddonList", reflect.TypeOf((*MockAPI)(nil).LogDrainsAddonList), arg0, arg1, arg2) } // LogDrainsList mocks base method. -func (m *MockAPI) LogDrainsList(arg0 string) ([]scalingo.LogDrain, error) { +func (m *MockAPI) LogDrainsList(arg0 context.Context, arg1 string) ([]scalingo.LogDrain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainsList", arg0) + ret := m.ctrl.Call(m, "LogDrainsList", arg0, arg1) ret0, _ := ret[0].([]scalingo.LogDrain) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainsList indicates an expected call of LogDrainsList. -func (mr *MockAPIMockRecorder) LogDrainsList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogDrainsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsList", reflect.TypeOf((*MockAPI)(nil).LogDrainsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsList", reflect.TypeOf((*MockAPI)(nil).LogDrainsList), arg0, arg1) } // Login mocks base method. -func (m *MockAPI) Login(arg0, arg1 string) (*scalingo.LoginResponse, error) { +func (m *MockAPI) Login(arg0 context.Context, arg1, arg2 string) (*scalingo.LoginResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Login", arg0, arg1) + ret := m.ctrl.Call(m, "Login", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LoginResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // Login indicates an expected call of Login. -func (mr *MockAPIMockRecorder) Login(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) Login(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Login", reflect.TypeOf((*MockAPI)(nil).Login), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Login", reflect.TypeOf((*MockAPI)(nil).Login), arg0, arg1, arg2) } // Logs mocks base method. -func (m *MockAPI) Logs(arg0 string, arg1 int, arg2 string) (*http0.Response, error) { +func (m *MockAPI) Logs(arg0 context.Context, arg1 string, arg2 int, arg3 string) (*http0.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Logs", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Logs", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*http0.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // Logs indicates an expected call of Logs. -func (mr *MockAPIMockRecorder) Logs(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) Logs(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Logs", reflect.TypeOf((*MockAPI)(nil).Logs), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Logs", reflect.TypeOf((*MockAPI)(nil).Logs), arg0, arg1, arg2, arg3) } // LogsArchives mocks base method. -func (m *MockAPI) LogsArchives(arg0 string, arg1 int) (*scalingo.LogsArchivesResponse, error) { +func (m *MockAPI) LogsArchives(arg0 context.Context, arg1 string, arg2 int) (*scalingo.LogsArchivesResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogsArchives", arg0, arg1) + ret := m.ctrl.Call(m, "LogsArchives", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LogsArchivesResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // LogsArchives indicates an expected call of LogsArchives. -func (mr *MockAPIMockRecorder) LogsArchives(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogsArchives(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchives", reflect.TypeOf((*MockAPI)(nil).LogsArchives), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchives", reflect.TypeOf((*MockAPI)(nil).LogsArchives), arg0, arg1, arg2) } // LogsArchivesByCursor mocks base method. -func (m *MockAPI) LogsArchivesByCursor(arg0, arg1 string) (*scalingo.LogsArchivesResponse, error) { +func (m *MockAPI) LogsArchivesByCursor(arg0 context.Context, arg1, arg2 string) (*scalingo.LogsArchivesResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogsArchivesByCursor", arg0, arg1) + ret := m.ctrl.Call(m, "LogsArchivesByCursor", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LogsArchivesResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // LogsArchivesByCursor indicates an expected call of LogsArchivesByCursor. -func (mr *MockAPIMockRecorder) LogsArchivesByCursor(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogsArchivesByCursor(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchivesByCursor", reflect.TypeOf((*MockAPI)(nil).LogsArchivesByCursor), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchivesByCursor", reflect.TypeOf((*MockAPI)(nil).LogsArchivesByCursor), arg0, arg1, arg2) } // LogsURL mocks base method. -func (m *MockAPI) LogsURL(arg0 string) (*http0.Response, error) { +func (m *MockAPI) LogsURL(arg0 context.Context, arg1 string) (*http0.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogsURL", arg0) + ret := m.ctrl.Call(m, "LogsURL", arg0, arg1) ret0, _ := ret[0].(*http0.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // LogsURL indicates an expected call of LogsURL. -func (mr *MockAPIMockRecorder) LogsURL(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) LogsURL(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsURL", reflect.TypeOf((*MockAPI)(nil).LogsURL), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsURL", reflect.TypeOf((*MockAPI)(nil).LogsURL), arg0, arg1) } // NotificationPlatformByName mocks base method. -func (m *MockAPI) NotificationPlatformByName(arg0 string) ([]*scalingo.NotificationPlatform, error) { +func (m *MockAPI) NotificationPlatformByName(arg0 context.Context, arg1 string) ([]*scalingo.NotificationPlatform, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotificationPlatformByName", arg0) + ret := m.ctrl.Call(m, "NotificationPlatformByName", arg0, arg1) ret0, _ := ret[0].([]*scalingo.NotificationPlatform) ret1, _ := ret[1].(error) return ret0, ret1 } // NotificationPlatformByName indicates an expected call of NotificationPlatformByName. -func (mr *MockAPIMockRecorder) NotificationPlatformByName(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) NotificationPlatformByName(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformByName", reflect.TypeOf((*MockAPI)(nil).NotificationPlatformByName), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformByName", reflect.TypeOf((*MockAPI)(nil).NotificationPlatformByName), arg0, arg1) } // NotificationPlatformsList mocks base method. -func (m *MockAPI) NotificationPlatformsList() ([]*scalingo.NotificationPlatform, error) { +func (m *MockAPI) NotificationPlatformsList(arg0 context.Context) ([]*scalingo.NotificationPlatform, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotificationPlatformsList") + ret := m.ctrl.Call(m, "NotificationPlatformsList", arg0) ret0, _ := ret[0].([]*scalingo.NotificationPlatform) ret1, _ := ret[1].(error) return ret0, ret1 } // NotificationPlatformsList indicates an expected call of NotificationPlatformsList. -func (mr *MockAPIMockRecorder) NotificationPlatformsList() *gomock.Call { +func (mr *MockAPIMockRecorder) NotificationPlatformsList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformsList", reflect.TypeOf((*MockAPI)(nil).NotificationPlatformsList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformsList", reflect.TypeOf((*MockAPI)(nil).NotificationPlatformsList), arg0) } // NotifierByID mocks base method. -func (m *MockAPI) NotifierByID(arg0, arg1 string) (*scalingo.Notifier, error) { +func (m *MockAPI) NotifierByID(arg0 context.Context, arg1, arg2 string) (*scalingo.Notifier, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierByID", arg0, arg1) + ret := m.ctrl.Call(m, "NotifierByID", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Notifier) ret1, _ := ret[1].(error) return ret0, ret1 } // NotifierByID indicates an expected call of NotifierByID. -func (mr *MockAPIMockRecorder) NotifierByID(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) NotifierByID(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierByID", reflect.TypeOf((*MockAPI)(nil).NotifierByID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierByID", reflect.TypeOf((*MockAPI)(nil).NotifierByID), arg0, arg1, arg2) } // NotifierDestroy mocks base method. -func (m *MockAPI) NotifierDestroy(arg0, arg1 string) error { +func (m *MockAPI) NotifierDestroy(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierDestroy", arg0, arg1) + ret := m.ctrl.Call(m, "NotifierDestroy", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // NotifierDestroy indicates an expected call of NotifierDestroy. -func (mr *MockAPIMockRecorder) NotifierDestroy(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) NotifierDestroy(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierDestroy", reflect.TypeOf((*MockAPI)(nil).NotifierDestroy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierDestroy", reflect.TypeOf((*MockAPI)(nil).NotifierDestroy), arg0, arg1, arg2) } // NotifierProvision mocks base method. -func (m *MockAPI) NotifierProvision(arg0 string, arg1 scalingo.NotifierParams) (*scalingo.Notifier, error) { +func (m *MockAPI) NotifierProvision(arg0 context.Context, arg1 string, arg2 scalingo.NotifierParams) (*scalingo.Notifier, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierProvision", arg0, arg1) + ret := m.ctrl.Call(m, "NotifierProvision", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Notifier) ret1, _ := ret[1].(error) return ret0, ret1 } // NotifierProvision indicates an expected call of NotifierProvision. -func (mr *MockAPIMockRecorder) NotifierProvision(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) NotifierProvision(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierProvision", reflect.TypeOf((*MockAPI)(nil).NotifierProvision), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierProvision", reflect.TypeOf((*MockAPI)(nil).NotifierProvision), arg0, arg1, arg2) } // NotifierUpdate mocks base method. -func (m *MockAPI) NotifierUpdate(arg0, arg1 string, arg2 scalingo.NotifierParams) (*scalingo.Notifier, error) { +func (m *MockAPI) NotifierUpdate(arg0 context.Context, arg1, arg2 string, arg3 scalingo.NotifierParams) (*scalingo.Notifier, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierUpdate", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "NotifierUpdate", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Notifier) ret1, _ := ret[1].(error) return ret0, ret1 } // NotifierUpdate indicates an expected call of NotifierUpdate. -func (mr *MockAPIMockRecorder) NotifierUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) NotifierUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierUpdate", reflect.TypeOf((*MockAPI)(nil).NotifierUpdate), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierUpdate", reflect.TypeOf((*MockAPI)(nil).NotifierUpdate), arg0, arg1, arg2, arg3) } // NotifiersList mocks base method. -func (m *MockAPI) NotifiersList(arg0 string) (scalingo.Notifiers, error) { +func (m *MockAPI) NotifiersList(arg0 context.Context, arg1 string) (scalingo.Notifiers, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifiersList", arg0) + ret := m.ctrl.Call(m, "NotifiersList", arg0, arg1) ret0, _ := ret[0].(scalingo.Notifiers) ret1, _ := ret[1].(error) return ret0, ret1 } // NotifiersList indicates an expected call of NotifiersList. -func (mr *MockAPIMockRecorder) NotifiersList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) NotifiersList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifiersList", reflect.TypeOf((*MockAPI)(nil).NotifiersList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifiersList", reflect.TypeOf((*MockAPI)(nil).NotifiersList), arg0, arg1) } // OperationsShow mocks base method. -func (m *MockAPI) OperationsShow(arg0, arg1 string) (*scalingo.Operation, error) { +func (m *MockAPI) OperationsShow(arg0 context.Context, arg1, arg2 string) (*scalingo.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OperationsShow", arg0, arg1) + ret := m.ctrl.Call(m, "OperationsShow", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } // OperationsShow indicates an expected call of OperationsShow. -func (mr *MockAPIMockRecorder) OperationsShow(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) OperationsShow(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OperationsShow", reflect.TypeOf((*MockAPI)(nil).OperationsShow), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OperationsShow", reflect.TypeOf((*MockAPI)(nil).OperationsShow), arg0, arg1, arg2) } // RegionsList mocks base method. -func (m *MockAPI) RegionsList() ([]scalingo.Region, error) { +func (m *MockAPI) RegionsList(arg0 context.Context) ([]scalingo.Region, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RegionsList") + ret := m.ctrl.Call(m, "RegionsList", arg0) ret0, _ := ret[0].([]scalingo.Region) ret1, _ := ret[1].(error) return ret0, ret1 } // RegionsList indicates an expected call of RegionsList. -func (mr *MockAPIMockRecorder) RegionsList() *gomock.Call { +func (mr *MockAPIMockRecorder) RegionsList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegionsList", reflect.TypeOf((*MockAPI)(nil).RegionsList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegionsList", reflect.TypeOf((*MockAPI)(nil).RegionsList), arg0) } // Run mocks base method. -func (m *MockAPI) Run(arg0 scalingo.RunOpts) (*scalingo.RunRes, error) { +func (m *MockAPI) Run(arg0 context.Context, arg1 scalingo.RunOpts) (*scalingo.RunRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Run", arg0) + ret := m.ctrl.Call(m, "Run", arg0, arg1) ret0, _ := ret[0].(*scalingo.RunRes) ret1, _ := ret[1].(error) return ret0, ret1 } // Run indicates an expected call of Run. -func (mr *MockAPIMockRecorder) Run(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) Run(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockAPI)(nil).Run), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockAPI)(nil).Run), arg0, arg1) } // RunRegionMigrationStep mocks base method. -func (m *MockAPI) RunRegionMigrationStep(arg0, arg1 string, arg2 scalingo.RegionMigrationStep) error { +func (m *MockAPI) RunRegionMigrationStep(arg0 context.Context, arg1, arg2 string, arg3 scalingo.RegionMigrationStep) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunRegionMigrationStep", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "RunRegionMigrationStep", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 } // RunRegionMigrationStep indicates an expected call of RunRegionMigrationStep. -func (mr *MockAPIMockRecorder) RunRegionMigrationStep(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) RunRegionMigrationStep(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunRegionMigrationStep", reflect.TypeOf((*MockAPI)(nil).RunRegionMigrationStep), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunRegionMigrationStep", reflect.TypeOf((*MockAPI)(nil).RunRegionMigrationStep), arg0, arg1, arg2, arg3) } // ScalingoAPI mocks base method. @@ -1390,158 +1391,158 @@ func (mr *MockAPIMockRecorder) ScalingoAPI() *gomock.Call { } // Self mocks base method. -func (m *MockAPI) Self() (*scalingo.User, error) { +func (m *MockAPI) Self(arg0 context.Context) (*scalingo.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Self") + ret := m.ctrl.Call(m, "Self", arg0) ret0, _ := ret[0].(*scalingo.User) ret1, _ := ret[1].(error) return ret0, ret1 } // Self indicates an expected call of Self. -func (mr *MockAPIMockRecorder) Self() *gomock.Call { +func (mr *MockAPIMockRecorder) Self(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Self", reflect.TypeOf((*MockAPI)(nil).Self)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Self", reflect.TypeOf((*MockAPI)(nil).Self), arg0) } // ShowRegionMigration mocks base method. -func (m *MockAPI) ShowRegionMigration(arg0, arg1 string) (scalingo.RegionMigration, error) { +func (m *MockAPI) ShowRegionMigration(arg0 context.Context, arg1, arg2 string) (scalingo.RegionMigration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ShowRegionMigration", arg0, arg1) + ret := m.ctrl.Call(m, "ShowRegionMigration", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.RegionMigration) ret1, _ := ret[1].(error) return ret0, ret1 } // ShowRegionMigration indicates an expected call of ShowRegionMigration. -func (mr *MockAPIMockRecorder) ShowRegionMigration(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) ShowRegionMigration(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShowRegionMigration", reflect.TypeOf((*MockAPI)(nil).ShowRegionMigration), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShowRegionMigration", reflect.TypeOf((*MockAPI)(nil).ShowRegionMigration), arg0, arg1, arg2) } // SignUp mocks base method. -func (m *MockAPI) SignUp(arg0, arg1 string) error { +func (m *MockAPI) SignUp(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SignUp", arg0, arg1) + ret := m.ctrl.Call(m, "SignUp", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // SignUp indicates an expected call of SignUp. -func (mr *MockAPIMockRecorder) SignUp(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) SignUp(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignUp", reflect.TypeOf((*MockAPI)(nil).SignUp), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignUp", reflect.TypeOf((*MockAPI)(nil).SignUp), arg0, arg1, arg2) } // SourcesCreate mocks base method. -func (m *MockAPI) SourcesCreate() (*scalingo.Source, error) { +func (m *MockAPI) SourcesCreate(arg0 context.Context) (*scalingo.Source, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SourcesCreate") + ret := m.ctrl.Call(m, "SourcesCreate", arg0) ret0, _ := ret[0].(*scalingo.Source) ret1, _ := ret[1].(error) return ret0, ret1 } // SourcesCreate indicates an expected call of SourcesCreate. -func (mr *MockAPIMockRecorder) SourcesCreate() *gomock.Call { +func (mr *MockAPIMockRecorder) SourcesCreate(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SourcesCreate", reflect.TypeOf((*MockAPI)(nil).SourcesCreate)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SourcesCreate", reflect.TypeOf((*MockAPI)(nil).SourcesCreate), arg0) } // StacksList mocks base method. -func (m *MockAPI) StacksList() ([]scalingo.Stack, error) { +func (m *MockAPI) StacksList(arg0 context.Context) ([]scalingo.Stack, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StacksList") + ret := m.ctrl.Call(m, "StacksList", arg0) ret0, _ := ret[0].([]scalingo.Stack) ret1, _ := ret[1].(error) return ret0, ret1 } // StacksList indicates an expected call of StacksList. -func (mr *MockAPIMockRecorder) StacksList() *gomock.Call { +func (mr *MockAPIMockRecorder) StacksList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StacksList", reflect.TypeOf((*MockAPI)(nil).StacksList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StacksList", reflect.TypeOf((*MockAPI)(nil).StacksList), arg0) } // TokenCreate mocks base method. -func (m *MockAPI) TokenCreate(arg0 scalingo.TokenCreateParams) (scalingo.Token, error) { +func (m *MockAPI) TokenCreate(arg0 context.Context, arg1 scalingo.TokenCreateParams) (scalingo.Token, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokenCreate", arg0) + ret := m.ctrl.Call(m, "TokenCreate", arg0, arg1) ret0, _ := ret[0].(scalingo.Token) ret1, _ := ret[1].(error) return ret0, ret1 } // TokenCreate indicates an expected call of TokenCreate. -func (mr *MockAPIMockRecorder) TokenCreate(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) TokenCreate(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenCreate", reflect.TypeOf((*MockAPI)(nil).TokenCreate), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenCreate", reflect.TypeOf((*MockAPI)(nil).TokenCreate), arg0, arg1) } // TokenExchange mocks base method. -func (m *MockAPI) TokenExchange(arg0 string) (string, error) { +func (m *MockAPI) TokenExchange(arg0 context.Context, arg1 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokenExchange", arg0) + ret := m.ctrl.Call(m, "TokenExchange", arg0, arg1) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // TokenExchange indicates an expected call of TokenExchange. -func (mr *MockAPIMockRecorder) TokenExchange(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) TokenExchange(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenExchange", reflect.TypeOf((*MockAPI)(nil).TokenExchange), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenExchange", reflect.TypeOf((*MockAPI)(nil).TokenExchange), arg0, arg1) } // TokenShow mocks base method. -func (m *MockAPI) TokenShow(arg0 int) (scalingo.Token, error) { +func (m *MockAPI) TokenShow(arg0 context.Context, arg1 int) (scalingo.Token, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokenShow", arg0) + ret := m.ctrl.Call(m, "TokenShow", arg0, arg1) ret0, _ := ret[0].(scalingo.Token) ret1, _ := ret[1].(error) return ret0, ret1 } // TokenShow indicates an expected call of TokenShow. -func (mr *MockAPIMockRecorder) TokenShow(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) TokenShow(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenShow", reflect.TypeOf((*MockAPI)(nil).TokenShow), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenShow", reflect.TypeOf((*MockAPI)(nil).TokenShow), arg0, arg1) } // TokensList mocks base method. -func (m *MockAPI) TokensList() (scalingo.Tokens, error) { +func (m *MockAPI) TokensList(arg0 context.Context) (scalingo.Tokens, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokensList") + ret := m.ctrl.Call(m, "TokensList", arg0) ret0, _ := ret[0].(scalingo.Tokens) ret1, _ := ret[1].(error) return ret0, ret1 } // TokensList indicates an expected call of TokensList. -func (mr *MockAPIMockRecorder) TokensList() *gomock.Call { +func (mr *MockAPIMockRecorder) TokensList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokensList", reflect.TypeOf((*MockAPI)(nil).TokensList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokensList", reflect.TypeOf((*MockAPI)(nil).TokensList), arg0) } // UpdateUser mocks base method. -func (m *MockAPI) UpdateUser(arg0 scalingo.UpdateUserParams) (*scalingo.User, error) { +func (m *MockAPI) UpdateUser(arg0 context.Context, arg1 scalingo.UpdateUserParams) (*scalingo.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateUser", arg0) + ret := m.ctrl.Call(m, "UpdateUser", arg0, arg1) ret0, _ := ret[0].(*scalingo.User) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateUser indicates an expected call of UpdateUser. -func (mr *MockAPIMockRecorder) UpdateUser(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) UpdateUser(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUser", reflect.TypeOf((*MockAPI)(nil).UpdateUser), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUser", reflect.TypeOf((*MockAPI)(nil).UpdateUser), arg0, arg1) } // UserEventsList mocks base method. -func (m *MockAPI) UserEventsList(arg0 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { +func (m *MockAPI) UserEventsList(arg0 context.Context, arg1 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UserEventsList", arg0) + ret := m.ctrl.Call(m, "UserEventsList", arg0, arg1) ret0, _ := ret[0].(scalingo.Events) ret1, _ := ret[1].(scalingo.PaginationMeta) ret2, _ := ret[2].(error) @@ -1549,29 +1550,29 @@ func (m *MockAPI) UserEventsList(arg0 scalingo.PaginationOpts) (scalingo.Events, } // UserEventsList indicates an expected call of UserEventsList. -func (mr *MockAPIMockRecorder) UserEventsList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) UserEventsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserEventsList", reflect.TypeOf((*MockAPI)(nil).UserEventsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserEventsList", reflect.TypeOf((*MockAPI)(nil).UserEventsList), arg0, arg1) } // UserStopFreeTrial mocks base method. -func (m *MockAPI) UserStopFreeTrial() error { +func (m *MockAPI) UserStopFreeTrial(arg0 context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UserStopFreeTrial") + ret := m.ctrl.Call(m, "UserStopFreeTrial", arg0) ret0, _ := ret[0].(error) return ret0 } // UserStopFreeTrial indicates an expected call of UserStopFreeTrial. -func (mr *MockAPIMockRecorder) UserStopFreeTrial() *gomock.Call { +func (mr *MockAPIMockRecorder) UserStopFreeTrial(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserStopFreeTrial", reflect.TypeOf((*MockAPI)(nil).UserStopFreeTrial)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserStopFreeTrial", reflect.TypeOf((*MockAPI)(nil).UserStopFreeTrial), arg0) } // VariableMultipleSet mocks base method. -func (m *MockAPI) VariableMultipleSet(arg0 string, arg1 scalingo.Variables) (scalingo.Variables, int, error) { +func (m *MockAPI) VariableMultipleSet(arg0 context.Context, arg1 string, arg2 scalingo.Variables) (scalingo.Variables, int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariableMultipleSet", arg0, arg1) + ret := m.ctrl.Call(m, "VariableMultipleSet", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Variables) ret1, _ := ret[1].(int) ret2, _ := ret[2].(error) @@ -1579,15 +1580,15 @@ func (m *MockAPI) VariableMultipleSet(arg0 string, arg1 scalingo.Variables) (sca } // VariableMultipleSet indicates an expected call of VariableMultipleSet. -func (mr *MockAPIMockRecorder) VariableMultipleSet(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) VariableMultipleSet(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableMultipleSet", reflect.TypeOf((*MockAPI)(nil).VariableMultipleSet), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableMultipleSet", reflect.TypeOf((*MockAPI)(nil).VariableMultipleSet), arg0, arg1, arg2) } // VariableSet mocks base method. -func (m *MockAPI) VariableSet(arg0, arg1, arg2 string) (*scalingo.Variable, int, error) { +func (m *MockAPI) VariableSet(arg0 context.Context, arg1, arg2, arg3 string) (*scalingo.Variable, int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariableSet", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "VariableSet", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Variable) ret1, _ := ret[1].(int) ret2, _ := ret[2].(error) @@ -1595,51 +1596,51 @@ func (m *MockAPI) VariableSet(arg0, arg1, arg2 string) (*scalingo.Variable, int, } // VariableSet indicates an expected call of VariableSet. -func (mr *MockAPIMockRecorder) VariableSet(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) VariableSet(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableSet", reflect.TypeOf((*MockAPI)(nil).VariableSet), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableSet", reflect.TypeOf((*MockAPI)(nil).VariableSet), arg0, arg1, arg2, arg3) } // VariableUnset mocks base method. -func (m *MockAPI) VariableUnset(arg0, arg1 string) error { +func (m *MockAPI) VariableUnset(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariableUnset", arg0, arg1) + ret := m.ctrl.Call(m, "VariableUnset", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // VariableUnset indicates an expected call of VariableUnset. -func (mr *MockAPIMockRecorder) VariableUnset(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) VariableUnset(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableUnset", reflect.TypeOf((*MockAPI)(nil).VariableUnset), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableUnset", reflect.TypeOf((*MockAPI)(nil).VariableUnset), arg0, arg1, arg2) } // VariablesList mocks base method. -func (m *MockAPI) VariablesList(arg0 string) (scalingo.Variables, error) { +func (m *MockAPI) VariablesList(arg0 context.Context, arg1 string) (scalingo.Variables, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariablesList", arg0) + ret := m.ctrl.Call(m, "VariablesList", arg0, arg1) ret0, _ := ret[0].(scalingo.Variables) ret1, _ := ret[1].(error) return ret0, ret1 } // VariablesList indicates an expected call of VariablesList. -func (mr *MockAPIMockRecorder) VariablesList(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) VariablesList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesList", reflect.TypeOf((*MockAPI)(nil).VariablesList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesList", reflect.TypeOf((*MockAPI)(nil).VariablesList), arg0, arg1) } // VariablesListWithoutAlias mocks base method. -func (m *MockAPI) VariablesListWithoutAlias(arg0 string) (scalingo.Variables, error) { +func (m *MockAPI) VariablesListWithoutAlias(arg0 context.Context, arg1 string) (scalingo.Variables, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariablesListWithoutAlias", arg0) + ret := m.ctrl.Call(m, "VariablesListWithoutAlias", arg0, arg1) ret0, _ := ret[0].(scalingo.Variables) ret1, _ := ret[1].(error) return ret0, ret1 } // VariablesListWithoutAlias indicates an expected call of VariablesListWithoutAlias. -func (mr *MockAPIMockRecorder) VariablesListWithoutAlias(arg0 interface{}) *gomock.Call { +func (mr *MockAPIMockRecorder) VariablesListWithoutAlias(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesListWithoutAlias", reflect.TypeOf((*MockAPI)(nil).VariablesListWithoutAlias), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesListWithoutAlias", reflect.TypeOf((*MockAPI)(nil).VariablesListWithoutAlias), arg0, arg1) } diff --git a/scalingomock/appsservice_mock.go b/scalingomock/appsservice_mock.go index 7e68790f..b33b5277 100644 --- a/scalingomock/appsservice_mock.go +++ b/scalingomock/appsservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" http "net/http" reflect "reflect" @@ -36,240 +37,240 @@ func (m *MockAppsService) EXPECT() *MockAppsServiceMockRecorder { } // AppsContainerTypes mocks base method. -func (m *MockAppsService) AppsContainerTypes(arg0 string) ([]scalingo.ContainerType, error) { +func (m *MockAppsService) AppsContainerTypes(arg0 context.Context, arg1 string) ([]scalingo.ContainerType, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsContainerTypes", arg0) + ret := m.ctrl.Call(m, "AppsContainerTypes", arg0, arg1) ret0, _ := ret[0].([]scalingo.ContainerType) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsContainerTypes indicates an expected call of AppsContainerTypes. -func (mr *MockAppsServiceMockRecorder) AppsContainerTypes(arg0 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsContainerTypes(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainerTypes", reflect.TypeOf((*MockAppsService)(nil).AppsContainerTypes), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainerTypes", reflect.TypeOf((*MockAppsService)(nil).AppsContainerTypes), arg0, arg1) } // AppsContainersPs mocks base method. -func (m *MockAppsService) AppsContainersPs(arg0 string) ([]scalingo.Container, error) { +func (m *MockAppsService) AppsContainersPs(arg0 context.Context, arg1 string) ([]scalingo.Container, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsContainersPs", arg0) + ret := m.ctrl.Call(m, "AppsContainersPs", arg0, arg1) ret0, _ := ret[0].([]scalingo.Container) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsContainersPs indicates an expected call of AppsContainersPs. -func (mr *MockAppsServiceMockRecorder) AppsContainersPs(arg0 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsContainersPs(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainersPs", reflect.TypeOf((*MockAppsService)(nil).AppsContainersPs), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsContainersPs", reflect.TypeOf((*MockAppsService)(nil).AppsContainersPs), arg0, arg1) } // AppsCreate mocks base method. -func (m *MockAppsService) AppsCreate(arg0 scalingo.AppsCreateOpts) (*scalingo.App, error) { +func (m *MockAppsService) AppsCreate(arg0 context.Context, arg1 scalingo.AppsCreateOpts) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsCreate", arg0) + ret := m.ctrl.Call(m, "AppsCreate", arg0, arg1) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsCreate indicates an expected call of AppsCreate. -func (mr *MockAppsServiceMockRecorder) AppsCreate(arg0 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsCreate(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsCreate", reflect.TypeOf((*MockAppsService)(nil).AppsCreate), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsCreate", reflect.TypeOf((*MockAppsService)(nil).AppsCreate), arg0, arg1) } // AppsDestroy mocks base method. -func (m *MockAppsService) AppsDestroy(arg0, arg1 string) error { +func (m *MockAppsService) AppsDestroy(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsDestroy", arg0, arg1) + ret := m.ctrl.Call(m, "AppsDestroy", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // AppsDestroy indicates an expected call of AppsDestroy. -func (mr *MockAppsServiceMockRecorder) AppsDestroy(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsDestroy(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsDestroy", reflect.TypeOf((*MockAppsService)(nil).AppsDestroy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsDestroy", reflect.TypeOf((*MockAppsService)(nil).AppsDestroy), arg0, arg1, arg2) } // AppsForceHTTPS mocks base method. -func (m *MockAppsService) AppsForceHTTPS(arg0 string, arg1 bool) (*scalingo.App, error) { +func (m *MockAppsService) AppsForceHTTPS(arg0 context.Context, arg1 string, arg2 bool) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsForceHTTPS", arg0, arg1) + ret := m.ctrl.Call(m, "AppsForceHTTPS", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsForceHTTPS indicates an expected call of AppsForceHTTPS. -func (mr *MockAppsServiceMockRecorder) AppsForceHTTPS(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsForceHTTPS(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsForceHTTPS", reflect.TypeOf((*MockAppsService)(nil).AppsForceHTTPS), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsForceHTTPS", reflect.TypeOf((*MockAppsService)(nil).AppsForceHTTPS), arg0, arg1, arg2) } // AppsList mocks base method. -func (m *MockAppsService) AppsList() ([]*scalingo.App, error) { +func (m *MockAppsService) AppsList(arg0 context.Context) ([]*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsList") + ret := m.ctrl.Call(m, "AppsList", arg0) ret0, _ := ret[0].([]*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsList indicates an expected call of AppsList. -func (mr *MockAppsServiceMockRecorder) AppsList() *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsList", reflect.TypeOf((*MockAppsService)(nil).AppsList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsList", reflect.TypeOf((*MockAppsService)(nil).AppsList), arg0) } // AppsPs mocks base method. -func (m *MockAppsService) AppsPs(arg0 string) ([]scalingo.ContainerType, error) { +func (m *MockAppsService) AppsPs(arg0 context.Context, arg1 string) ([]scalingo.ContainerType, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsPs", arg0) + ret := m.ctrl.Call(m, "AppsPs", arg0, arg1) ret0, _ := ret[0].([]scalingo.ContainerType) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsPs indicates an expected call of AppsPs. -func (mr *MockAppsServiceMockRecorder) AppsPs(arg0 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsPs(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsPs", reflect.TypeOf((*MockAppsService)(nil).AppsPs), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsPs", reflect.TypeOf((*MockAppsService)(nil).AppsPs), arg0, arg1) } // AppsRename mocks base method. -func (m *MockAppsService) AppsRename(arg0, arg1 string) (*scalingo.App, error) { +func (m *MockAppsService) AppsRename(arg0 context.Context, arg1, arg2 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsRename", arg0, arg1) + ret := m.ctrl.Call(m, "AppsRename", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsRename indicates an expected call of AppsRename. -func (mr *MockAppsServiceMockRecorder) AppsRename(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsRename(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRename", reflect.TypeOf((*MockAppsService)(nil).AppsRename), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRename", reflect.TypeOf((*MockAppsService)(nil).AppsRename), arg0, arg1, arg2) } // AppsRestart mocks base method. -func (m *MockAppsService) AppsRestart(arg0 string, arg1 *scalingo.AppsRestartParams) (*http.Response, error) { +func (m *MockAppsService) AppsRestart(arg0 context.Context, arg1 string, arg2 *scalingo.AppsRestartParams) (*http.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsRestart", arg0, arg1) + ret := m.ctrl.Call(m, "AppsRestart", arg0, arg1, arg2) ret0, _ := ret[0].(*http.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsRestart indicates an expected call of AppsRestart. -func (mr *MockAppsServiceMockRecorder) AppsRestart(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsRestart(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRestart", reflect.TypeOf((*MockAppsService)(nil).AppsRestart), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRestart", reflect.TypeOf((*MockAppsService)(nil).AppsRestart), arg0, arg1, arg2) } // AppsRouterLogs mocks base method. -func (m *MockAppsService) AppsRouterLogs(arg0 string, arg1 bool) (*scalingo.App, error) { +func (m *MockAppsService) AppsRouterLogs(arg0 context.Context, arg1 string, arg2 bool) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsRouterLogs", arg0, arg1) + ret := m.ctrl.Call(m, "AppsRouterLogs", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsRouterLogs indicates an expected call of AppsRouterLogs. -func (mr *MockAppsServiceMockRecorder) AppsRouterLogs(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsRouterLogs(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRouterLogs", reflect.TypeOf((*MockAppsService)(nil).AppsRouterLogs), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsRouterLogs", reflect.TypeOf((*MockAppsService)(nil).AppsRouterLogs), arg0, arg1, arg2) } // AppsScale mocks base method. -func (m *MockAppsService) AppsScale(arg0 string, arg1 *scalingo.AppsScaleParams) (*http.Response, error) { +func (m *MockAppsService) AppsScale(arg0 context.Context, arg1 string, arg2 *scalingo.AppsScaleParams) (*http.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsScale", arg0, arg1) + ret := m.ctrl.Call(m, "AppsScale", arg0, arg1, arg2) ret0, _ := ret[0].(*http.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsScale indicates an expected call of AppsScale. -func (mr *MockAppsServiceMockRecorder) AppsScale(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsScale(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsScale", reflect.TypeOf((*MockAppsService)(nil).AppsScale), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsScale", reflect.TypeOf((*MockAppsService)(nil).AppsScale), arg0, arg1, arg2) } // AppsSetStack mocks base method. -func (m *MockAppsService) AppsSetStack(arg0, arg1 string) (*scalingo.App, error) { +func (m *MockAppsService) AppsSetStack(arg0 context.Context, arg1, arg2 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsSetStack", arg0, arg1) + ret := m.ctrl.Call(m, "AppsSetStack", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsSetStack indicates an expected call of AppsSetStack. -func (mr *MockAppsServiceMockRecorder) AppsSetStack(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsSetStack(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsSetStack", reflect.TypeOf((*MockAppsService)(nil).AppsSetStack), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsSetStack", reflect.TypeOf((*MockAppsService)(nil).AppsSetStack), arg0, arg1, arg2) } // AppsShow mocks base method. -func (m *MockAppsService) AppsShow(arg0 string) (*scalingo.App, error) { +func (m *MockAppsService) AppsShow(arg0 context.Context, arg1 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsShow", arg0) + ret := m.ctrl.Call(m, "AppsShow", arg0, arg1) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsShow indicates an expected call of AppsShow. -func (mr *MockAppsServiceMockRecorder) AppsShow(arg0 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsShow(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsShow", reflect.TypeOf((*MockAppsService)(nil).AppsShow), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsShow", reflect.TypeOf((*MockAppsService)(nil).AppsShow), arg0, arg1) } // AppsStats mocks base method. -func (m *MockAppsService) AppsStats(arg0 string) (*scalingo.AppStatsRes, error) { +func (m *MockAppsService) AppsStats(arg0 context.Context, arg1 string) (*scalingo.AppStatsRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsStats", arg0) + ret := m.ctrl.Call(m, "AppsStats", arg0, arg1) ret0, _ := ret[0].(*scalingo.AppStatsRes) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsStats indicates an expected call of AppsStats. -func (mr *MockAppsServiceMockRecorder) AppsStats(arg0 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsStats(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStats", reflect.TypeOf((*MockAppsService)(nil).AppsStats), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStats", reflect.TypeOf((*MockAppsService)(nil).AppsStats), arg0, arg1) } // AppsStickySession mocks base method. -func (m *MockAppsService) AppsStickySession(arg0 string, arg1 bool) (*scalingo.App, error) { +func (m *MockAppsService) AppsStickySession(arg0 context.Context, arg1 string, arg2 bool) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsStickySession", arg0, arg1) + ret := m.ctrl.Call(m, "AppsStickySession", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsStickySession indicates an expected call of AppsStickySession. -func (mr *MockAppsServiceMockRecorder) AppsStickySession(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsStickySession(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStickySession", reflect.TypeOf((*MockAppsService)(nil).AppsStickySession), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsStickySession", reflect.TypeOf((*MockAppsService)(nil).AppsStickySession), arg0, arg1, arg2) } // AppsTransfer mocks base method. -func (m *MockAppsService) AppsTransfer(arg0, arg1 string) (*scalingo.App, error) { +func (m *MockAppsService) AppsTransfer(arg0 context.Context, arg1, arg2 string) (*scalingo.App, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppsTransfer", arg0, arg1) + ret := m.ctrl.Call(m, "AppsTransfer", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.App) ret1, _ := ret[1].(error) return ret0, ret1 } // AppsTransfer indicates an expected call of AppsTransfer. -func (mr *MockAppsServiceMockRecorder) AppsTransfer(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAppsServiceMockRecorder) AppsTransfer(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsTransfer", reflect.TypeOf((*MockAppsService)(nil).AppsTransfer), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppsTransfer", reflect.TypeOf((*MockAppsService)(nil).AppsTransfer), arg0, arg1, arg2) } diff --git a/scalingomock/autoscalersservice_mock.go b/scalingomock/autoscalersservice_mock.go index 18c504a2..8bb2abb7 100644 --- a/scalingomock/autoscalersservice_mock.go +++ b/scalingomock/autoscalersservice_mock.go @@ -5,75 +5,76 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockAutoscalersService is a mock of AutoscalersService interface +// MockAutoscalersService is a mock of AutoscalersService interface. type MockAutoscalersService struct { ctrl *gomock.Controller recorder *MockAutoscalersServiceMockRecorder } -// MockAutoscalersServiceMockRecorder is the mock recorder for MockAutoscalersService +// MockAutoscalersServiceMockRecorder is the mock recorder for MockAutoscalersService. type MockAutoscalersServiceMockRecorder struct { mock *MockAutoscalersService } -// NewMockAutoscalersService creates a new mock instance +// NewMockAutoscalersService creates a new mock instance. func NewMockAutoscalersService(ctrl *gomock.Controller) *MockAutoscalersService { mock := &MockAutoscalersService{ctrl: ctrl} mock.recorder = &MockAutoscalersServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockAutoscalersService) EXPECT() *MockAutoscalersServiceMockRecorder { return m.recorder } -// AutoscalerAdd mocks base method -func (m *MockAutoscalersService) AutoscalerAdd(arg0 string, arg1 scalingo.AutoscalerAddParams) (*scalingo.Autoscaler, error) { +// AutoscalerAdd mocks base method. +func (m *MockAutoscalersService) AutoscalerAdd(arg0 context.Context, arg1 string, arg2 scalingo.AutoscalerAddParams) (*scalingo.Autoscaler, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AutoscalerAdd", arg0, arg1) + ret := m.ctrl.Call(m, "AutoscalerAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Autoscaler) ret1, _ := ret[1].(error) return ret0, ret1 } -// AutoscalerAdd indicates an expected call of AutoscalerAdd -func (mr *MockAutoscalersServiceMockRecorder) AutoscalerAdd(arg0, arg1 interface{}) *gomock.Call { +// AutoscalerAdd indicates an expected call of AutoscalerAdd. +func (mr *MockAutoscalersServiceMockRecorder) AutoscalerAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerAdd", reflect.TypeOf((*MockAutoscalersService)(nil).AutoscalerAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerAdd", reflect.TypeOf((*MockAutoscalersService)(nil).AutoscalerAdd), arg0, arg1, arg2) } -// AutoscalerRemove mocks base method -func (m *MockAutoscalersService) AutoscalerRemove(arg0, arg1 string) error { +// AutoscalerRemove mocks base method. +func (m *MockAutoscalersService) AutoscalerRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AutoscalerRemove", arg0, arg1) + ret := m.ctrl.Call(m, "AutoscalerRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// AutoscalerRemove indicates an expected call of AutoscalerRemove -func (mr *MockAutoscalersServiceMockRecorder) AutoscalerRemove(arg0, arg1 interface{}) *gomock.Call { +// AutoscalerRemove indicates an expected call of AutoscalerRemove. +func (mr *MockAutoscalersServiceMockRecorder) AutoscalerRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerRemove", reflect.TypeOf((*MockAutoscalersService)(nil).AutoscalerRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalerRemove", reflect.TypeOf((*MockAutoscalersService)(nil).AutoscalerRemove), arg0, arg1, arg2) } -// AutoscalersList mocks base method -func (m *MockAutoscalersService) AutoscalersList(arg0 string) ([]scalingo.Autoscaler, error) { +// AutoscalersList mocks base method. +func (m *MockAutoscalersService) AutoscalersList(arg0 context.Context, arg1 string) ([]scalingo.Autoscaler, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AutoscalersList", arg0) + ret := m.ctrl.Call(m, "AutoscalersList", arg0, arg1) ret0, _ := ret[0].([]scalingo.Autoscaler) ret1, _ := ret[1].(error) return ret0, ret1 } -// AutoscalersList indicates an expected call of AutoscalersList -func (mr *MockAutoscalersServiceMockRecorder) AutoscalersList(arg0 interface{}) *gomock.Call { +// AutoscalersList indicates an expected call of AutoscalersList. +func (mr *MockAutoscalersServiceMockRecorder) AutoscalersList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalersList", reflect.TypeOf((*MockAutoscalersService)(nil).AutoscalersList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutoscalersList", reflect.TypeOf((*MockAutoscalersService)(nil).AutoscalersList), arg0, arg1) } diff --git a/scalingomock/backupsservice_mock.go b/scalingomock/backupsservice_mock.go index 2f79ce20..fb2974ae 100644 --- a/scalingomock/backupsservice_mock.go +++ b/scalingomock/backupsservice_mock.go @@ -5,91 +5,92 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockBackupsService is a mock of BackupsService interface +// MockBackupsService is a mock of BackupsService interface. type MockBackupsService struct { ctrl *gomock.Controller recorder *MockBackupsServiceMockRecorder } -// MockBackupsServiceMockRecorder is the mock recorder for MockBackupsService +// MockBackupsServiceMockRecorder is the mock recorder for MockBackupsService. type MockBackupsServiceMockRecorder struct { mock *MockBackupsService } -// NewMockBackupsService creates a new mock instance +// NewMockBackupsService creates a new mock instance. func NewMockBackupsService(ctrl *gomock.Controller) *MockBackupsService { mock := &MockBackupsService{ctrl: ctrl} mock.recorder = &MockBackupsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockBackupsService) EXPECT() *MockBackupsServiceMockRecorder { return m.recorder } -// BackupCreate mocks base method -func (m *MockBackupsService) BackupCreate(arg0, arg1 string) (*scalingo.Backup, error) { +// BackupCreate mocks base method. +func (m *MockBackupsService) BackupCreate(arg0 context.Context, arg1, arg2 string) (*scalingo.Backup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupCreate", arg0, arg1) + ret := m.ctrl.Call(m, "BackupCreate", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Backup) ret1, _ := ret[1].(error) return ret0, ret1 } -// BackupCreate indicates an expected call of BackupCreate -func (mr *MockBackupsServiceMockRecorder) BackupCreate(arg0, arg1 interface{}) *gomock.Call { +// BackupCreate indicates an expected call of BackupCreate. +func (mr *MockBackupsServiceMockRecorder) BackupCreate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupCreate", reflect.TypeOf((*MockBackupsService)(nil).BackupCreate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupCreate", reflect.TypeOf((*MockBackupsService)(nil).BackupCreate), arg0, arg1, arg2) } -// BackupDownloadURL mocks base method -func (m *MockBackupsService) BackupDownloadURL(arg0, arg1, arg2 string) (string, error) { +// BackupDownloadURL mocks base method. +func (m *MockBackupsService) BackupDownloadURL(arg0 context.Context, arg1, arg2, arg3 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupDownloadURL", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "BackupDownloadURL", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } -// BackupDownloadURL indicates an expected call of BackupDownloadURL -func (mr *MockBackupsServiceMockRecorder) BackupDownloadURL(arg0, arg1, arg2 interface{}) *gomock.Call { +// BackupDownloadURL indicates an expected call of BackupDownloadURL. +func (mr *MockBackupsServiceMockRecorder) BackupDownloadURL(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupDownloadURL", reflect.TypeOf((*MockBackupsService)(nil).BackupDownloadURL), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupDownloadURL", reflect.TypeOf((*MockBackupsService)(nil).BackupDownloadURL), arg0, arg1, arg2, arg3) } -// BackupList mocks base method -func (m *MockBackupsService) BackupList(arg0, arg1 string) ([]scalingo.Backup, error) { +// BackupList mocks base method. +func (m *MockBackupsService) BackupList(arg0 context.Context, arg1, arg2 string) ([]scalingo.Backup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupList", arg0, arg1) + ret := m.ctrl.Call(m, "BackupList", arg0, arg1, arg2) ret0, _ := ret[0].([]scalingo.Backup) ret1, _ := ret[1].(error) return ret0, ret1 } -// BackupList indicates an expected call of BackupList -func (mr *MockBackupsServiceMockRecorder) BackupList(arg0, arg1 interface{}) *gomock.Call { +// BackupList indicates an expected call of BackupList. +func (mr *MockBackupsServiceMockRecorder) BackupList(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupList", reflect.TypeOf((*MockBackupsService)(nil).BackupList), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupList", reflect.TypeOf((*MockBackupsService)(nil).BackupList), arg0, arg1, arg2) } -// BackupShow mocks base method -func (m *MockBackupsService) BackupShow(arg0, arg1, arg2 string) (*scalingo.Backup, error) { +// BackupShow mocks base method. +func (m *MockBackupsService) BackupShow(arg0 context.Context, arg1, arg2, arg3 string) (*scalingo.Backup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BackupShow", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "BackupShow", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Backup) ret1, _ := ret[1].(error) return ret0, ret1 } -// BackupShow indicates an expected call of BackupShow -func (mr *MockBackupsServiceMockRecorder) BackupShow(arg0, arg1, arg2 interface{}) *gomock.Call { +// BackupShow indicates an expected call of BackupShow. +func (mr *MockBackupsServiceMockRecorder) BackupShow(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupShow", reflect.TypeOf((*MockBackupsService)(nil).BackupShow), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackupShow", reflect.TypeOf((*MockBackupsService)(nil).BackupShow), arg0, arg1, arg2, arg3) } diff --git a/scalingomock/collaboratorsservice_mock.go b/scalingomock/collaboratorsservice_mock.go index df8a334e..f1eca48a 100644 --- a/scalingomock/collaboratorsservice_mock.go +++ b/scalingomock/collaboratorsservice_mock.go @@ -5,75 +5,76 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockCollaboratorsService is a mock of CollaboratorsService interface +// MockCollaboratorsService is a mock of CollaboratorsService interface. type MockCollaboratorsService struct { ctrl *gomock.Controller recorder *MockCollaboratorsServiceMockRecorder } -// MockCollaboratorsServiceMockRecorder is the mock recorder for MockCollaboratorsService +// MockCollaboratorsServiceMockRecorder is the mock recorder for MockCollaboratorsService. type MockCollaboratorsServiceMockRecorder struct { mock *MockCollaboratorsService } -// NewMockCollaboratorsService creates a new mock instance +// NewMockCollaboratorsService creates a new mock instance. func NewMockCollaboratorsService(ctrl *gomock.Controller) *MockCollaboratorsService { mock := &MockCollaboratorsService{ctrl: ctrl} mock.recorder = &MockCollaboratorsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockCollaboratorsService) EXPECT() *MockCollaboratorsServiceMockRecorder { return m.recorder } -// CollaboratorAdd mocks base method -func (m *MockCollaboratorsService) CollaboratorAdd(arg0, arg1 string) (scalingo.Collaborator, error) { +// CollaboratorAdd mocks base method. +func (m *MockCollaboratorsService) CollaboratorAdd(arg0 context.Context, arg1, arg2 string) (scalingo.Collaborator, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CollaboratorAdd", arg0, arg1) + ret := m.ctrl.Call(m, "CollaboratorAdd", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Collaborator) ret1, _ := ret[1].(error) return ret0, ret1 } -// CollaboratorAdd indicates an expected call of CollaboratorAdd -func (mr *MockCollaboratorsServiceMockRecorder) CollaboratorAdd(arg0, arg1 interface{}) *gomock.Call { +// CollaboratorAdd indicates an expected call of CollaboratorAdd. +func (mr *MockCollaboratorsServiceMockRecorder) CollaboratorAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorAdd", reflect.TypeOf((*MockCollaboratorsService)(nil).CollaboratorAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorAdd", reflect.TypeOf((*MockCollaboratorsService)(nil).CollaboratorAdd), arg0, arg1, arg2) } -// CollaboratorRemove mocks base method -func (m *MockCollaboratorsService) CollaboratorRemove(arg0, arg1 string) error { +// CollaboratorRemove mocks base method. +func (m *MockCollaboratorsService) CollaboratorRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CollaboratorRemove", arg0, arg1) + ret := m.ctrl.Call(m, "CollaboratorRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// CollaboratorRemove indicates an expected call of CollaboratorRemove -func (mr *MockCollaboratorsServiceMockRecorder) CollaboratorRemove(arg0, arg1 interface{}) *gomock.Call { +// CollaboratorRemove indicates an expected call of CollaboratorRemove. +func (mr *MockCollaboratorsServiceMockRecorder) CollaboratorRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorRemove", reflect.TypeOf((*MockCollaboratorsService)(nil).CollaboratorRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorRemove", reflect.TypeOf((*MockCollaboratorsService)(nil).CollaboratorRemove), arg0, arg1, arg2) } -// CollaboratorsList mocks base method -func (m *MockCollaboratorsService) CollaboratorsList(arg0 string) ([]scalingo.Collaborator, error) { +// CollaboratorsList mocks base method. +func (m *MockCollaboratorsService) CollaboratorsList(arg0 context.Context, arg1 string) ([]scalingo.Collaborator, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CollaboratorsList", arg0) + ret := m.ctrl.Call(m, "CollaboratorsList", arg0, arg1) ret0, _ := ret[0].([]scalingo.Collaborator) ret1, _ := ret[1].(error) return ret0, ret1 } -// CollaboratorsList indicates an expected call of CollaboratorsList -func (mr *MockCollaboratorsServiceMockRecorder) CollaboratorsList(arg0 interface{}) *gomock.Call { +// CollaboratorsList indicates an expected call of CollaboratorsList. +func (mr *MockCollaboratorsServiceMockRecorder) CollaboratorsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorsList", reflect.TypeOf((*MockCollaboratorsService)(nil).CollaboratorsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CollaboratorsList", reflect.TypeOf((*MockCollaboratorsService)(nil).CollaboratorsList), arg0, arg1) } diff --git a/scalingomock/containersizesservice_mock.go b/scalingomock/containersizesservice_mock.go index 3fd501cd..f84fd86f 100644 --- a/scalingomock/containersizesservice_mock.go +++ b/scalingomock/containersizesservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" @@ -35,16 +36,16 @@ func (m *MockContainerSizesService) EXPECT() *MockContainerSizesServiceMockRecor } // ContainerSizesList mocks base method. -func (m *MockContainerSizesService) ContainerSizesList() ([]scalingo.ContainerSize, error) { +func (m *MockContainerSizesService) ContainerSizesList(arg0 context.Context) ([]scalingo.ContainerSize, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContainerSizesList") + ret := m.ctrl.Call(m, "ContainerSizesList", arg0) ret0, _ := ret[0].([]scalingo.ContainerSize) ret1, _ := ret[1].(error) return ret0, ret1 } // ContainerSizesList indicates an expected call of ContainerSizesList. -func (mr *MockContainerSizesServiceMockRecorder) ContainerSizesList() *gomock.Call { +func (mr *MockContainerSizesServiceMockRecorder) ContainerSizesList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSizesList", reflect.TypeOf((*MockContainerSizesService)(nil).ContainerSizesList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSizesList", reflect.TypeOf((*MockContainerSizesService)(nil).ContainerSizesList), arg0) } diff --git a/scalingomock/containersservice_mock.go b/scalingomock/containersservice_mock.go index 88b10e29..0d7eeb27 100644 --- a/scalingomock/containersservice_mock.go +++ b/scalingomock/containersservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" @@ -34,15 +35,15 @@ func (m *MockContainersService) EXPECT() *MockContainersServiceMockRecorder { } // ContainersStop mocks base method. -func (m *MockContainersService) ContainersStop(arg0, arg1 string) error { +func (m *MockContainersService) ContainersStop(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContainersStop", arg0, arg1) + ret := m.ctrl.Call(m, "ContainersStop", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // ContainersStop indicates an expected call of ContainersStop. -func (mr *MockContainersServiceMockRecorder) ContainersStop(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockContainersServiceMockRecorder) ContainersStop(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainersStop", reflect.TypeOf((*MockContainersService)(nil).ContainersStop), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainersStop", reflect.TypeOf((*MockContainersService)(nil).ContainersStop), arg0, arg1, arg2) } diff --git a/scalingomock/crontasksservice_mock.go b/scalingomock/crontasksservice_mock.go index 2c797047..255e836b 100644 --- a/scalingomock/crontasksservice_mock.go +++ b/scalingomock/crontasksservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" @@ -35,16 +36,16 @@ func (m *MockCronTasksService) EXPECT() *MockCronTasksServiceMockRecorder { } // CronTasksGet mocks base method. -func (m *MockCronTasksService) CronTasksGet(arg0 string) (scalingo.CronTasks, error) { +func (m *MockCronTasksService) CronTasksGet(arg0 context.Context, arg1 string) (scalingo.CronTasks, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CronTasksGet", arg0) + ret := m.ctrl.Call(m, "CronTasksGet", arg0, arg1) ret0, _ := ret[0].(scalingo.CronTasks) ret1, _ := ret[1].(error) return ret0, ret1 } // CronTasksGet indicates an expected call of CronTasksGet. -func (mr *MockCronTasksServiceMockRecorder) CronTasksGet(arg0 interface{}) *gomock.Call { +func (mr *MockCronTasksServiceMockRecorder) CronTasksGet(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CronTasksGet", reflect.TypeOf((*MockCronTasksService)(nil).CronTasksGet), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CronTasksGet", reflect.TypeOf((*MockCronTasksService)(nil).CronTasksGet), arg0, arg1) } diff --git a/scalingomock/deploymentsservice_mock.go b/scalingomock/deploymentsservice_mock.go index 8cce02cf..f2a292dc 100644 --- a/scalingomock/deploymentsservice_mock.go +++ b/scalingomock/deploymentsservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" http "net/http" reflect "reflect" @@ -37,39 +38,39 @@ func (m *MockDeploymentsService) EXPECT() *MockDeploymentsServiceMockRecorder { } // Deployment mocks base method. -func (m *MockDeploymentsService) Deployment(arg0, arg1 string) (*scalingo.Deployment, error) { +func (m *MockDeploymentsService) Deployment(arg0 context.Context, arg1, arg2 string) (*scalingo.Deployment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Deployment", arg0, arg1) + ret := m.ctrl.Call(m, "Deployment", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Deployment) ret1, _ := ret[1].(error) return ret0, ret1 } // Deployment indicates an expected call of Deployment. -func (mr *MockDeploymentsServiceMockRecorder) Deployment(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDeploymentsServiceMockRecorder) Deployment(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deployment", reflect.TypeOf((*MockDeploymentsService)(nil).Deployment), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deployment", reflect.TypeOf((*MockDeploymentsService)(nil).Deployment), arg0, arg1, arg2) } // DeploymentList mocks base method. -func (m *MockDeploymentsService) DeploymentList(arg0 string) ([]*scalingo.Deployment, error) { +func (m *MockDeploymentsService) DeploymentList(arg0 context.Context, arg1 string) ([]*scalingo.Deployment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentList", arg0) + ret := m.ctrl.Call(m, "DeploymentList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Deployment) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentList indicates an expected call of DeploymentList. -func (mr *MockDeploymentsServiceMockRecorder) DeploymentList(arg0 interface{}) *gomock.Call { +func (mr *MockDeploymentsServiceMockRecorder) DeploymentList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentList", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentList", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentList), arg0, arg1) } // DeploymentListWithPagination mocks base method. -func (m *MockDeploymentsService) DeploymentListWithPagination(arg0 string, arg1 scalingo.PaginationOpts) ([]*scalingo.Deployment, scalingo.PaginationMeta, error) { +func (m *MockDeploymentsService) DeploymentListWithPagination(arg0 context.Context, arg1 string, arg2 scalingo.PaginationOpts) ([]*scalingo.Deployment, scalingo.PaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentListWithPagination", arg0, arg1) + ret := m.ctrl.Call(m, "DeploymentListWithPagination", arg0, arg1, arg2) ret0, _ := ret[0].([]*scalingo.Deployment) ret1, _ := ret[1].(scalingo.PaginationMeta) ret2, _ := ret[2].(error) @@ -77,52 +78,52 @@ func (m *MockDeploymentsService) DeploymentListWithPagination(arg0 string, arg1 } // DeploymentListWithPagination indicates an expected call of DeploymentListWithPagination. -func (mr *MockDeploymentsServiceMockRecorder) DeploymentListWithPagination(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDeploymentsServiceMockRecorder) DeploymentListWithPagination(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentListWithPagination", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentListWithPagination), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentListWithPagination", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentListWithPagination), arg0, arg1, arg2) } // DeploymentLogs mocks base method. -func (m *MockDeploymentsService) DeploymentLogs(arg0 string) (*http.Response, error) { +func (m *MockDeploymentsService) DeploymentLogs(arg0 context.Context, arg1 string) (*http.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentLogs", arg0) + ret := m.ctrl.Call(m, "DeploymentLogs", arg0, arg1) ret0, _ := ret[0].(*http.Response) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentLogs indicates an expected call of DeploymentLogs. -func (mr *MockDeploymentsServiceMockRecorder) DeploymentLogs(arg0 interface{}) *gomock.Call { +func (mr *MockDeploymentsServiceMockRecorder) DeploymentLogs(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentLogs", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentLogs), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentLogs", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentLogs), arg0, arg1) } // DeploymentStream mocks base method. -func (m *MockDeploymentsService) DeploymentStream(arg0 string) (*websocket.Conn, error) { +func (m *MockDeploymentsService) DeploymentStream(arg0 context.Context, arg1 string) (*websocket.Conn, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentStream", arg0) + ret := m.ctrl.Call(m, "DeploymentStream", arg0, arg1) ret0, _ := ret[0].(*websocket.Conn) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentStream indicates an expected call of DeploymentStream. -func (mr *MockDeploymentsServiceMockRecorder) DeploymentStream(arg0 interface{}) *gomock.Call { +func (mr *MockDeploymentsServiceMockRecorder) DeploymentStream(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentStream", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentStream), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentStream", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentStream), arg0, arg1) } // DeploymentsCreate mocks base method. -func (m *MockDeploymentsService) DeploymentsCreate(arg0 string, arg1 *scalingo.DeploymentsCreateParams) (*scalingo.Deployment, error) { +func (m *MockDeploymentsService) DeploymentsCreate(arg0 context.Context, arg1 string, arg2 *scalingo.DeploymentsCreateParams) (*scalingo.Deployment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeploymentsCreate", arg0, arg1) + ret := m.ctrl.Call(m, "DeploymentsCreate", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Deployment) ret1, _ := ret[1].(error) return ret0, ret1 } // DeploymentsCreate indicates an expected call of DeploymentsCreate. -func (mr *MockDeploymentsServiceMockRecorder) DeploymentsCreate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDeploymentsServiceMockRecorder) DeploymentsCreate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentsCreate", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentsCreate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeploymentsCreate", reflect.TypeOf((*MockDeploymentsService)(nil).DeploymentsCreate), arg0, arg1, arg2) } diff --git a/scalingomock/domainsservice_mock.go b/scalingomock/domainsservice_mock.go index 7d065897..22b7940d 100644 --- a/scalingomock/domainsservice_mock.go +++ b/scalingomock/domainsservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" @@ -35,120 +36,120 @@ func (m *MockDomainsService) EXPECT() *MockDomainsServiceMockRecorder { } // DomainSetCanonical mocks base method. -func (m *MockDomainsService) DomainSetCanonical(arg0, arg1 string) (scalingo.Domain, error) { +func (m *MockDomainsService) DomainSetCanonical(arg0 context.Context, arg1, arg2 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainSetCanonical", arg0, arg1) + ret := m.ctrl.Call(m, "DomainSetCanonical", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainSetCanonical indicates an expected call of DomainSetCanonical. -func (mr *MockDomainsServiceMockRecorder) DomainSetCanonical(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainSetCanonical(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCanonical", reflect.TypeOf((*MockDomainsService)(nil).DomainSetCanonical), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCanonical", reflect.TypeOf((*MockDomainsService)(nil).DomainSetCanonical), arg0, arg1, arg2) } // DomainSetCertificate mocks base method. -func (m *MockDomainsService) DomainSetCertificate(arg0, arg1, arg2, arg3 string) (scalingo.Domain, error) { +func (m *MockDomainsService) DomainSetCertificate(arg0 context.Context, arg1, arg2, arg3, arg4 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainSetCertificate", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "DomainSetCertificate", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainSetCertificate indicates an expected call of DomainSetCertificate. -func (mr *MockDomainsServiceMockRecorder) DomainSetCertificate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainSetCertificate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCertificate", reflect.TypeOf((*MockDomainsService)(nil).DomainSetCertificate), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainSetCertificate", reflect.TypeOf((*MockDomainsService)(nil).DomainSetCertificate), arg0, arg1, arg2, arg3, arg4) } // DomainUnsetCanonical mocks base method. -func (m *MockDomainsService) DomainUnsetCanonical(arg0 string) (scalingo.Domain, error) { +func (m *MockDomainsService) DomainUnsetCanonical(arg0 context.Context, arg1 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainUnsetCanonical", arg0) + ret := m.ctrl.Call(m, "DomainUnsetCanonical", arg0, arg1) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainUnsetCanonical indicates an expected call of DomainUnsetCanonical. -func (mr *MockDomainsServiceMockRecorder) DomainUnsetCanonical(arg0 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainUnsetCanonical(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCanonical", reflect.TypeOf((*MockDomainsService)(nil).DomainUnsetCanonical), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCanonical", reflect.TypeOf((*MockDomainsService)(nil).DomainUnsetCanonical), arg0, arg1) } // DomainUnsetCertificate mocks base method. -func (m *MockDomainsService) DomainUnsetCertificate(arg0, arg1 string) (scalingo.Domain, error) { +func (m *MockDomainsService) DomainUnsetCertificate(arg0 context.Context, arg1, arg2 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainUnsetCertificate", arg0, arg1) + ret := m.ctrl.Call(m, "DomainUnsetCertificate", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainUnsetCertificate indicates an expected call of DomainUnsetCertificate. -func (mr *MockDomainsServiceMockRecorder) DomainUnsetCertificate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainUnsetCertificate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCertificate", reflect.TypeOf((*MockDomainsService)(nil).DomainUnsetCertificate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainUnsetCertificate", reflect.TypeOf((*MockDomainsService)(nil).DomainUnsetCertificate), arg0, arg1, arg2) } // DomainsAdd mocks base method. -func (m *MockDomainsService) DomainsAdd(arg0 string, arg1 scalingo.Domain) (scalingo.Domain, error) { +func (m *MockDomainsService) DomainsAdd(arg0 context.Context, arg1 string, arg2 scalingo.Domain) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsAdd", arg0, arg1) + ret := m.ctrl.Call(m, "DomainsAdd", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainsAdd indicates an expected call of DomainsAdd. -func (mr *MockDomainsServiceMockRecorder) DomainsAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainsAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsAdd", reflect.TypeOf((*MockDomainsService)(nil).DomainsAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsAdd", reflect.TypeOf((*MockDomainsService)(nil).DomainsAdd), arg0, arg1, arg2) } // DomainsList mocks base method. -func (m *MockDomainsService) DomainsList(arg0 string) ([]scalingo.Domain, error) { +func (m *MockDomainsService) DomainsList(arg0 context.Context, arg1 string) ([]scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsList", arg0) + ret := m.ctrl.Call(m, "DomainsList", arg0, arg1) ret0, _ := ret[0].([]scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainsList indicates an expected call of DomainsList. -func (mr *MockDomainsServiceMockRecorder) DomainsList(arg0 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsList", reflect.TypeOf((*MockDomainsService)(nil).DomainsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsList", reflect.TypeOf((*MockDomainsService)(nil).DomainsList), arg0, arg1) } // DomainsRemove mocks base method. -func (m *MockDomainsService) DomainsRemove(arg0, arg1 string) error { +func (m *MockDomainsService) DomainsRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsRemove", arg0, arg1) + ret := m.ctrl.Call(m, "DomainsRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // DomainsRemove indicates an expected call of DomainsRemove. -func (mr *MockDomainsServiceMockRecorder) DomainsRemove(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainsRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsRemove", reflect.TypeOf((*MockDomainsService)(nil).DomainsRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsRemove", reflect.TypeOf((*MockDomainsService)(nil).DomainsRemove), arg0, arg1, arg2) } // DomainsUpdate mocks base method. -func (m *MockDomainsService) DomainsUpdate(arg0, arg1, arg2, arg3 string) (scalingo.Domain, error) { +func (m *MockDomainsService) DomainsUpdate(arg0 context.Context, arg1, arg2, arg3, arg4 string) (scalingo.Domain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DomainsUpdate", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "DomainsUpdate", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(scalingo.Domain) ret1, _ := ret[1].(error) return ret0, ret1 } // DomainsUpdate indicates an expected call of DomainsUpdate. -func (mr *MockDomainsServiceMockRecorder) DomainsUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockDomainsServiceMockRecorder) DomainsUpdate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsUpdate", reflect.TypeOf((*MockDomainsService)(nil).DomainsUpdate), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DomainsUpdate", reflect.TypeOf((*MockDomainsService)(nil).DomainsUpdate), arg0, arg1, arg2, arg3, arg4) } diff --git a/scalingomock/eventsservice_mock.go b/scalingomock/eventsservice_mock.go index 89a46662..4a689d96 100644 --- a/scalingomock/eventsservice_mock.go +++ b/scalingomock/eventsservice_mock.go @@ -5,93 +5,94 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockEventsService is a mock of EventsService interface +// MockEventsService is a mock of EventsService interface. type MockEventsService struct { ctrl *gomock.Controller recorder *MockEventsServiceMockRecorder } -// MockEventsServiceMockRecorder is the mock recorder for MockEventsService +// MockEventsServiceMockRecorder is the mock recorder for MockEventsService. type MockEventsServiceMockRecorder struct { mock *MockEventsService } -// NewMockEventsService creates a new mock instance +// NewMockEventsService creates a new mock instance. func NewMockEventsService(ctrl *gomock.Controller) *MockEventsService { mock := &MockEventsService{ctrl: ctrl} mock.recorder = &MockEventsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockEventsService) EXPECT() *MockEventsServiceMockRecorder { return m.recorder } -// EventCategoriesList mocks base method -func (m *MockEventsService) EventCategoriesList() ([]scalingo.EventCategory, error) { +// EventCategoriesList mocks base method. +func (m *MockEventsService) EventCategoriesList(arg0 context.Context) ([]scalingo.EventCategory, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EventCategoriesList") + ret := m.ctrl.Call(m, "EventCategoriesList", arg0) ret0, _ := ret[0].([]scalingo.EventCategory) ret1, _ := ret[1].(error) return ret0, ret1 } -// EventCategoriesList indicates an expected call of EventCategoriesList -func (mr *MockEventsServiceMockRecorder) EventCategoriesList() *gomock.Call { +// EventCategoriesList indicates an expected call of EventCategoriesList. +func (mr *MockEventsServiceMockRecorder) EventCategoriesList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventCategoriesList", reflect.TypeOf((*MockEventsService)(nil).EventCategoriesList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventCategoriesList", reflect.TypeOf((*MockEventsService)(nil).EventCategoriesList), arg0) } -// EventTypesList mocks base method -func (m *MockEventsService) EventTypesList() ([]scalingo.EventType, error) { +// EventTypesList mocks base method. +func (m *MockEventsService) EventTypesList(arg0 context.Context) ([]scalingo.EventType, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EventTypesList") + ret := m.ctrl.Call(m, "EventTypesList", arg0) ret0, _ := ret[0].([]scalingo.EventType) ret1, _ := ret[1].(error) return ret0, ret1 } -// EventTypesList indicates an expected call of EventTypesList -func (mr *MockEventsServiceMockRecorder) EventTypesList() *gomock.Call { +// EventTypesList indicates an expected call of EventTypesList. +func (mr *MockEventsServiceMockRecorder) EventTypesList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventTypesList", reflect.TypeOf((*MockEventsService)(nil).EventTypesList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventTypesList", reflect.TypeOf((*MockEventsService)(nil).EventTypesList), arg0) } -// EventsList mocks base method -func (m *MockEventsService) EventsList(arg0 string, arg1 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { +// EventsList mocks base method. +func (m *MockEventsService) EventsList(arg0 context.Context, arg1 string, arg2 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EventsList", arg0, arg1) + ret := m.ctrl.Call(m, "EventsList", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Events) ret1, _ := ret[1].(scalingo.PaginationMeta) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// EventsList indicates an expected call of EventsList -func (mr *MockEventsServiceMockRecorder) EventsList(arg0, arg1 interface{}) *gomock.Call { +// EventsList indicates an expected call of EventsList. +func (mr *MockEventsServiceMockRecorder) EventsList(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventsList", reflect.TypeOf((*MockEventsService)(nil).EventsList), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventsList", reflect.TypeOf((*MockEventsService)(nil).EventsList), arg0, arg1, arg2) } -// UserEventsList mocks base method -func (m *MockEventsService) UserEventsList(arg0 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { +// UserEventsList mocks base method. +func (m *MockEventsService) UserEventsList(arg0 context.Context, arg1 scalingo.PaginationOpts) (scalingo.Events, scalingo.PaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UserEventsList", arg0) + ret := m.ctrl.Call(m, "UserEventsList", arg0, arg1) ret0, _ := ret[0].(scalingo.Events) ret1, _ := ret[1].(scalingo.PaginationMeta) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// UserEventsList indicates an expected call of UserEventsList -func (mr *MockEventsServiceMockRecorder) UserEventsList(arg0 interface{}) *gomock.Call { +// UserEventsList indicates an expected call of UserEventsList. +func (mr *MockEventsServiceMockRecorder) UserEventsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserEventsList", reflect.TypeOf((*MockEventsService)(nil).UserEventsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserEventsList", reflect.TypeOf((*MockEventsService)(nil).UserEventsList), arg0, arg1) } diff --git a/scalingomock/keysservice_mock.go b/scalingomock/keysservice_mock.go index eac33d46..639277f2 100644 --- a/scalingomock/keysservice_mock.go +++ b/scalingomock/keysservice_mock.go @@ -5,75 +5,76 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockKeysService is a mock of KeysService interface +// MockKeysService is a mock of KeysService interface. type MockKeysService struct { ctrl *gomock.Controller recorder *MockKeysServiceMockRecorder } -// MockKeysServiceMockRecorder is the mock recorder for MockKeysService +// MockKeysServiceMockRecorder is the mock recorder for MockKeysService. type MockKeysServiceMockRecorder struct { mock *MockKeysService } -// NewMockKeysService creates a new mock instance +// NewMockKeysService creates a new mock instance. func NewMockKeysService(ctrl *gomock.Controller) *MockKeysService { mock := &MockKeysService{ctrl: ctrl} mock.recorder = &MockKeysServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockKeysService) EXPECT() *MockKeysServiceMockRecorder { return m.recorder } -// KeysAdd mocks base method -func (m *MockKeysService) KeysAdd(arg0, arg1 string) (*scalingo.Key, error) { +// KeysAdd mocks base method. +func (m *MockKeysService) KeysAdd(arg0 context.Context, arg1, arg2 string) (*scalingo.Key, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "KeysAdd", arg0, arg1) + ret := m.ctrl.Call(m, "KeysAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Key) ret1, _ := ret[1].(error) return ret0, ret1 } -// KeysAdd indicates an expected call of KeysAdd -func (mr *MockKeysServiceMockRecorder) KeysAdd(arg0, arg1 interface{}) *gomock.Call { +// KeysAdd indicates an expected call of KeysAdd. +func (mr *MockKeysServiceMockRecorder) KeysAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysAdd", reflect.TypeOf((*MockKeysService)(nil).KeysAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysAdd", reflect.TypeOf((*MockKeysService)(nil).KeysAdd), arg0, arg1, arg2) } -// KeysDelete mocks base method -func (m *MockKeysService) KeysDelete(arg0 string) error { +// KeysDelete mocks base method. +func (m *MockKeysService) KeysDelete(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "KeysDelete", arg0) + ret := m.ctrl.Call(m, "KeysDelete", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } -// KeysDelete indicates an expected call of KeysDelete -func (mr *MockKeysServiceMockRecorder) KeysDelete(arg0 interface{}) *gomock.Call { +// KeysDelete indicates an expected call of KeysDelete. +func (mr *MockKeysServiceMockRecorder) KeysDelete(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysDelete", reflect.TypeOf((*MockKeysService)(nil).KeysDelete), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysDelete", reflect.TypeOf((*MockKeysService)(nil).KeysDelete), arg0, arg1) } -// KeysList mocks base method -func (m *MockKeysService) KeysList() ([]scalingo.Key, error) { +// KeysList mocks base method. +func (m *MockKeysService) KeysList(arg0 context.Context) ([]scalingo.Key, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "KeysList") + ret := m.ctrl.Call(m, "KeysList", arg0) ret0, _ := ret[0].([]scalingo.Key) ret1, _ := ret[1].(error) return ret0, ret1 } -// KeysList indicates an expected call of KeysList -func (mr *MockKeysServiceMockRecorder) KeysList() *gomock.Call { +// KeysList indicates an expected call of KeysList. +func (mr *MockKeysServiceMockRecorder) KeysList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysList", reflect.TypeOf((*MockKeysService)(nil).KeysList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeysList", reflect.TypeOf((*MockKeysService)(nil).KeysList), arg0) } diff --git a/scalingomock/logdrainsservice_mock.go b/scalingomock/logdrainsservice_mock.go index ea1a7936..32424a7e 100644 --- a/scalingomock/logdrainsservice_mock.go +++ b/scalingomock/logdrainsservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" @@ -35,89 +36,89 @@ func (m *MockLogDrainsService) EXPECT() *MockLogDrainsServiceMockRecorder { } // LogDrainAdd mocks base method. -func (m *MockLogDrainsService) LogDrainAdd(arg0 string, arg1 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { +func (m *MockLogDrainsService) LogDrainAdd(arg0 context.Context, arg1 string, arg2 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainAdd", arg0, arg1) + ret := m.ctrl.Call(m, "LogDrainAdd", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LogDrainRes) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainAdd indicates an expected call of LogDrainAdd. -func (mr *MockLogDrainsServiceMockRecorder) LogDrainAdd(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockLogDrainsServiceMockRecorder) LogDrainAdd(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAdd", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainAdd), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAdd", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainAdd), arg0, arg1, arg2) } // LogDrainAddonAdd mocks base method. -func (m *MockLogDrainsService) LogDrainAddonAdd(arg0, arg1 string, arg2 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { +func (m *MockLogDrainsService) LogDrainAddonAdd(arg0 context.Context, arg1, arg2 string, arg3 scalingo.LogDrainAddParams) (*scalingo.LogDrainRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainAddonAdd", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "LogDrainAddonAdd", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.LogDrainRes) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainAddonAdd indicates an expected call of LogDrainAddonAdd. -func (mr *MockLogDrainsServiceMockRecorder) LogDrainAddonAdd(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLogDrainsServiceMockRecorder) LogDrainAddonAdd(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonAdd", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainAddonAdd), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonAdd", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainAddonAdd), arg0, arg1, arg2, arg3) } // LogDrainAddonRemove mocks base method. -func (m *MockLogDrainsService) LogDrainAddonRemove(arg0, arg1, arg2 string) error { +func (m *MockLogDrainsService) LogDrainAddonRemove(arg0 context.Context, arg1, arg2, arg3 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainAddonRemove", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "LogDrainAddonRemove", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 } // LogDrainAddonRemove indicates an expected call of LogDrainAddonRemove. -func (mr *MockLogDrainsServiceMockRecorder) LogDrainAddonRemove(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockLogDrainsServiceMockRecorder) LogDrainAddonRemove(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonRemove", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainAddonRemove), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainAddonRemove", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainAddonRemove), arg0, arg1, arg2, arg3) } // LogDrainRemove mocks base method. -func (m *MockLogDrainsService) LogDrainRemove(arg0, arg1 string) error { +func (m *MockLogDrainsService) LogDrainRemove(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainRemove", arg0, arg1) + ret := m.ctrl.Call(m, "LogDrainRemove", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // LogDrainRemove indicates an expected call of LogDrainRemove. -func (mr *MockLogDrainsServiceMockRecorder) LogDrainRemove(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockLogDrainsServiceMockRecorder) LogDrainRemove(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainRemove", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainRemove), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainRemove", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainRemove), arg0, arg1, arg2) } // LogDrainsAddonList mocks base method. -func (m *MockLogDrainsService) LogDrainsAddonList(arg0, arg1 string) ([]scalingo.LogDrain, error) { +func (m *MockLogDrainsService) LogDrainsAddonList(arg0 context.Context, arg1, arg2 string) ([]scalingo.LogDrain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainsAddonList", arg0, arg1) + ret := m.ctrl.Call(m, "LogDrainsAddonList", arg0, arg1, arg2) ret0, _ := ret[0].([]scalingo.LogDrain) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainsAddonList indicates an expected call of LogDrainsAddonList. -func (mr *MockLogDrainsServiceMockRecorder) LogDrainsAddonList(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockLogDrainsServiceMockRecorder) LogDrainsAddonList(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsAddonList", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainsAddonList), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsAddonList", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainsAddonList), arg0, arg1, arg2) } // LogDrainsList mocks base method. -func (m *MockLogDrainsService) LogDrainsList(arg0 string) ([]scalingo.LogDrain, error) { +func (m *MockLogDrainsService) LogDrainsList(arg0 context.Context, arg1 string) ([]scalingo.LogDrain, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogDrainsList", arg0) + ret := m.ctrl.Call(m, "LogDrainsList", arg0, arg1) ret0, _ := ret[0].([]scalingo.LogDrain) ret1, _ := ret[1].(error) return ret0, ret1 } // LogDrainsList indicates an expected call of LogDrainsList. -func (mr *MockLogDrainsServiceMockRecorder) LogDrainsList(arg0 interface{}) *gomock.Call { +func (mr *MockLogDrainsServiceMockRecorder) LogDrainsList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsList", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainsList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogDrainsList", reflect.TypeOf((*MockLogDrainsService)(nil).LogDrainsList), arg0, arg1) } diff --git a/scalingomock/loginservice_mock.go b/scalingomock/loginservice_mock.go index 8283dbe1..b4ccfb50 100644 --- a/scalingomock/loginservice_mock.go +++ b/scalingomock/loginservice_mock.go @@ -5,46 +5,47 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockLoginService is a mock of LoginService interface +// MockLoginService is a mock of LoginService interface. type MockLoginService struct { ctrl *gomock.Controller recorder *MockLoginServiceMockRecorder } -// MockLoginServiceMockRecorder is the mock recorder for MockLoginService +// MockLoginServiceMockRecorder is the mock recorder for MockLoginService. type MockLoginServiceMockRecorder struct { mock *MockLoginService } -// NewMockLoginService creates a new mock instance +// NewMockLoginService creates a new mock instance. func NewMockLoginService(ctrl *gomock.Controller) *MockLoginService { mock := &MockLoginService{ctrl: ctrl} mock.recorder = &MockLoginServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockLoginService) EXPECT() *MockLoginServiceMockRecorder { return m.recorder } -// Login mocks base method -func (m *MockLoginService) Login(arg0, arg1 string) (*scalingo.LoginResponse, error) { +// Login mocks base method. +func (m *MockLoginService) Login(arg0 context.Context, arg1, arg2 string) (*scalingo.LoginResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Login", arg0, arg1) + ret := m.ctrl.Call(m, "Login", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LoginResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// Login indicates an expected call of Login -func (mr *MockLoginServiceMockRecorder) Login(arg0, arg1 interface{}) *gomock.Call { +// Login indicates an expected call of Login. +func (mr *MockLoginServiceMockRecorder) Login(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Login", reflect.TypeOf((*MockLoginService)(nil).Login), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Login", reflect.TypeOf((*MockLoginService)(nil).Login), arg0, arg1, arg2) } diff --git a/scalingomock/logsarchivesservice_mock.go b/scalingomock/logsarchivesservice_mock.go index 2208e1a3..a435e611 100644 --- a/scalingomock/logsarchivesservice_mock.go +++ b/scalingomock/logsarchivesservice_mock.go @@ -5,61 +5,62 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockLogsArchivesService is a mock of LogsArchivesService interface +// MockLogsArchivesService is a mock of LogsArchivesService interface. type MockLogsArchivesService struct { ctrl *gomock.Controller recorder *MockLogsArchivesServiceMockRecorder } -// MockLogsArchivesServiceMockRecorder is the mock recorder for MockLogsArchivesService +// MockLogsArchivesServiceMockRecorder is the mock recorder for MockLogsArchivesService. type MockLogsArchivesServiceMockRecorder struct { mock *MockLogsArchivesService } -// NewMockLogsArchivesService creates a new mock instance +// NewMockLogsArchivesService creates a new mock instance. func NewMockLogsArchivesService(ctrl *gomock.Controller) *MockLogsArchivesService { mock := &MockLogsArchivesService{ctrl: ctrl} mock.recorder = &MockLogsArchivesServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockLogsArchivesService) EXPECT() *MockLogsArchivesServiceMockRecorder { return m.recorder } -// LogsArchives mocks base method -func (m *MockLogsArchivesService) LogsArchives(arg0 string, arg1 int) (*scalingo.LogsArchivesResponse, error) { +// LogsArchives mocks base method. +func (m *MockLogsArchivesService) LogsArchives(arg0 context.Context, arg1 string, arg2 int) (*scalingo.LogsArchivesResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogsArchives", arg0, arg1) + ret := m.ctrl.Call(m, "LogsArchives", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LogsArchivesResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// LogsArchives indicates an expected call of LogsArchives -func (mr *MockLogsArchivesServiceMockRecorder) LogsArchives(arg0, arg1 interface{}) *gomock.Call { +// LogsArchives indicates an expected call of LogsArchives. +func (mr *MockLogsArchivesServiceMockRecorder) LogsArchives(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchives", reflect.TypeOf((*MockLogsArchivesService)(nil).LogsArchives), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchives", reflect.TypeOf((*MockLogsArchivesService)(nil).LogsArchives), arg0, arg1, arg2) } -// LogsArchivesByCursor mocks base method -func (m *MockLogsArchivesService) LogsArchivesByCursor(arg0, arg1 string) (*scalingo.LogsArchivesResponse, error) { +// LogsArchivesByCursor mocks base method. +func (m *MockLogsArchivesService) LogsArchivesByCursor(arg0 context.Context, arg1, arg2 string) (*scalingo.LogsArchivesResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogsArchivesByCursor", arg0, arg1) + ret := m.ctrl.Call(m, "LogsArchivesByCursor", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.LogsArchivesResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// LogsArchivesByCursor indicates an expected call of LogsArchivesByCursor -func (mr *MockLogsArchivesServiceMockRecorder) LogsArchivesByCursor(arg0, arg1 interface{}) *gomock.Call { +// LogsArchivesByCursor indicates an expected call of LogsArchivesByCursor. +func (mr *MockLogsArchivesServiceMockRecorder) LogsArchivesByCursor(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchivesByCursor", reflect.TypeOf((*MockLogsArchivesService)(nil).LogsArchivesByCursor), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsArchivesByCursor", reflect.TypeOf((*MockLogsArchivesService)(nil).LogsArchivesByCursor), arg0, arg1, arg2) } diff --git a/scalingomock/logsservice_mock.go b/scalingomock/logsservice_mock.go index 9f02db91..73fd20ac 100644 --- a/scalingomock/logsservice_mock.go +++ b/scalingomock/logsservice_mock.go @@ -5,61 +5,62 @@ package scalingomock import ( + context "context" http "net/http" reflect "reflect" gomock "github.com/golang/mock/gomock" ) -// MockLogsService is a mock of LogsService interface +// MockLogsService is a mock of LogsService interface. type MockLogsService struct { ctrl *gomock.Controller recorder *MockLogsServiceMockRecorder } -// MockLogsServiceMockRecorder is the mock recorder for MockLogsService +// MockLogsServiceMockRecorder is the mock recorder for MockLogsService. type MockLogsServiceMockRecorder struct { mock *MockLogsService } -// NewMockLogsService creates a new mock instance +// NewMockLogsService creates a new mock instance. func NewMockLogsService(ctrl *gomock.Controller) *MockLogsService { mock := &MockLogsService{ctrl: ctrl} mock.recorder = &MockLogsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockLogsService) EXPECT() *MockLogsServiceMockRecorder { return m.recorder } -// Logs mocks base method -func (m *MockLogsService) Logs(arg0 string, arg1 int, arg2 string) (*http.Response, error) { +// Logs mocks base method. +func (m *MockLogsService) Logs(arg0 context.Context, arg1 string, arg2 int, arg3 string) (*http.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Logs", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Logs", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*http.Response) ret1, _ := ret[1].(error) return ret0, ret1 } -// Logs indicates an expected call of Logs -func (mr *MockLogsServiceMockRecorder) Logs(arg0, arg1, arg2 interface{}) *gomock.Call { +// Logs indicates an expected call of Logs. +func (mr *MockLogsServiceMockRecorder) Logs(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Logs", reflect.TypeOf((*MockLogsService)(nil).Logs), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Logs", reflect.TypeOf((*MockLogsService)(nil).Logs), arg0, arg1, arg2, arg3) } -// LogsURL mocks base method -func (m *MockLogsService) LogsURL(arg0 string) (*http.Response, error) { +// LogsURL mocks base method. +func (m *MockLogsService) LogsURL(arg0 context.Context, arg1 string) (*http.Response, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LogsURL", arg0) + ret := m.ctrl.Call(m, "LogsURL", arg0, arg1) ret0, _ := ret[0].(*http.Response) ret1, _ := ret[1].(error) return ret0, ret1 } -// LogsURL indicates an expected call of LogsURL -func (mr *MockLogsServiceMockRecorder) LogsURL(arg0 interface{}) *gomock.Call { +// LogsURL indicates an expected call of LogsURL. +func (mr *MockLogsServiceMockRecorder) LogsURL(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsURL", reflect.TypeOf((*MockLogsService)(nil).LogsURL), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LogsURL", reflect.TypeOf((*MockLogsService)(nil).LogsURL), arg0, arg1) } diff --git a/scalingomock/notificationplatformsservice_mock.go b/scalingomock/notificationplatformsservice_mock.go index d925c300..87b5d5ea 100644 --- a/scalingomock/notificationplatformsservice_mock.go +++ b/scalingomock/notificationplatformsservice_mock.go @@ -5,61 +5,62 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockNotificationPlatformsService is a mock of NotificationPlatformsService interface +// MockNotificationPlatformsService is a mock of NotificationPlatformsService interface. type MockNotificationPlatformsService struct { ctrl *gomock.Controller recorder *MockNotificationPlatformsServiceMockRecorder } -// MockNotificationPlatformsServiceMockRecorder is the mock recorder for MockNotificationPlatformsService +// MockNotificationPlatformsServiceMockRecorder is the mock recorder for MockNotificationPlatformsService. type MockNotificationPlatformsServiceMockRecorder struct { mock *MockNotificationPlatformsService } -// NewMockNotificationPlatformsService creates a new mock instance +// NewMockNotificationPlatformsService creates a new mock instance. func NewMockNotificationPlatformsService(ctrl *gomock.Controller) *MockNotificationPlatformsService { mock := &MockNotificationPlatformsService{ctrl: ctrl} mock.recorder = &MockNotificationPlatformsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockNotificationPlatformsService) EXPECT() *MockNotificationPlatformsServiceMockRecorder { return m.recorder } -// NotificationPlatformByName mocks base method -func (m *MockNotificationPlatformsService) NotificationPlatformByName(arg0 string) ([]*scalingo.NotificationPlatform, error) { +// NotificationPlatformByName mocks base method. +func (m *MockNotificationPlatformsService) NotificationPlatformByName(arg0 context.Context, arg1 string) ([]*scalingo.NotificationPlatform, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotificationPlatformByName", arg0) + ret := m.ctrl.Call(m, "NotificationPlatformByName", arg0, arg1) ret0, _ := ret[0].([]*scalingo.NotificationPlatform) ret1, _ := ret[1].(error) return ret0, ret1 } -// NotificationPlatformByName indicates an expected call of NotificationPlatformByName -func (mr *MockNotificationPlatformsServiceMockRecorder) NotificationPlatformByName(arg0 interface{}) *gomock.Call { +// NotificationPlatformByName indicates an expected call of NotificationPlatformByName. +func (mr *MockNotificationPlatformsServiceMockRecorder) NotificationPlatformByName(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformByName", reflect.TypeOf((*MockNotificationPlatformsService)(nil).NotificationPlatformByName), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformByName", reflect.TypeOf((*MockNotificationPlatformsService)(nil).NotificationPlatformByName), arg0, arg1) } -// NotificationPlatformsList mocks base method -func (m *MockNotificationPlatformsService) NotificationPlatformsList() ([]*scalingo.NotificationPlatform, error) { +// NotificationPlatformsList mocks base method. +func (m *MockNotificationPlatformsService) NotificationPlatformsList(arg0 context.Context) ([]*scalingo.NotificationPlatform, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotificationPlatformsList") + ret := m.ctrl.Call(m, "NotificationPlatformsList", arg0) ret0, _ := ret[0].([]*scalingo.NotificationPlatform) ret1, _ := ret[1].(error) return ret0, ret1 } -// NotificationPlatformsList indicates an expected call of NotificationPlatformsList -func (mr *MockNotificationPlatformsServiceMockRecorder) NotificationPlatformsList() *gomock.Call { +// NotificationPlatformsList indicates an expected call of NotificationPlatformsList. +func (mr *MockNotificationPlatformsServiceMockRecorder) NotificationPlatformsList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformsList", reflect.TypeOf((*MockNotificationPlatformsService)(nil).NotificationPlatformsList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotificationPlatformsList", reflect.TypeOf((*MockNotificationPlatformsService)(nil).NotificationPlatformsList), arg0) } diff --git a/scalingomock/notifiersservice_mock.go b/scalingomock/notifiersservice_mock.go index d6bad8c3..cda136ec 100644 --- a/scalingomock/notifiersservice_mock.go +++ b/scalingomock/notifiersservice_mock.go @@ -5,105 +5,106 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockNotifiersService is a mock of NotifiersService interface +// MockNotifiersService is a mock of NotifiersService interface. type MockNotifiersService struct { ctrl *gomock.Controller recorder *MockNotifiersServiceMockRecorder } -// MockNotifiersServiceMockRecorder is the mock recorder for MockNotifiersService +// MockNotifiersServiceMockRecorder is the mock recorder for MockNotifiersService. type MockNotifiersServiceMockRecorder struct { mock *MockNotifiersService } -// NewMockNotifiersService creates a new mock instance +// NewMockNotifiersService creates a new mock instance. func NewMockNotifiersService(ctrl *gomock.Controller) *MockNotifiersService { mock := &MockNotifiersService{ctrl: ctrl} mock.recorder = &MockNotifiersServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockNotifiersService) EXPECT() *MockNotifiersServiceMockRecorder { return m.recorder } -// NotifierByID mocks base method -func (m *MockNotifiersService) NotifierByID(arg0, arg1 string) (*scalingo.Notifier, error) { +// NotifierByID mocks base method. +func (m *MockNotifiersService) NotifierByID(arg0 context.Context, arg1, arg2 string) (*scalingo.Notifier, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierByID", arg0, arg1) + ret := m.ctrl.Call(m, "NotifierByID", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Notifier) ret1, _ := ret[1].(error) return ret0, ret1 } -// NotifierByID indicates an expected call of NotifierByID -func (mr *MockNotifiersServiceMockRecorder) NotifierByID(arg0, arg1 interface{}) *gomock.Call { +// NotifierByID indicates an expected call of NotifierByID. +func (mr *MockNotifiersServiceMockRecorder) NotifierByID(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierByID", reflect.TypeOf((*MockNotifiersService)(nil).NotifierByID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierByID", reflect.TypeOf((*MockNotifiersService)(nil).NotifierByID), arg0, arg1, arg2) } -// NotifierDestroy mocks base method -func (m *MockNotifiersService) NotifierDestroy(arg0, arg1 string) error { +// NotifierDestroy mocks base method. +func (m *MockNotifiersService) NotifierDestroy(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierDestroy", arg0, arg1) + ret := m.ctrl.Call(m, "NotifierDestroy", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// NotifierDestroy indicates an expected call of NotifierDestroy -func (mr *MockNotifiersServiceMockRecorder) NotifierDestroy(arg0, arg1 interface{}) *gomock.Call { +// NotifierDestroy indicates an expected call of NotifierDestroy. +func (mr *MockNotifiersServiceMockRecorder) NotifierDestroy(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierDestroy", reflect.TypeOf((*MockNotifiersService)(nil).NotifierDestroy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierDestroy", reflect.TypeOf((*MockNotifiersService)(nil).NotifierDestroy), arg0, arg1, arg2) } -// NotifierProvision mocks base method -func (m *MockNotifiersService) NotifierProvision(arg0 string, arg1 scalingo.NotifierParams) (*scalingo.Notifier, error) { +// NotifierProvision mocks base method. +func (m *MockNotifiersService) NotifierProvision(arg0 context.Context, arg1 string, arg2 scalingo.NotifierParams) (*scalingo.Notifier, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierProvision", arg0, arg1) + ret := m.ctrl.Call(m, "NotifierProvision", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Notifier) ret1, _ := ret[1].(error) return ret0, ret1 } -// NotifierProvision indicates an expected call of NotifierProvision -func (mr *MockNotifiersServiceMockRecorder) NotifierProvision(arg0, arg1 interface{}) *gomock.Call { +// NotifierProvision indicates an expected call of NotifierProvision. +func (mr *MockNotifiersServiceMockRecorder) NotifierProvision(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierProvision", reflect.TypeOf((*MockNotifiersService)(nil).NotifierProvision), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierProvision", reflect.TypeOf((*MockNotifiersService)(nil).NotifierProvision), arg0, arg1, arg2) } -// NotifierUpdate mocks base method -func (m *MockNotifiersService) NotifierUpdate(arg0, arg1 string, arg2 scalingo.NotifierParams) (*scalingo.Notifier, error) { +// NotifierUpdate mocks base method. +func (m *MockNotifiersService) NotifierUpdate(arg0 context.Context, arg1, arg2 string, arg3 scalingo.NotifierParams) (*scalingo.Notifier, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifierUpdate", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "NotifierUpdate", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Notifier) ret1, _ := ret[1].(error) return ret0, ret1 } -// NotifierUpdate indicates an expected call of NotifierUpdate -func (mr *MockNotifiersServiceMockRecorder) NotifierUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { +// NotifierUpdate indicates an expected call of NotifierUpdate. +func (mr *MockNotifiersServiceMockRecorder) NotifierUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierUpdate", reflect.TypeOf((*MockNotifiersService)(nil).NotifierUpdate), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifierUpdate", reflect.TypeOf((*MockNotifiersService)(nil).NotifierUpdate), arg0, arg1, arg2, arg3) } -// NotifiersList mocks base method -func (m *MockNotifiersService) NotifiersList(arg0 string) (scalingo.Notifiers, error) { +// NotifiersList mocks base method. +func (m *MockNotifiersService) NotifiersList(arg0 context.Context, arg1 string) (scalingo.Notifiers, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NotifiersList", arg0) + ret := m.ctrl.Call(m, "NotifiersList", arg0, arg1) ret0, _ := ret[0].(scalingo.Notifiers) ret1, _ := ret[1].(error) return ret0, ret1 } -// NotifiersList indicates an expected call of NotifiersList -func (mr *MockNotifiersServiceMockRecorder) NotifiersList(arg0 interface{}) *gomock.Call { +// NotifiersList indicates an expected call of NotifiersList. +func (mr *MockNotifiersServiceMockRecorder) NotifiersList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifiersList", reflect.TypeOf((*MockNotifiersService)(nil).NotifiersList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NotifiersList", reflect.TypeOf((*MockNotifiersService)(nil).NotifiersList), arg0, arg1) } diff --git a/scalingomock/operationsservice_mock.go b/scalingomock/operationsservice_mock.go index b945af32..9c87db4b 100644 --- a/scalingomock/operationsservice_mock.go +++ b/scalingomock/operationsservice_mock.go @@ -5,46 +5,47 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockOperationsService is a mock of OperationsService interface +// MockOperationsService is a mock of OperationsService interface. type MockOperationsService struct { ctrl *gomock.Controller recorder *MockOperationsServiceMockRecorder } -// MockOperationsServiceMockRecorder is the mock recorder for MockOperationsService +// MockOperationsServiceMockRecorder is the mock recorder for MockOperationsService. type MockOperationsServiceMockRecorder struct { mock *MockOperationsService } -// NewMockOperationsService creates a new mock instance +// NewMockOperationsService creates a new mock instance. func NewMockOperationsService(ctrl *gomock.Controller) *MockOperationsService { mock := &MockOperationsService{ctrl: ctrl} mock.recorder = &MockOperationsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockOperationsService) EXPECT() *MockOperationsServiceMockRecorder { return m.recorder } -// OperationsShow mocks base method -func (m *MockOperationsService) OperationsShow(arg0, arg1 string) (*scalingo.Operation, error) { +// OperationsShow mocks base method. +func (m *MockOperationsService) OperationsShow(arg0 context.Context, arg1, arg2 string) (*scalingo.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OperationsShow", arg0, arg1) + ret := m.ctrl.Call(m, "OperationsShow", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// OperationsShow indicates an expected call of OperationsShow -func (mr *MockOperationsServiceMockRecorder) OperationsShow(arg0, arg1 interface{}) *gomock.Call { +// OperationsShow indicates an expected call of OperationsShow. +func (mr *MockOperationsServiceMockRecorder) OperationsShow(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OperationsShow", reflect.TypeOf((*MockOperationsService)(nil).OperationsShow), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OperationsShow", reflect.TypeOf((*MockOperationsService)(nil).OperationsShow), arg0, arg1, arg2) } diff --git a/scalingomock/regionmigrationsservice_mock.go b/scalingomock/regionmigrationsservice_mock.go index 8050b885..8f1cf2ff 100644 --- a/scalingomock/regionmigrationsservice_mock.go +++ b/scalingomock/regionmigrationsservice_mock.go @@ -5,90 +5,91 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockRegionMigrationsService is a mock of RegionMigrationsService interface +// MockRegionMigrationsService is a mock of RegionMigrationsService interface. type MockRegionMigrationsService struct { ctrl *gomock.Controller recorder *MockRegionMigrationsServiceMockRecorder } -// MockRegionMigrationsServiceMockRecorder is the mock recorder for MockRegionMigrationsService +// MockRegionMigrationsServiceMockRecorder is the mock recorder for MockRegionMigrationsService. type MockRegionMigrationsServiceMockRecorder struct { mock *MockRegionMigrationsService } -// NewMockRegionMigrationsService creates a new mock instance +// NewMockRegionMigrationsService creates a new mock instance. func NewMockRegionMigrationsService(ctrl *gomock.Controller) *MockRegionMigrationsService { mock := &MockRegionMigrationsService{ctrl: ctrl} mock.recorder = &MockRegionMigrationsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRegionMigrationsService) EXPECT() *MockRegionMigrationsServiceMockRecorder { return m.recorder } -// CreateRegionMigration mocks base method -func (m *MockRegionMigrationsService) CreateRegionMigration(arg0 string, arg1 scalingo.RegionMigrationParams) (scalingo.RegionMigration, error) { +// CreateRegionMigration mocks base method. +func (m *MockRegionMigrationsService) CreateRegionMigration(arg0 context.Context, arg1 string, arg2 scalingo.RegionMigrationParams) (scalingo.RegionMigration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateRegionMigration", arg0, arg1) + ret := m.ctrl.Call(m, "CreateRegionMigration", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.RegionMigration) ret1, _ := ret[1].(error) return ret0, ret1 } -// CreateRegionMigration indicates an expected call of CreateRegionMigration -func (mr *MockRegionMigrationsServiceMockRecorder) CreateRegionMigration(arg0, arg1 interface{}) *gomock.Call { +// CreateRegionMigration indicates an expected call of CreateRegionMigration. +func (mr *MockRegionMigrationsServiceMockRecorder) CreateRegionMigration(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRegionMigration", reflect.TypeOf((*MockRegionMigrationsService)(nil).CreateRegionMigration), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRegionMigration", reflect.TypeOf((*MockRegionMigrationsService)(nil).CreateRegionMigration), arg0, arg1, arg2) } -// ListRegionMigrations mocks base method -func (m *MockRegionMigrationsService) ListRegionMigrations(arg0 string) ([]scalingo.RegionMigration, error) { +// ListRegionMigrations mocks base method. +func (m *MockRegionMigrationsService) ListRegionMigrations(arg0 context.Context, arg1 string) ([]scalingo.RegionMigration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListRegionMigrations", arg0) + ret := m.ctrl.Call(m, "ListRegionMigrations", arg0, arg1) ret0, _ := ret[0].([]scalingo.RegionMigration) ret1, _ := ret[1].(error) return ret0, ret1 } -// ListRegionMigrations indicates an expected call of ListRegionMigrations -func (mr *MockRegionMigrationsServiceMockRecorder) ListRegionMigrations(arg0 interface{}) *gomock.Call { +// ListRegionMigrations indicates an expected call of ListRegionMigrations. +func (mr *MockRegionMigrationsServiceMockRecorder) ListRegionMigrations(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRegionMigrations", reflect.TypeOf((*MockRegionMigrationsService)(nil).ListRegionMigrations), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRegionMigrations", reflect.TypeOf((*MockRegionMigrationsService)(nil).ListRegionMigrations), arg0, arg1) } -// RunRegionMigrationStep mocks base method -func (m *MockRegionMigrationsService) RunRegionMigrationStep(arg0, arg1 string, arg2 scalingo.RegionMigrationStep) error { +// RunRegionMigrationStep mocks base method. +func (m *MockRegionMigrationsService) RunRegionMigrationStep(arg0 context.Context, arg1, arg2 string, arg3 scalingo.RegionMigrationStep) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunRegionMigrationStep", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "RunRegionMigrationStep", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 } -// RunRegionMigrationStep indicates an expected call of RunRegionMigrationStep -func (mr *MockRegionMigrationsServiceMockRecorder) RunRegionMigrationStep(arg0, arg1, arg2 interface{}) *gomock.Call { +// RunRegionMigrationStep indicates an expected call of RunRegionMigrationStep. +func (mr *MockRegionMigrationsServiceMockRecorder) RunRegionMigrationStep(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunRegionMigrationStep", reflect.TypeOf((*MockRegionMigrationsService)(nil).RunRegionMigrationStep), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunRegionMigrationStep", reflect.TypeOf((*MockRegionMigrationsService)(nil).RunRegionMigrationStep), arg0, arg1, arg2, arg3) } -// ShowRegionMigration mocks base method -func (m *MockRegionMigrationsService) ShowRegionMigration(arg0, arg1 string) (scalingo.RegionMigration, error) { +// ShowRegionMigration mocks base method. +func (m *MockRegionMigrationsService) ShowRegionMigration(arg0 context.Context, arg1, arg2 string) (scalingo.RegionMigration, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ShowRegionMigration", arg0, arg1) + ret := m.ctrl.Call(m, "ShowRegionMigration", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.RegionMigration) ret1, _ := ret[1].(error) return ret0, ret1 } -// ShowRegionMigration indicates an expected call of ShowRegionMigration -func (mr *MockRegionMigrationsServiceMockRecorder) ShowRegionMigration(arg0, arg1 interface{}) *gomock.Call { +// ShowRegionMigration indicates an expected call of ShowRegionMigration. +func (mr *MockRegionMigrationsServiceMockRecorder) ShowRegionMigration(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShowRegionMigration", reflect.TypeOf((*MockRegionMigrationsService)(nil).ShowRegionMigration), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShowRegionMigration", reflect.TypeOf((*MockRegionMigrationsService)(nil).ShowRegionMigration), arg0, arg1, arg2) } diff --git a/scalingomock/regionsservice_mock.go b/scalingomock/regionsservice_mock.go index d993778e..2c79d23f 100644 --- a/scalingomock/regionsservice_mock.go +++ b/scalingomock/regionsservice_mock.go @@ -5,46 +5,47 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockRegionsService is a mock of RegionsService interface +// MockRegionsService is a mock of RegionsService interface. type MockRegionsService struct { ctrl *gomock.Controller recorder *MockRegionsServiceMockRecorder } -// MockRegionsServiceMockRecorder is the mock recorder for MockRegionsService +// MockRegionsServiceMockRecorder is the mock recorder for MockRegionsService. type MockRegionsServiceMockRecorder struct { mock *MockRegionsService } -// NewMockRegionsService creates a new mock instance +// NewMockRegionsService creates a new mock instance. func NewMockRegionsService(ctrl *gomock.Controller) *MockRegionsService { mock := &MockRegionsService{ctrl: ctrl} mock.recorder = &MockRegionsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRegionsService) EXPECT() *MockRegionsServiceMockRecorder { return m.recorder } -// RegionsList mocks base method -func (m *MockRegionsService) RegionsList() ([]scalingo.Region, error) { +// RegionsList mocks base method. +func (m *MockRegionsService) RegionsList(arg0 context.Context) ([]scalingo.Region, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RegionsList") + ret := m.ctrl.Call(m, "RegionsList", arg0) ret0, _ := ret[0].([]scalingo.Region) ret1, _ := ret[1].(error) return ret0, ret1 } -// RegionsList indicates an expected call of RegionsList -func (mr *MockRegionsServiceMockRecorder) RegionsList() *gomock.Call { +// RegionsList indicates an expected call of RegionsList. +func (mr *MockRegionsServiceMockRecorder) RegionsList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegionsList", reflect.TypeOf((*MockRegionsService)(nil).RegionsList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegionsList", reflect.TypeOf((*MockRegionsService)(nil).RegionsList), arg0) } diff --git a/scalingomock/runsservice_mock.go b/scalingomock/runsservice_mock.go index 1d2a579f..aa6a4306 100644 --- a/scalingomock/runsservice_mock.go +++ b/scalingomock/runsservice_mock.go @@ -5,46 +5,47 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockRunsService is a mock of RunsService interface +// MockRunsService is a mock of RunsService interface. type MockRunsService struct { ctrl *gomock.Controller recorder *MockRunsServiceMockRecorder } -// MockRunsServiceMockRecorder is the mock recorder for MockRunsService +// MockRunsServiceMockRecorder is the mock recorder for MockRunsService. type MockRunsServiceMockRecorder struct { mock *MockRunsService } -// NewMockRunsService creates a new mock instance +// NewMockRunsService creates a new mock instance. func NewMockRunsService(ctrl *gomock.Controller) *MockRunsService { mock := &MockRunsService{ctrl: ctrl} mock.recorder = &MockRunsServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRunsService) EXPECT() *MockRunsServiceMockRecorder { return m.recorder } -// Run mocks base method -func (m *MockRunsService) Run(arg0 scalingo.RunOpts) (*scalingo.RunRes, error) { +// Run mocks base method. +func (m *MockRunsService) Run(arg0 context.Context, arg1 scalingo.RunOpts) (*scalingo.RunRes, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Run", arg0) + ret := m.ctrl.Call(m, "Run", arg0, arg1) ret0, _ := ret[0].(*scalingo.RunRes) ret1, _ := ret[1].(error) return ret0, ret1 } -// Run indicates an expected call of Run -func (mr *MockRunsServiceMockRecorder) Run(arg0 interface{}) *gomock.Call { +// Run indicates an expected call of Run. +func (mr *MockRunsServiceMockRecorder) Run(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockRunsService)(nil).Run), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockRunsService)(nil).Run), arg0, arg1) } diff --git a/scalingomock/scmrepolinkservice_mock.go b/scalingomock/scmrepolinkservice_mock.go index 81fc719b..cbb560ac 100644 --- a/scalingomock/scmrepolinkservice_mock.go +++ b/scalingomock/scmrepolinkservice_mock.go @@ -5,6 +5,7 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" @@ -35,53 +36,53 @@ func (m *MockSCMRepoLinkService) EXPECT() *MockSCMRepoLinkServiceMockRecorder { } // SCMRepoLinkCreate mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkCreate(arg0 string, arg1 scalingo.SCMRepoLinkCreateParams) (*scalingo.SCMRepoLink, error) { +func (m *MockSCMRepoLinkService) SCMRepoLinkCreate(arg0 context.Context, arg1 string, arg2 scalingo.SCMRepoLinkCreateParams) (*scalingo.SCMRepoLink, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkCreate", arg0, arg1) + ret := m.ctrl.Call(m, "SCMRepoLinkCreate", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.SCMRepoLink) ret1, _ := ret[1].(error) return ret0, ret1 } // SCMRepoLinkCreate indicates an expected call of SCMRepoLinkCreate. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkCreate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkCreate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkCreate", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkCreate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkCreate", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkCreate), arg0, arg1, arg2) } // SCMRepoLinkDelete mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkDelete(arg0 string) error { +func (m *MockSCMRepoLinkService) SCMRepoLinkDelete(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkDelete", arg0) + ret := m.ctrl.Call(m, "SCMRepoLinkDelete", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } // SCMRepoLinkDelete indicates an expected call of SCMRepoLinkDelete. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkDelete(arg0 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkDelete(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkDelete", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkDelete), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkDelete", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkDelete), arg0, arg1) } // SCMRepoLinkDeployments mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkDeployments(arg0 string) ([]*scalingo.Deployment, error) { +func (m *MockSCMRepoLinkService) SCMRepoLinkDeployments(arg0 context.Context, arg1 string) ([]*scalingo.Deployment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkDeployments", arg0) + ret := m.ctrl.Call(m, "SCMRepoLinkDeployments", arg0, arg1) ret0, _ := ret[0].([]*scalingo.Deployment) ret1, _ := ret[1].(error) return ret0, ret1 } // SCMRepoLinkDeployments indicates an expected call of SCMRepoLinkDeployments. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkDeployments(arg0 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkDeployments(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkDeployments", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkDeployments), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkDeployments", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkDeployments), arg0, arg1) } // SCMRepoLinkList mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkList(arg0 scalingo.PaginationOpts) ([]*scalingo.SCMRepoLink, scalingo.PaginationMeta, error) { +func (m *MockSCMRepoLinkService) SCMRepoLinkList(arg0 context.Context, arg1 scalingo.PaginationOpts) ([]*scalingo.SCMRepoLink, scalingo.PaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkList", arg0) + ret := m.ctrl.Call(m, "SCMRepoLinkList", arg0, arg1) ret0, _ := ret[0].([]*scalingo.SCMRepoLink) ret1, _ := ret[1].(scalingo.PaginationMeta) ret2, _ := ret[2].(error) @@ -89,80 +90,80 @@ func (m *MockSCMRepoLinkService) SCMRepoLinkList(arg0 scalingo.PaginationOpts) ( } // SCMRepoLinkList indicates an expected call of SCMRepoLinkList. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkList(arg0 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkList", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkList", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkList), arg0, arg1) } // SCMRepoLinkManualDeploy mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkManualDeploy(arg0, arg1 string) error { +func (m *MockSCMRepoLinkService) SCMRepoLinkManualDeploy(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkManualDeploy", arg0, arg1) + ret := m.ctrl.Call(m, "SCMRepoLinkManualDeploy", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // SCMRepoLinkManualDeploy indicates an expected call of SCMRepoLinkManualDeploy. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkManualDeploy(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkManualDeploy(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkManualDeploy", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkManualDeploy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkManualDeploy", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkManualDeploy), arg0, arg1, arg2) } // SCMRepoLinkManualReviewApp mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkManualReviewApp(arg0, arg1 string) error { +func (m *MockSCMRepoLinkService) SCMRepoLinkManualReviewApp(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkManualReviewApp", arg0, arg1) + ret := m.ctrl.Call(m, "SCMRepoLinkManualReviewApp", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } // SCMRepoLinkManualReviewApp indicates an expected call of SCMRepoLinkManualReviewApp. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkManualReviewApp(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkManualReviewApp(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkManualReviewApp", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkManualReviewApp), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkManualReviewApp", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkManualReviewApp), arg0, arg1, arg2) } // SCMRepoLinkReviewApps mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkReviewApps(arg0 string) ([]*scalingo.ReviewApp, error) { +func (m *MockSCMRepoLinkService) SCMRepoLinkReviewApps(arg0 context.Context, arg1 string) ([]*scalingo.ReviewApp, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkReviewApps", arg0) + ret := m.ctrl.Call(m, "SCMRepoLinkReviewApps", arg0, arg1) ret0, _ := ret[0].([]*scalingo.ReviewApp) ret1, _ := ret[1].(error) return ret0, ret1 } // SCMRepoLinkReviewApps indicates an expected call of SCMRepoLinkReviewApps. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkReviewApps(arg0 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkReviewApps(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkReviewApps", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkReviewApps), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkReviewApps", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkReviewApps), arg0, arg1) } // SCMRepoLinkShow mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkShow(arg0 string) (*scalingo.SCMRepoLink, error) { +func (m *MockSCMRepoLinkService) SCMRepoLinkShow(arg0 context.Context, arg1 string) (*scalingo.SCMRepoLink, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkShow", arg0) + ret := m.ctrl.Call(m, "SCMRepoLinkShow", arg0, arg1) ret0, _ := ret[0].(*scalingo.SCMRepoLink) ret1, _ := ret[1].(error) return ret0, ret1 } // SCMRepoLinkShow indicates an expected call of SCMRepoLinkShow. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkShow(arg0 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkShow(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkShow", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkShow), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkShow", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkShow), arg0, arg1) } // SCMRepoLinkUpdate mocks base method. -func (m *MockSCMRepoLinkService) SCMRepoLinkUpdate(arg0 string, arg1 scalingo.SCMRepoLinkUpdateParams) (*scalingo.SCMRepoLink, error) { +func (m *MockSCMRepoLinkService) SCMRepoLinkUpdate(arg0 context.Context, arg1 string, arg2 scalingo.SCMRepoLinkUpdateParams) (*scalingo.SCMRepoLink, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SCMRepoLinkUpdate", arg0, arg1) + ret := m.ctrl.Call(m, "SCMRepoLinkUpdate", arg0, arg1, arg2) ret0, _ := ret[0].(*scalingo.SCMRepoLink) ret1, _ := ret[1].(error) return ret0, ret1 } // SCMRepoLinkUpdate indicates an expected call of SCMRepoLinkUpdate. -func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkUpdate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockSCMRepoLinkServiceMockRecorder) SCMRepoLinkUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkUpdate", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkUpdate), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SCMRepoLinkUpdate", reflect.TypeOf((*MockSCMRepoLinkService)(nil).SCMRepoLinkUpdate), arg0, arg1, arg2) } diff --git a/scalingomock/signupservice_mock.go b/scalingomock/signupservice_mock.go index 6398ff38..31567ac3 100644 --- a/scalingomock/signupservice_mock.go +++ b/scalingomock/signupservice_mock.go @@ -5,44 +5,45 @@ package scalingomock import ( + context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" ) -// MockSignUpService is a mock of SignUpService interface +// MockSignUpService is a mock of SignUpService interface. type MockSignUpService struct { ctrl *gomock.Controller recorder *MockSignUpServiceMockRecorder } -// MockSignUpServiceMockRecorder is the mock recorder for MockSignUpService +// MockSignUpServiceMockRecorder is the mock recorder for MockSignUpService. type MockSignUpServiceMockRecorder struct { mock *MockSignUpService } -// NewMockSignUpService creates a new mock instance +// NewMockSignUpService creates a new mock instance. func NewMockSignUpService(ctrl *gomock.Controller) *MockSignUpService { mock := &MockSignUpService{ctrl: ctrl} mock.recorder = &MockSignUpServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSignUpService) EXPECT() *MockSignUpServiceMockRecorder { return m.recorder } -// SignUp mocks base method -func (m *MockSignUpService) SignUp(arg0, arg1 string) error { +// SignUp mocks base method. +func (m *MockSignUpService) SignUp(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SignUp", arg0, arg1) + ret := m.ctrl.Call(m, "SignUp", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// SignUp indicates an expected call of SignUp -func (mr *MockSignUpServiceMockRecorder) SignUp(arg0, arg1 interface{}) *gomock.Call { +// SignUp indicates an expected call of SignUp. +func (mr *MockSignUpServiceMockRecorder) SignUp(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignUp", reflect.TypeOf((*MockSignUpService)(nil).SignUp), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SignUp", reflect.TypeOf((*MockSignUpService)(nil).SignUp), arg0, arg1, arg2) } diff --git a/scalingomock/sourcesservice_mock.go b/scalingomock/sourcesservice_mock.go index fcb6ea11..53734a83 100644 --- a/scalingomock/sourcesservice_mock.go +++ b/scalingomock/sourcesservice_mock.go @@ -5,46 +5,47 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockSourcesService is a mock of SourcesService interface +// MockSourcesService is a mock of SourcesService interface. type MockSourcesService struct { ctrl *gomock.Controller recorder *MockSourcesServiceMockRecorder } -// MockSourcesServiceMockRecorder is the mock recorder for MockSourcesService +// MockSourcesServiceMockRecorder is the mock recorder for MockSourcesService. type MockSourcesServiceMockRecorder struct { mock *MockSourcesService } -// NewMockSourcesService creates a new mock instance +// NewMockSourcesService creates a new mock instance. func NewMockSourcesService(ctrl *gomock.Controller) *MockSourcesService { mock := &MockSourcesService{ctrl: ctrl} mock.recorder = &MockSourcesServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSourcesService) EXPECT() *MockSourcesServiceMockRecorder { return m.recorder } -// SourcesCreate mocks base method -func (m *MockSourcesService) SourcesCreate() (*scalingo.Source, error) { +// SourcesCreate mocks base method. +func (m *MockSourcesService) SourcesCreate(arg0 context.Context) (*scalingo.Source, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SourcesCreate") + ret := m.ctrl.Call(m, "SourcesCreate", arg0) ret0, _ := ret[0].(*scalingo.Source) ret1, _ := ret[1].(error) return ret0, ret1 } -// SourcesCreate indicates an expected call of SourcesCreate -func (mr *MockSourcesServiceMockRecorder) SourcesCreate() *gomock.Call { +// SourcesCreate indicates an expected call of SourcesCreate. +func (mr *MockSourcesServiceMockRecorder) SourcesCreate(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SourcesCreate", reflect.TypeOf((*MockSourcesService)(nil).SourcesCreate)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SourcesCreate", reflect.TypeOf((*MockSourcesService)(nil).SourcesCreate), arg0) } diff --git a/scalingomock/tokensservice_mock.go b/scalingomock/tokensservice_mock.go index db3aa55a..37cf7df7 100644 --- a/scalingomock/tokensservice_mock.go +++ b/scalingomock/tokensservice_mock.go @@ -5,91 +5,92 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockTokensService is a mock of TokensService interface +// MockTokensService is a mock of TokensService interface. type MockTokensService struct { ctrl *gomock.Controller recorder *MockTokensServiceMockRecorder } -// MockTokensServiceMockRecorder is the mock recorder for MockTokensService +// MockTokensServiceMockRecorder is the mock recorder for MockTokensService. type MockTokensServiceMockRecorder struct { mock *MockTokensService } -// NewMockTokensService creates a new mock instance +// NewMockTokensService creates a new mock instance. func NewMockTokensService(ctrl *gomock.Controller) *MockTokensService { mock := &MockTokensService{ctrl: ctrl} mock.recorder = &MockTokensServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockTokensService) EXPECT() *MockTokensServiceMockRecorder { return m.recorder } -// TokenCreate mocks base method -func (m *MockTokensService) TokenCreate(arg0 scalingo.TokenCreateParams) (scalingo.Token, error) { +// TokenCreate mocks base method. +func (m *MockTokensService) TokenCreate(arg0 context.Context, arg1 scalingo.TokenCreateParams) (scalingo.Token, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokenCreate", arg0) + ret := m.ctrl.Call(m, "TokenCreate", arg0, arg1) ret0, _ := ret[0].(scalingo.Token) ret1, _ := ret[1].(error) return ret0, ret1 } -// TokenCreate indicates an expected call of TokenCreate -func (mr *MockTokensServiceMockRecorder) TokenCreate(arg0 interface{}) *gomock.Call { +// TokenCreate indicates an expected call of TokenCreate. +func (mr *MockTokensServiceMockRecorder) TokenCreate(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenCreate", reflect.TypeOf((*MockTokensService)(nil).TokenCreate), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenCreate", reflect.TypeOf((*MockTokensService)(nil).TokenCreate), arg0, arg1) } -// TokenExchange mocks base method -func (m *MockTokensService) TokenExchange(arg0 string) (string, error) { +// TokenExchange mocks base method. +func (m *MockTokensService) TokenExchange(arg0 context.Context, arg1 string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokenExchange", arg0) + ret := m.ctrl.Call(m, "TokenExchange", arg0, arg1) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } -// TokenExchange indicates an expected call of TokenExchange -func (mr *MockTokensServiceMockRecorder) TokenExchange(arg0 interface{}) *gomock.Call { +// TokenExchange indicates an expected call of TokenExchange. +func (mr *MockTokensServiceMockRecorder) TokenExchange(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenExchange", reflect.TypeOf((*MockTokensService)(nil).TokenExchange), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenExchange", reflect.TypeOf((*MockTokensService)(nil).TokenExchange), arg0, arg1) } -// TokenShow mocks base method -func (m *MockTokensService) TokenShow(arg0 int) (scalingo.Token, error) { +// TokenShow mocks base method. +func (m *MockTokensService) TokenShow(arg0 context.Context, arg1 int) (scalingo.Token, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokenShow", arg0) + ret := m.ctrl.Call(m, "TokenShow", arg0, arg1) ret0, _ := ret[0].(scalingo.Token) ret1, _ := ret[1].(error) return ret0, ret1 } -// TokenShow indicates an expected call of TokenShow -func (mr *MockTokensServiceMockRecorder) TokenShow(arg0 interface{}) *gomock.Call { +// TokenShow indicates an expected call of TokenShow. +func (mr *MockTokensServiceMockRecorder) TokenShow(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenShow", reflect.TypeOf((*MockTokensService)(nil).TokenShow), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokenShow", reflect.TypeOf((*MockTokensService)(nil).TokenShow), arg0, arg1) } -// TokensList mocks base method -func (m *MockTokensService) TokensList() (scalingo.Tokens, error) { +// TokensList mocks base method. +func (m *MockTokensService) TokensList(arg0 context.Context) (scalingo.Tokens, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TokensList") + ret := m.ctrl.Call(m, "TokensList", arg0) ret0, _ := ret[0].(scalingo.Tokens) ret1, _ := ret[1].(error) return ret0, ret1 } -// TokensList indicates an expected call of TokensList -func (mr *MockTokensServiceMockRecorder) TokensList() *gomock.Call { +// TokensList indicates an expected call of TokensList. +func (mr *MockTokensServiceMockRecorder) TokensList(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokensList", reflect.TypeOf((*MockTokensService)(nil).TokensList)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TokensList", reflect.TypeOf((*MockTokensService)(nil).TokensList), arg0) } diff --git a/scalingomock/usersservice_mock.go b/scalingomock/usersservice_mock.go index ba859fc0..d8eb130f 100644 --- a/scalingomock/usersservice_mock.go +++ b/scalingomock/usersservice_mock.go @@ -5,75 +5,76 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockUsersService is a mock of UsersService interface +// MockUsersService is a mock of UsersService interface. type MockUsersService struct { ctrl *gomock.Controller recorder *MockUsersServiceMockRecorder } -// MockUsersServiceMockRecorder is the mock recorder for MockUsersService +// MockUsersServiceMockRecorder is the mock recorder for MockUsersService. type MockUsersServiceMockRecorder struct { mock *MockUsersService } -// NewMockUsersService creates a new mock instance +// NewMockUsersService creates a new mock instance. func NewMockUsersService(ctrl *gomock.Controller) *MockUsersService { mock := &MockUsersService{ctrl: ctrl} mock.recorder = &MockUsersServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockUsersService) EXPECT() *MockUsersServiceMockRecorder { return m.recorder } -// Self mocks base method -func (m *MockUsersService) Self() (*scalingo.User, error) { +// Self mocks base method. +func (m *MockUsersService) Self(arg0 context.Context) (*scalingo.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Self") + ret := m.ctrl.Call(m, "Self", arg0) ret0, _ := ret[0].(*scalingo.User) ret1, _ := ret[1].(error) return ret0, ret1 } -// Self indicates an expected call of Self -func (mr *MockUsersServiceMockRecorder) Self() *gomock.Call { +// Self indicates an expected call of Self. +func (mr *MockUsersServiceMockRecorder) Self(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Self", reflect.TypeOf((*MockUsersService)(nil).Self)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Self", reflect.TypeOf((*MockUsersService)(nil).Self), arg0) } -// UpdateUser mocks base method -func (m *MockUsersService) UpdateUser(arg0 scalingo.UpdateUserParams) (*scalingo.User, error) { +// UpdateUser mocks base method. +func (m *MockUsersService) UpdateUser(arg0 context.Context, arg1 scalingo.UpdateUserParams) (*scalingo.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateUser", arg0) + ret := m.ctrl.Call(m, "UpdateUser", arg0, arg1) ret0, _ := ret[0].(*scalingo.User) ret1, _ := ret[1].(error) return ret0, ret1 } -// UpdateUser indicates an expected call of UpdateUser -func (mr *MockUsersServiceMockRecorder) UpdateUser(arg0 interface{}) *gomock.Call { +// UpdateUser indicates an expected call of UpdateUser. +func (mr *MockUsersServiceMockRecorder) UpdateUser(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUser", reflect.TypeOf((*MockUsersService)(nil).UpdateUser), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUser", reflect.TypeOf((*MockUsersService)(nil).UpdateUser), arg0, arg1) } -// UserStopFreeTrial mocks base method -func (m *MockUsersService) UserStopFreeTrial() error { +// UserStopFreeTrial mocks base method. +func (m *MockUsersService) UserStopFreeTrial(arg0 context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UserStopFreeTrial") + ret := m.ctrl.Call(m, "UserStopFreeTrial", arg0) ret0, _ := ret[0].(error) return ret0 } -// UserStopFreeTrial indicates an expected call of UserStopFreeTrial -func (mr *MockUsersServiceMockRecorder) UserStopFreeTrial() *gomock.Call { +// UserStopFreeTrial indicates an expected call of UserStopFreeTrial. +func (mr *MockUsersServiceMockRecorder) UserStopFreeTrial(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserStopFreeTrial", reflect.TypeOf((*MockUsersService)(nil).UserStopFreeTrial)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UserStopFreeTrial", reflect.TypeOf((*MockUsersService)(nil).UserStopFreeTrial), arg0) } diff --git a/scalingomock/variablesservice_mock.go b/scalingomock/variablesservice_mock.go index 0328cdf2..e88a94ec 100644 --- a/scalingomock/variablesservice_mock.go +++ b/scalingomock/variablesservice_mock.go @@ -5,107 +5,108 @@ package scalingomock import ( + context "context" reflect "reflect" scalingo "github.com/Scalingo/go-scalingo/v4" gomock "github.com/golang/mock/gomock" ) -// MockVariablesService is a mock of VariablesService interface +// MockVariablesService is a mock of VariablesService interface. type MockVariablesService struct { ctrl *gomock.Controller recorder *MockVariablesServiceMockRecorder } -// MockVariablesServiceMockRecorder is the mock recorder for MockVariablesService +// MockVariablesServiceMockRecorder is the mock recorder for MockVariablesService. type MockVariablesServiceMockRecorder struct { mock *MockVariablesService } -// NewMockVariablesService creates a new mock instance +// NewMockVariablesService creates a new mock instance. func NewMockVariablesService(ctrl *gomock.Controller) *MockVariablesService { mock := &MockVariablesService{ctrl: ctrl} mock.recorder = &MockVariablesServiceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockVariablesService) EXPECT() *MockVariablesServiceMockRecorder { return m.recorder } -// VariableMultipleSet mocks base method -func (m *MockVariablesService) VariableMultipleSet(arg0 string, arg1 scalingo.Variables) (scalingo.Variables, int, error) { +// VariableMultipleSet mocks base method. +func (m *MockVariablesService) VariableMultipleSet(arg0 context.Context, arg1 string, arg2 scalingo.Variables) (scalingo.Variables, int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariableMultipleSet", arg0, arg1) + ret := m.ctrl.Call(m, "VariableMultipleSet", arg0, arg1, arg2) ret0, _ := ret[0].(scalingo.Variables) ret1, _ := ret[1].(int) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// VariableMultipleSet indicates an expected call of VariableMultipleSet -func (mr *MockVariablesServiceMockRecorder) VariableMultipleSet(arg0, arg1 interface{}) *gomock.Call { +// VariableMultipleSet indicates an expected call of VariableMultipleSet. +func (mr *MockVariablesServiceMockRecorder) VariableMultipleSet(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableMultipleSet", reflect.TypeOf((*MockVariablesService)(nil).VariableMultipleSet), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableMultipleSet", reflect.TypeOf((*MockVariablesService)(nil).VariableMultipleSet), arg0, arg1, arg2) } -// VariableSet mocks base method -func (m *MockVariablesService) VariableSet(arg0, arg1, arg2 string) (*scalingo.Variable, int, error) { +// VariableSet mocks base method. +func (m *MockVariablesService) VariableSet(arg0 context.Context, arg1, arg2, arg3 string) (*scalingo.Variable, int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariableSet", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "VariableSet", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*scalingo.Variable) ret1, _ := ret[1].(int) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// VariableSet indicates an expected call of VariableSet -func (mr *MockVariablesServiceMockRecorder) VariableSet(arg0, arg1, arg2 interface{}) *gomock.Call { +// VariableSet indicates an expected call of VariableSet. +func (mr *MockVariablesServiceMockRecorder) VariableSet(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableSet", reflect.TypeOf((*MockVariablesService)(nil).VariableSet), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableSet", reflect.TypeOf((*MockVariablesService)(nil).VariableSet), arg0, arg1, arg2, arg3) } -// VariableUnset mocks base method -func (m *MockVariablesService) VariableUnset(arg0, arg1 string) error { +// VariableUnset mocks base method. +func (m *MockVariablesService) VariableUnset(arg0 context.Context, arg1, arg2 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariableUnset", arg0, arg1) + ret := m.ctrl.Call(m, "VariableUnset", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// VariableUnset indicates an expected call of VariableUnset -func (mr *MockVariablesServiceMockRecorder) VariableUnset(arg0, arg1 interface{}) *gomock.Call { +// VariableUnset indicates an expected call of VariableUnset. +func (mr *MockVariablesServiceMockRecorder) VariableUnset(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableUnset", reflect.TypeOf((*MockVariablesService)(nil).VariableUnset), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariableUnset", reflect.TypeOf((*MockVariablesService)(nil).VariableUnset), arg0, arg1, arg2) } -// VariablesList mocks base method -func (m *MockVariablesService) VariablesList(arg0 string) (scalingo.Variables, error) { +// VariablesList mocks base method. +func (m *MockVariablesService) VariablesList(arg0 context.Context, arg1 string) (scalingo.Variables, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariablesList", arg0) + ret := m.ctrl.Call(m, "VariablesList", arg0, arg1) ret0, _ := ret[0].(scalingo.Variables) ret1, _ := ret[1].(error) return ret0, ret1 } -// VariablesList indicates an expected call of VariablesList -func (mr *MockVariablesServiceMockRecorder) VariablesList(arg0 interface{}) *gomock.Call { +// VariablesList indicates an expected call of VariablesList. +func (mr *MockVariablesServiceMockRecorder) VariablesList(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesList", reflect.TypeOf((*MockVariablesService)(nil).VariablesList), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesList", reflect.TypeOf((*MockVariablesService)(nil).VariablesList), arg0, arg1) } -// VariablesListWithoutAlias mocks base method -func (m *MockVariablesService) VariablesListWithoutAlias(arg0 string) (scalingo.Variables, error) { +// VariablesListWithoutAlias mocks base method. +func (m *MockVariablesService) VariablesListWithoutAlias(arg0 context.Context, arg1 string) (scalingo.Variables, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "VariablesListWithoutAlias", arg0) + ret := m.ctrl.Call(m, "VariablesListWithoutAlias", arg0, arg1) ret0, _ := ret[0].(scalingo.Variables) ret1, _ := ret[1].(error) return ret0, ret1 } -// VariablesListWithoutAlias indicates an expected call of VariablesListWithoutAlias -func (mr *MockVariablesServiceMockRecorder) VariablesListWithoutAlias(arg0 interface{}) *gomock.Call { +// VariablesListWithoutAlias indicates an expected call of VariablesListWithoutAlias. +func (mr *MockVariablesServiceMockRecorder) VariablesListWithoutAlias(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesListWithoutAlias", reflect.TypeOf((*MockVariablesService)(nil).VariablesListWithoutAlias), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VariablesListWithoutAlias", reflect.TypeOf((*MockVariablesService)(nil).VariablesListWithoutAlias), arg0, arg1) } diff --git a/scm_integrations.go b/scm_integrations.go index 8b22e69f..c216f45b 100644 --- a/scm_integrations.go +++ b/scm_integrations.go @@ -1,6 +1,8 @@ package scalingo import ( + "context" + "gopkg.in/errgo.v1" "github.com/Scalingo/go-scalingo/v4/http" @@ -28,11 +30,11 @@ func (t SCMType) Str() string { } type SCMIntegrationsService interface { - SCMIntegrationsList() ([]SCMIntegration, error) - SCMIntegrationsShow(id string) (*SCMIntegration, error) - SCMIntegrationsCreate(scmType SCMType, url string, accessToken string) (*SCMIntegration, error) - SCMIntegrationsDelete(id string) error - SCMIntegrationsImportKeys(id string) ([]Key, error) + SCMIntegrationsList(context.Context) ([]SCMIntegration, error) + SCMIntegrationsShow(ctx context.Context, id string) (*SCMIntegration, error) + SCMIntegrationsCreate(ctx context.Context, scmType SCMType, url string, accessToken string) (*SCMIntegration, error) + SCMIntegrationsDelete(ctx context.Context, id string) error + SCMIntegrationsImportKeys(ctx context.Context, id string) ([]Key, error) } var _ SCMIntegrationsService = (*Client)(nil) @@ -67,27 +69,27 @@ type SCMIntegrationParamsReq struct { SCMIntegrationParams SCMIntegrationParams `json:"scm_integration"` } -func (c *Client) SCMIntegrationsList() ([]SCMIntegration, error) { +func (c *Client) SCMIntegrationsList(ctx context.Context) ([]SCMIntegration, error) { var res SCMIntegrationsRes - err := c.AuthAPI().ResourceList("scm_integrations", nil, &res) + err := c.AuthAPI().ResourceList(ctx, "scm_integrations", nil, &res) if err != nil { return nil, errgo.Notef(err, "fail to list SCM integration") } return res.SCMIntegrations, nil } -func (c *Client) SCMIntegrationsShow(id string) (*SCMIntegration, error) { +func (c *Client) SCMIntegrationsShow(ctx context.Context, id string) (*SCMIntegration, error) { var res SCMIntegrationRes - err := c.AuthAPI().ResourceGet("scm_integrations", id, nil, &res) + err := c.AuthAPI().ResourceGet(ctx, "scm_integrations", id, nil, &res) if err != nil { return nil, errgo.Notef(err, "fail to get this SCM integration") } return &res.SCMIntegration, nil } -func (c *Client) SCMIntegrationsCreate(scmType SCMType, url string, accessToken string) (*SCMIntegration, error) { +func (c *Client) SCMIntegrationsCreate(ctx context.Context, scmType SCMType, url string, accessToken string) (*SCMIntegration, error) { payload := SCMIntegrationParamsReq{SCMIntegrationParams{ SCMType: scmType, URL: url, @@ -95,7 +97,7 @@ func (c *Client) SCMIntegrationsCreate(scmType SCMType, url string, accessToken }} var res SCMIntegrationRes - err := c.AuthAPI().ResourceAdd("scm_integrations", payload, &res) + err := c.AuthAPI().ResourceAdd(ctx, "scm_integrations", payload, &res) if err != nil { return nil, errgo.Notef(err, "fail to create the SCM integration") } @@ -103,18 +105,18 @@ func (c *Client) SCMIntegrationsCreate(scmType SCMType, url string, accessToken return &res.SCMIntegration, nil } -func (c *Client) SCMIntegrationsDelete(id string) error { - err := c.AuthAPI().ResourceDelete("scm_integrations", id) +func (c *Client) SCMIntegrationsDelete(ctx context.Context, id string) error { + err := c.AuthAPI().ResourceDelete(ctx, "scm_integrations", id) if err != nil { return errgo.Notef(err, "fail to delete this SCM integration") } return nil } -func (c *Client) SCMIntegrationsImportKeys(id string) ([]Key, error) { +func (c *Client) SCMIntegrationsImportKeys(ctx context.Context, id string) ([]Key, error) { var res KeysRes - var err = c.AuthAPI().DoRequest(&http.APIRequest{ + var err = c.AuthAPI().DoRequest(ctx, &http.APIRequest{ Method: "POST", Endpoint: "/scm_integrations/" + id + "/import_keys", Params: nil, diff --git a/scm_repo_link.go b/scm_repo_link.go index 1ca52034..fb7811e1 100644 --- a/scm_repo_link.go +++ b/scm_repo_link.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "time" "gopkg.in/errgo.v1" @@ -9,16 +10,16 @@ import ( ) type SCMRepoLinkService interface { - SCMRepoLinkList(opts PaginationOpts) ([]*SCMRepoLink, PaginationMeta, error) - SCMRepoLinkShow(app string) (*SCMRepoLink, error) - SCMRepoLinkCreate(app string, params SCMRepoLinkCreateParams) (*SCMRepoLink, error) - SCMRepoLinkUpdate(app string, params SCMRepoLinkUpdateParams) (*SCMRepoLink, error) - SCMRepoLinkDelete(app string) error + SCMRepoLinkList(ctx context.Context, opts PaginationOpts) ([]*SCMRepoLink, PaginationMeta, error) + SCMRepoLinkShow(ctx context.Context, app string) (*SCMRepoLink, error) + SCMRepoLinkCreate(ctx context.Context, app string, params SCMRepoLinkCreateParams) (*SCMRepoLink, error) + SCMRepoLinkUpdate(ctx context.Context, app string, params SCMRepoLinkUpdateParams) (*SCMRepoLink, error) + SCMRepoLinkDelete(ctx context.Context, app string) error - SCMRepoLinkManualDeploy(app, branch string) error - SCMRepoLinkManualReviewApp(app, pullRequestId string) error - SCMRepoLinkDeployments(app string) ([]*Deployment, error) - SCMRepoLinkReviewApps(app string) ([]*ReviewApp, error) + SCMRepoLinkManualDeploy(ctx context.Context, app, branch string) error + SCMRepoLinkManualReviewApp(ctx context.Context, app, pullRequestID string) error + SCMRepoLinkDeployments(ctx context.Context, app string) ([]*Deployment, error) + SCMRepoLinkReviewApps(ctx context.Context, app string) ([]*ReviewApp, error) } type SCMRepoLinkCreateParams struct { @@ -90,18 +91,18 @@ type SCMRepoLinkReviewAppsResponse struct { var _ SCMRepoLinkService = (*Client)(nil) -func (c *Client) SCMRepoLinkList(opts PaginationOpts) ([]*SCMRepoLink, PaginationMeta, error) { +func (c *Client) SCMRepoLinkList(ctx context.Context, opts PaginationOpts) ([]*SCMRepoLink, PaginationMeta, error) { var res SCMRepoLinksResponse - err := c.ScalingoAPI().ResourceList("scm_repo_links", opts.ToMap(), &res) + err := c.ScalingoAPI().ResourceList(ctx, "scm_repo_links", opts.ToMap(), &res) if err != nil { return nil, PaginationMeta{}, errgo.Notef(err, "fail to list SCM repo links") } return res.SCMRepoLinks, res.Meta.PaginationMeta, nil } -func (c *Client) SCMRepoLinkShow(app string) (*SCMRepoLink, error) { +func (c *Client) SCMRepoLinkShow(ctx context.Context, app string) (*SCMRepoLink, error) { var res ScmRepoLinkResponse - err := c.ScalingoAPI().DoRequest(&http.APIRequest{ + err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ Method: "GET", Endpoint: "/apps/" + app + "/scm_repo_link", Expected: http.Statuses{200}, @@ -112,9 +113,9 @@ func (c *Client) SCMRepoLinkShow(app string) (*SCMRepoLink, error) { return res.SCMRepoLink, nil } -func (c *Client) SCMRepoLinkCreate(app string, params SCMRepoLinkCreateParams) (*SCMRepoLink, error) { +func (c *Client) SCMRepoLinkCreate(ctx context.Context, app string, params SCMRepoLinkCreateParams) (*SCMRepoLink, error) { var res ScmRepoLinkResponse - err := c.ScalingoAPI().DoRequest(&http.APIRequest{ + err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/scm_repo_link", Expected: http.Statuses{201}, @@ -127,9 +128,9 @@ func (c *Client) SCMRepoLinkCreate(app string, params SCMRepoLinkCreateParams) ( return res.SCMRepoLink, nil } -func (c *Client) SCMRepoLinkUpdate(app string, params SCMRepoLinkUpdateParams) (*SCMRepoLink, error) { +func (c *Client) SCMRepoLinkUpdate(ctx context.Context, app string, params SCMRepoLinkUpdateParams) (*SCMRepoLink, error) { var res ScmRepoLinkResponse - err := c.ScalingoAPI().DoRequest(&http.APIRequest{ + err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ Method: "PATCH", Endpoint: "/apps/" + app + "/scm_repo_link", Expected: http.Statuses{200}, @@ -142,8 +143,8 @@ func (c *Client) SCMRepoLinkUpdate(app string, params SCMRepoLinkUpdateParams) ( return res.SCMRepoLink, nil } -func (c *Client) SCMRepoLinkDelete(app string) error { - _, err := c.ScalingoAPI().Do(&http.APIRequest{ +func (c *Client) SCMRepoLinkDelete(ctx context.Context, app string) error { + _, err := c.ScalingoAPI().Do(ctx, &http.APIRequest{ Method: "DELETE", Endpoint: "/apps/" + app + "/scm_repo_link", Expected: http.Statuses{204}, @@ -154,8 +155,8 @@ func (c *Client) SCMRepoLinkDelete(app string) error { return nil } -func (c *Client) SCMRepoLinkManualDeploy(app, branch string) error { - _, err := c.ScalingoAPI().Do(&http.APIRequest{ +func (c *Client) SCMRepoLinkManualDeploy(ctx context.Context, app, branch string) error { + _, err := c.ScalingoAPI().Do(ctx, &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/scm_repo_link/manual_deploy", Expected: http.Statuses{200}, @@ -167,12 +168,12 @@ func (c *Client) SCMRepoLinkManualDeploy(app, branch string) error { return nil } -func (c *Client) SCMRepoLinkManualReviewApp(app, pullRequestId string) error { - _, err := c.ScalingoAPI().Do(&http.APIRequest{ +func (c *Client) SCMRepoLinkManualReviewApp(ctx context.Context, app, pullRequestID string) error { + _, err := c.ScalingoAPI().Do(ctx, &http.APIRequest{ Method: "POST", Endpoint: "/apps/" + app + "/scm_repo_link/manual_review_app", Expected: http.Statuses{200}, - Params: map[string]string{"pull_request_id": pullRequestId}, + Params: map[string]string{"pull_request_id": pullRequestID}, }) if err != nil { return errgo.Notef(err, "fail to trigger manual review app deployment") @@ -180,10 +181,10 @@ func (c *Client) SCMRepoLinkManualReviewApp(app, pullRequestId string) error { return nil } -func (c *Client) SCMRepoLinkDeployments(app string) ([]*Deployment, error) { +func (c *Client) SCMRepoLinkDeployments(ctx context.Context, app string) ([]*Deployment, error) { var res SCMRepoLinkDeploymentsResponse - err := c.ScalingoAPI().DoRequest(&http.APIRequest{ + err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ Method: "GET", Endpoint: "/apps/" + app + "/scm_repo_link/deployments", Expected: http.Statuses{200}, @@ -194,10 +195,10 @@ func (c *Client) SCMRepoLinkDeployments(app string) ([]*Deployment, error) { return res.Deployments, nil } -func (c *Client) SCMRepoLinkReviewApps(app string) ([]*ReviewApp, error) { +func (c *Client) SCMRepoLinkReviewApps(ctx context.Context, app string) ([]*ReviewApp, error) { var res SCMRepoLinkReviewAppsResponse - err := c.ScalingoAPI().DoRequest(&http.APIRequest{ + err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ Method: "GET", Endpoint: "/apps/" + app + "/scm_repo_link/review_apps", Expected: http.Statuses{200}, diff --git a/signup.go b/signup.go index 2cb20f9d..e66929c2 100644 --- a/signup.go +++ b/signup.go @@ -1,18 +1,20 @@ package scalingo import ( + "context" + "gopkg.in/errgo.v1" "github.com/Scalingo/go-scalingo/v4/http" ) type SignUpService interface { - SignUp(email, password string) error + SignUp(ctx context.Context, email, password string) error } var _ SignUpService = (*Client)(nil) -func (c *Client) SignUp(email, password string) error { +func (c *Client) SignUp(ctx context.Context, email, password string) error { req := &http.APIRequest{ NoAuth: true, Method: "POST", @@ -25,7 +27,7 @@ func (c *Client) SignUp(email, password string) error { }, }, } - _, err := c.ScalingoAPI().Do(req) + _, err := c.ScalingoAPI().Do(ctx, req) if err != nil { return errgo.Mask(err) } diff --git a/sources.go b/sources.go index f594ab4e..2891a326 100644 --- a/sources.go +++ b/sources.go @@ -1,9 +1,13 @@ package scalingo -import "gopkg.in/errgo.v1" +import ( + "context" + + "gopkg.in/errgo.v1" +) type SourcesService interface { - SourcesCreate() (*Source, error) + SourcesCreate(context.Context) (*Source, error) } var _ SourcesService = (*Client)(nil) @@ -17,9 +21,9 @@ type Source struct { UploadURL string `json:"upload_url"` } -func (c *Client) SourcesCreate() (*Source, error) { +func (c *Client) SourcesCreate(ctx context.Context) (*Source, error) { var sourceRes SourcesCreateResponse - err := c.ScalingoAPI().ResourceAdd("sources", nil, &sourceRes) + err := c.ScalingoAPI().ResourceAdd(ctx, "sources", nil, &sourceRes) if err != nil { return nil, errgo.Mask(err) } diff --git a/stacks.go b/stacks.go index a7e4f07e..5d36733f 100644 --- a/stacks.go +++ b/stacks.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "time" "gopkg.in/errgo.v1" @@ -18,18 +19,18 @@ type Stack struct { } type StacksService interface { - StacksList() ([]Stack, error) + StacksList(ctx context.Context) ([]Stack, error) } var _ StacksService = (*Client)(nil) -func (c *Client) StacksList() ([]Stack, error) { +func (c *Client) StacksList(ctx context.Context) ([]Stack, error) { req := &httpclient.APIRequest{ Endpoint: "/features/stacks", } resmap := map[string][]Stack{} - err := c.ScalingoAPI().DoRequest(req, &resmap) + err := c.ScalingoAPI().DoRequest(ctx, req, &resmap) if err != nil { return nil, errgo.Notef(err, "fail to request Scalingo API") } diff --git a/static_token.go b/static_token.go index f8c8b1b7..7c14be23 100644 --- a/static_token.go +++ b/static_token.go @@ -1,5 +1,7 @@ package scalingo +import "context" + // StaticTokenGenerator is an implementation of TokenGenerator which always return the same token. // This token is provided to the constructor. The TokenGenerator is used by the Client to // authenticate to the Scalingo API. @@ -25,7 +27,7 @@ func NewStaticTokenGenerator(token string) *StaticTokenGenerator { } // GetAccessToken always returns the configured token. -func (t *StaticTokenGenerator) GetAccessToken() (string, error) { +func (t *StaticTokenGenerator) GetAccessToken(context.Context) (string, error) { return t.token, nil } diff --git a/tokens.go b/tokens.go index 31c1e5d9..2fe61118 100644 --- a/tokens.go +++ b/tokens.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "errors" "strconv" @@ -12,10 +13,10 @@ import ( ) type TokensService interface { - TokensList() (Tokens, error) - TokenCreate(TokenCreateParams) (Token, error) - TokenExchange(token string) (string, error) - TokenShow(id int) (Token, error) + TokensList(context.Context) (Tokens, error) + TokenCreate(context.Context, TokenCreateParams) (Token, error) + TokenExchange(ctx context.Context, token string) (string, error) + TokenShow(ctx context.Context, id int) (Token, error) } var _ TokensService = (*Client)(nil) @@ -67,10 +68,10 @@ type TokenRes struct { Token Token `json:"token"` } -func (c *Client) TokensList() (Tokens, error) { +func (c *Client) TokensList(ctx context.Context) (Tokens, error) { var tokensRes TokensRes - err := c.AuthAPI().ResourceList("tokens", nil, &tokensRes) + err := c.AuthAPI().ResourceList(ctx, "tokens", nil, &tokensRes) if err != nil { return nil, errgo.Notef(err, "fail to get tokens") } @@ -78,7 +79,7 @@ func (c *Client) TokensList() (Tokens, error) { return tokensRes.Tokens, nil } -func (c *Client) TokenExchange(token string) (string, error) { +func (c *Client) TokenExchange(ctx context.Context, token string) (string, error) { req := &http.APIRequest{ NoAuth: true, Method: "POST", @@ -86,7 +87,7 @@ func (c *Client) TokenExchange(token string) (string, error) { Password: token, } - res, err := c.AuthAPI().Do(req) + res, err := c.AuthAPI().Do(ctx, req) if err != nil { return "", errgo.Notef(err, "fail to make request POST /v1/tokens/exchange") } @@ -101,7 +102,7 @@ func (c *Client) TokenExchange(token string) (string, error) { return btRes.Token, nil } -func (c *Client) TokenCreateWithLogin(params TokenCreateParams, login LoginParams) (Token, error) { +func (c *Client) TokenCreateWithLogin(ctx context.Context, params TokenCreateParams, login LoginParams) (Token, error) { req := &http.APIRequest{ NoAuth: true, Method: "POST", @@ -114,7 +115,7 @@ func (c *Client) TokenCreateWithLogin(params TokenCreateParams, login LoginParam Params: map[string]interface{}{"token": params}, } - resp, err := c.AuthAPI().Do(req) + resp, err := c.AuthAPI().Do(ctx, req) if err != nil { if IsOTPRequired(err) { return Token{}, ErrOTPRequired @@ -132,12 +133,12 @@ func (c *Client) TokenCreateWithLogin(params TokenCreateParams, login LoginParam return tokenRes.Token, nil } -func (c *Client) TokenCreate(params TokenCreateParams) (Token, error) { +func (c *Client) TokenCreate(ctx context.Context, params TokenCreateParams) (Token, error) { var tokenRes TokenRes payload := map[string]TokenCreateParams{ "token": params, } - err := c.AuthAPI().ResourceAdd("tokens", payload, &tokenRes) + err := c.AuthAPI().ResourceAdd(ctx, "tokens", payload, &tokenRes) if err != nil { return Token{}, errgo.Notef(err, "fail to create token") } @@ -145,9 +146,9 @@ func (c *Client) TokenCreate(params TokenCreateParams) (Token, error) { return tokenRes.Token, nil } -func (c *Client) TokenShow(id int) (Token, error) { +func (c *Client) TokenShow(ctx context.Context, id int) (Token, error) { var tokenRes TokenRes - err := c.AuthAPI().ResourceGet("tokens", strconv.Itoa(id), nil, &tokenRes) + err := c.AuthAPI().ResourceGet(ctx, "tokens", strconv.Itoa(id), nil, &tokenRes) if err != nil { return Token{}, errgo.Notef(err, "fail to get token") } @@ -155,6 +156,6 @@ func (c *Client) TokenShow(id int) (Token, error) { return tokenRes.Token, nil } -func (c *Client) GetAccessToken() (string, error) { - return c.ScalingoAPI().TokenGenerator().GetAccessToken() +func (c *Client) GetAccessToken(ctx context.Context) (string, error) { + return c.ScalingoAPI().TokenGenerator().GetAccessToken(ctx) } diff --git a/users.go b/users.go index ac970bcd..2c6c3b07 100644 --- a/users.go +++ b/users.go @@ -1,6 +1,7 @@ package scalingo import ( + "context" "encoding/json" "gopkg.in/errgo.v1" @@ -9,9 +10,9 @@ import ( ) type UsersService interface { - Self() (*User, error) - UpdateUser(params UpdateUserParams) (*User, error) - UserStopFreeTrial() error + Self(context.Context) (*User, error) + UpdateUser(context.Context, UpdateUserParams) (*User, error) + UserStopFreeTrial(context.Context) error } var _ UsersService = (*Client)(nil) @@ -28,11 +29,11 @@ type SelfResponse struct { User *User `json:"user"` } -func (c *Client) Self() (*User, error) { +func (c *Client) Self(ctx context.Context) (*User, error) { req := &http.APIRequest{ Endpoint: "/users/self", } - res, err := c.AuthAPI().Do(req) + res, err := c.AuthAPI().Do(ctx, req) if err != nil { return nil, errgo.Mask(err, errgo.Any) } @@ -58,11 +59,11 @@ type UpdateUserResponse struct { User *User `json:"user"` } -func (c *Client) UpdateUser(params UpdateUserParams) (*User, error) { +func (c *Client) UpdateUser(ctx context.Context, params UpdateUserParams) (*User, error) { var user *User if params.StopFreeTrial { - err := c.UserStopFreeTrial() + err := c.UserStopFreeTrial(ctx) if err != nil { return nil, errgo.Notef(err, "fail to stop user free trial") } @@ -77,7 +78,7 @@ func (c *Client) UpdateUser(params UpdateUserParams) (*User, error) { }, Expected: http.Statuses{200}, } - res, err := c.AuthAPI().Do(req) + res, err := c.AuthAPI().Do(ctx, req) if err != nil { return nil, errgo.Notef(err, "fail to execute the query to update the user") } @@ -95,7 +96,7 @@ func (c *Client) UpdateUser(params UpdateUserParams) (*User, error) { return user, nil } -func (c *Client) UserStopFreeTrial() error { +func (c *Client) UserStopFreeTrial(ctx context.Context) error { req := &http.APIRequest{ Method: "POST", Endpoint: "/users/stop_free_trial", @@ -103,7 +104,7 @@ func (c *Client) UserStopFreeTrial() error { Expected: http.Statuses{200}, } - res, err := c.AuthAPI().Do(req) + res, err := c.AuthAPI().Do(ctx, req) if err != nil { return errgo.Notef(err, "fail to execute the query to stop user free trial") }