From fd0aa5d2094fe4ba15d5f6785725b4e794dc63af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Unbekandt?= Date: Thu, 26 Mar 2026 18:06:22 +0100 Subject: [PATCH] feat(dbdr/net-peering) [STORY-3557] Add commands to configure net peerings of DB-DR --- CHANGELOG.md | 1 + cmd/commands.go | 6 + cmd/databases_networking.go | 172 ++++++++++++++++++ cmd/error.go | 3 + cmd/firewall_rules.go | 8 +- dbng/networking.go | 104 +++++++++++ detect/app.go | 4 +- go.mod | 6 +- go.sum | 12 +- .../Scalingo/go-scalingo/v11/AGENTS.md | 19 ++ .../Scalingo/go-scalingo/v11/CHANGELOG.md | 13 -- .../Scalingo/go-scalingo/v11/Dockerfile | 2 +- .../Scalingo/go-scalingo/v11/README.md | 4 +- .../Scalingo/go-scalingo/v11/addons.go | 21 ++- .../Scalingo/go-scalingo/v11/alerts.go | 10 +- .../Scalingo/go-scalingo/v11/apps.go | 32 ++-- .../Scalingo/go-scalingo/v11/autoscalers.go | 10 +- .../Scalingo/go-scalingo/v11/backups.go | 11 +- .../Scalingo/go-scalingo/v11/client.go | 29 +++ .../Scalingo/go-scalingo/v11/collaborators.go | 8 +- .../Scalingo/go-scalingo/v11/container.go | 9 +- .../Scalingo/go-scalingo/v11/cron_tasks.go | 2 +- .../go-scalingo/v11/database_type_versions.go | 9 +- .../go-scalingo/v11/databases_networking.go | 102 +++++++++++ .../Scalingo/go-scalingo/v11/deployments.go | 10 +- .../Scalingo/go-scalingo/v11/domains.go | 10 +- .../Scalingo/go-scalingo/v11/env.go | 17 +- .../Scalingo/go-scalingo/v11/events.go | 2 +- .../Scalingo/go-scalingo/v11/events_app.go | 35 +--- .../go-scalingo/v11/firewall_rules.go | 11 +- .../go-scalingo/v11/http/api_request.go | 4 +- .../Scalingo/go-scalingo/v11/http/client.go | 29 ++- .../v11/http/httpmock/client_mock.go | 19 +- .../Scalingo/go-scalingo/v11/log_drains.go | 12 +- .../Scalingo/go-scalingo/v11/logs.go | 7 +- .../Scalingo/go-scalingo/v11/maintenance.go | 4 +- .../Scalingo/go-scalingo/v11/mocks.json | 1 - .../Scalingo/go-scalingo/v11/mocks_sig.json | 64 +++---- .../Scalingo/go-scalingo/v11/notifiers.go | 10 +- .../Scalingo/go-scalingo/v11/operations.go | 5 +- .../go-scalingo/v11/privatenetworks.go | 2 +- .../Scalingo/go-scalingo/v11/projects.go | 4 +- .../Scalingo/go-scalingo/v11/regions.go | 7 +- .../Scalingo/go-scalingo/v11/resources.go | 6 - .../Scalingo/go-scalingo/v11/run.go | 9 +- .../addonprovidersservice_mock.go | 5 - .../v11/scalingomock/addonsservice_mock.go | 5 - .../v11/scalingomock/alertsservice_mock.go | 5 - .../go-scalingo/v11/scalingomock/api_mock.go | 5 - .../v11/scalingomock/appsservice_mock.go | 5 - .../scalingomock/autoscalersservice_mock.go | 5 - .../v11/scalingomock/backupsservice_mock.go | 5 - .../scalingomock/collaboratorsservice_mock.go | 5 - .../containersizesservice_mock.go | 5 - .../scalingomock/containersservice_mock.go | 5 - .../v11/scalingomock/crontasksservice_mock.go | 5 - .../v11/scalingomock/databasesservice_mock.go | 5 - .../scalingomock/deploymentsservice_mock.go | 5 - .../v11/scalingomock/domainsservice_mock.go | 5 - .../v11/scalingomock/eventsservice_mock.go | 5 - .../v11/scalingomock/keysservice_mock.go | 5 - .../v11/scalingomock/logdrainsservice_mock.go | 5 - .../scalingomock/logsarchivesservice_mock.go | 5 - .../v11/scalingomock/logsservice_mock.go | 5 - .../notificationplatformsservice_mock.go | 5 - .../v11/scalingomock/notifiersservice_mock.go | 5 - .../scalingomock/operationsservice_mock.go | 5 - .../v11/scalingomock/regionsservice_mock.go | 5 - .../v11/scalingomock/runsservice_mock.go | 5 - .../scalingomock/scmrepolinkservice_mock.go | 5 - .../v11/scalingomock/signupservice_mock.go | 5 - .../v11/scalingomock/sourcesservice_mock.go | 5 - .../v11/scalingomock/tokensservice_mock.go | 5 - .../v11/scalingomock/usersservice_mock.go | 5 - .../v11/scalingomock/variablesservice_mock.go | 5 - .../go-scalingo/v11/scm_integrations.go | 9 +- .../Scalingo/go-scalingo/v11/scm_repo_link.go | 57 +++--- .../Scalingo/go-scalingo/v11/signup.go | 9 +- .../Scalingo/go-scalingo/v11/tokens.go | 23 +-- .../Scalingo/go-scalingo/v11/users.go | 17 +- .../Scalingo/go-scalingo/v11/version.go | 2 +- .../Scalingo/go-utils/logger/CHANGELOG.md | 4 - .../Scalingo/go-utils/logger/README.md | 2 +- .../go-utils/logger/redacting_formatter.go | 2 +- vendor/modules.txt | 10 +- 85 files changed, 707 insertions(+), 443 deletions(-) create mode 100644 cmd/databases_networking.go create mode 100644 dbng/networking.go create mode 100644 vendor/github.com/Scalingo/go-scalingo/v11/AGENTS.md create mode 100644 vendor/github.com/Scalingo/go-scalingo/v11/databases_networking.go delete mode 100644 vendor/github.com/Scalingo/go-scalingo/v11/resources.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b4bd9e884..20dde140e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## To Be Released +* feat(dbdr/net-peering) [STORY-3557] Add commands to configure net peerings of DB-DR * fix(addons): parse `maintenance-window-hour` as an int * feat(session): remove region cache on logout * feat: add JSON output for the `apps` command diff --git a/cmd/commands.go b/cmd/commands.go index 0b9b5a3ba..4057c4bb2 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -330,6 +330,12 @@ var ( &databaseFirewallRulesAddCommand, &databaseFirewallRulesRemoveCommand, &databaseFirewallManagedRangesCommand, + + // Network + &databaseNetPeeringsListCommand, + &databaseNetPeeringsAddCommand, + &databaseNetPeeringsRemoveCommand, + &databaseNetworkConfigurationShowCommand, } globalCommands = []*cli.Command{ diff --git a/cmd/databases_networking.go b/cmd/databases_networking.go new file mode 100644 index 000000000..c0624168c --- /dev/null +++ b/cmd/databases_networking.go @@ -0,0 +1,172 @@ +package cmd + +import ( + "context" + + "github.com/urfave/cli/v3" + + "github.com/Scalingo/cli/cmd/autocomplete" + "github.com/Scalingo/cli/dbng" + "github.com/Scalingo/cli/detect" + "github.com/Scalingo/cli/utils" + "github.com/Scalingo/go-scalingo/v11" +) + +var ( + databaseNetPeeringsListCommand = cli.Command{ + Name: "database-net-peerings", + Category: "Databases DR", + Usage: "List net peerings of a database", + ArgsUsage: "database-id", + Flags: []cli.Flag{databaseFlag()}, + Description: CommandDescription{ + Description: "List all net peerings of a database", + Examples: []string{ + "scalingo database-net-peerings my-db-id", + "scalingo --database my-db database-net-peerings", + }, + SeeAlso: []string{"database-net-peerings-add", "database-net-peerings-remove", "database-network-configuration"}, + }.Render(), + Action: func(ctx context.Context, c *cli.Command) error { + databaseID := detect.ExtractDatabaseNameFromCommandLineOrEnv(c) + if databaseID == "" { + return cli.ShowCommandHelp(ctx, c, "database-net-peerings") + } + utils.CheckForConsent(ctx, databaseID, utils.ConsentTypeDBs) + + err := dbng.DatabaseNetPeeringsList(ctx, databaseID) + if err != nil { + errorQuit(ctx, err) + } + + return nil + }, + ShellComplete: func(ctx context.Context, c *cli.Command) { + _ = autocomplete.CmdFlagsAutoComplete(c, "database-net-peerings") + _ = autocomplete.DatabasesNgListAutoComplete(ctx) + }, + } + + databaseNetPeeringsAddCommand = cli.Command{ + Name: "database-net-peerings-add", + Category: "Databases DR", + Usage: "Add a net peering to a database", + ArgsUsage: "database-id", + Flags: []cli.Flag{ + databaseFlag(), + &cli.StringFlag{ + Name: "outscale-net-peering-id", + Usage: "Outscale net peering ID", + Required: true, + }, + }, + Description: CommandDescription{ + Description: "Initiate the creation of a net peering for a database", + Examples: []string{ + "scalingo database-net-peerings-add my-db-id --outscale-net-peering-id pcx-123456789", + "scalingo --database my-db database-net-peerings-add --outscale-net-peering-id pcx-123456789", + }, + SeeAlso: []string{"database-net-peerings", "database-net-peerings-remove", "database-network-configuration"}, + }.Render(), + Action: func(ctx context.Context, c *cli.Command) error { + databaseID := detect.ExtractDatabaseNameFromCommandLineOrEnv(c) + if databaseID == "" { + return cli.ShowCommandHelp(ctx, c, "database-net-peerings-add") + } + + utils.CheckForConsent(ctx, databaseID, utils.ConsentTypeDBs) + + params := scalingo.DatabaseNetPeeringCreateParams{ + OutscaleNetPeeringID: c.String("outscale-net-peering-id"), + } + + err := dbng.DatabaseNetPeeringsAdd(ctx, databaseID, params) + if err != nil { + errorQuit(ctx, err) + } + + return nil + }, + ShellComplete: func(ctx context.Context, c *cli.Command) { + _ = autocomplete.CmdFlagsAutoComplete(c, "database-net-peerings-add") + _ = autocomplete.DatabasesNgListAutoComplete(ctx) + }, + } + + databaseNetPeeringsRemoveCommand = cli.Command{ + Name: "database-net-peerings-remove", + Category: "Databases DR", + Usage: "Remove a net peering from a database", + ArgsUsage: "database-id net-peering-id", + Flags: []cli.Flag{ + databaseFlag(), + &cli.StringFlag{ + Name: "net-peering", + Aliases: []string{"np"}, + Usage: "Net peering ID to remove", + }, + }, + Description: CommandDescription{ + Description: "Delete an existing net peering from a database", + Examples: []string{ + "scalingo database-net-peerings-remove my-db-id np-id", + "scalingo --database my-db database-net-peerings-remove np-id", + }, + SeeAlso: []string{"database-net-peerings", "database-net-peerings-add", "database-network-configuration"}, + }.Render(), + Action: func(ctx context.Context, c *cli.Command) error { + databaseID := detect.ExtractDatabaseNameFromCommandLineOrEnv(c) + if databaseID == "" { + return cli.ShowCommandHelp(ctx, c, "database-net-peerings-remove") + } + + utils.CheckForConsent(ctx, databaseID, utils.ConsentTypeDBs) + + err := dbng.DatabaseNetPeeringsRemove(ctx, databaseID, c.String("net-peering")) + if err != nil { + errorQuit(ctx, err) + } + + return nil + }, + ShellComplete: func(ctx context.Context, c *cli.Command) { + _ = autocomplete.CmdFlagsAutoComplete(c, "database-net-peerings-remove") + _ = autocomplete.DatabasesNgListAutoComplete(ctx) + }, + } + + databaseNetworkConfigurationShowCommand = cli.Command{ + Name: "database-network-configuration", + Category: "Databases DR", + Usage: "Show network configuration of a database", + ArgsUsage: "database-id", + Flags: []cli.Flag{databaseFlag()}, + Description: CommandDescription{ + Description: "Get network configuration of a database", + Examples: []string{ + "scalingo database-network-configuration my-db-id", + "scalingo --database my-db database-network-configuration", + }, + SeeAlso: []string{"database-net-peerings", "database-net-peerings-add", "database-net-peerings-remove"}, + }.Render(), + Action: func(ctx context.Context, c *cli.Command) error { + databaseID := detect.ExtractDatabaseNameFromCommandLineOrEnv(c) + if databaseID == "" { + return cli.ShowCommandHelp(ctx, c, "database-network-configuration") + } + + utils.CheckForConsent(ctx, databaseID, utils.ConsentTypeDBs) + + err := dbng.DatabaseNetworkConfigurationShow(ctx, databaseID) + if err != nil { + errorQuit(ctx, err) + } + + return nil + }, + ShellComplete: func(ctx context.Context, c *cli.Command) { + _ = autocomplete.CmdFlagsAutoComplete(c, "database-network-configuration") + _ = autocomplete.DatabasesNgListAutoComplete(ctx) + }, + } +) diff --git a/cmd/error.go b/cmd/error.go index 5fbd1f608..2a0ab5d47 100644 --- a/cmd/error.go +++ b/cmd/error.go @@ -135,6 +135,9 @@ func displayRequestFailedError(requestFailedErr *httpclient.RequestFailedError, fmt.Println(io.Indent(err.Error(), 7)) } + case http.StatusConflict: // 409 + // In case of conflict error, we only want to display the API error. + io.Errorf("%s\n", strings.ReplaceAll(requestFailedErr.Error(), `\n`, "\n")) case http.StatusUnprocessableEntity: unprocessableEntityErr, ok := requestFailedErr.APIError.(httpclient.UnprocessableEntity) if !ok { diff --git a/cmd/firewall_rules.go b/cmd/firewall_rules.go index fda0adf6f..775de6495 100644 --- a/cmd/firewall_rules.go +++ b/cmd/firewall_rules.go @@ -17,7 +17,7 @@ import ( var ( databaseFirewallRulesListCommand = cli.Command{ Name: "database-firewall-rules", - Category: "Databases NG", + Category: "Databases DR", Usage: "List firewall rules of a database", ArgsUsage: "database-id", Flags: []cli.Flag{databaseFlag()}, @@ -56,7 +56,7 @@ var ( databaseFirewallRulesAddCommand = cli.Command{ Name: "database-firewall-rules-add", - Category: "Databases NG", + Category: "Databases DR", Usage: "Add a firewall rule to a database", ArgsUsage: "database-id", Flags: []cli.Flag{ @@ -133,7 +133,7 @@ var ( databaseFirewallRulesRemoveCommand = cli.Command{ Name: "database-firewall-rules-remove", - Category: "Databases NG", + Category: "Databases DR", Usage: "Remove a firewall rule from a database", ArgsUsage: "database-id rule-id", Flags: []cli.Flag{databaseFlag()}, @@ -194,7 +194,7 @@ var ( databaseFirewallManagedRangesCommand = cli.Command{ Name: "database-firewall-managed-ranges", - Category: "Databases NG", + Category: "Databases DR", Usage: "List available managed ranges for a database", ArgsUsage: "database-id", Flags: []cli.Flag{databaseFlag()}, diff --git a/dbng/networking.go b/dbng/networking.go new file mode 100644 index 000000000..23e0ecc07 --- /dev/null +++ b/dbng/networking.go @@ -0,0 +1,104 @@ +package dbng + +import ( + "context" + "os" + + "github.com/olekukonko/tablewriter" + + "github.com/Scalingo/cli/config" + "github.com/Scalingo/cli/io" + "github.com/Scalingo/go-scalingo/v11" + "github.com/Scalingo/go-utils/errors/v3" +) + +func DatabaseNetPeeringsList(ctx context.Context, databaseID string) error { + c, err := config.ScalingoClient(ctx) + if err != nil { + return errors.Wrap(ctx, err, "get Scalingo client") + } + + netPeerings, err := c.Preview().DatabaseNetPeeringsList(ctx, databaseID) + if err != nil { + return errors.Wrap(ctx, err, "list database net peerings") + } + + if len(netPeerings) == 0 { + io.Status("No net peering configured for this database.") + return nil + } + + t := tablewriter.NewWriter(os.Stdout) + t.Header([]string{"ID", "Status", "Outscale Net Peering ID", "Source Net ID", "Source Net IP Range", "Source Account ID"}) + + for _, netPeering := range netPeerings { + _ = t.Append([]string{ + netPeering.ID, + string(netPeering.Status), + netPeering.OutscaleNetPeeringID, + netPeering.OutscaleSourceNetID, + netPeering.OutscaleSourceNetIPRange, + netPeering.OutscaleSourceAccountID, + }) + } + + _ = t.Render() + + return nil +} + +func DatabaseNetPeeringsAdd(ctx context.Context, databaseID string, params scalingo.DatabaseNetPeeringCreateParams) error { + c, err := config.ScalingoClient(ctx) + if err != nil { + return errors.Wrap(ctx, err, "get Scalingo client") + } + + netPeering, err := c.Preview().DatabaseNetPeeringCreate(ctx, databaseID, params) + if err != nil { + return errors.Wrap(ctx, err, "add database net peering") + } + + io.Statusf("Net peering '%s' creation has been initiated for database '%s'.\n", netPeering.ID, databaseID) + io.Warning("Expect some delay for the net peering to be applied.") + + return nil +} + +func DatabaseNetPeeringsRemove(ctx context.Context, databaseID, netPeeringID string) error { + c, err := config.ScalingoClient(ctx) + if err != nil { + return errors.Wrap(ctx, err, "get Scalingo client") + } + + err = c.Preview().DatabaseNetPeeringDestroy(ctx, databaseID, netPeeringID) + if err != nil { + return errors.Wrap(ctx, err, "remove database net peering") + } + + io.Statusf("Net peering '%s' has been removed from database '%s'.\n", netPeeringID, databaseID) + io.Warning("Expect some delay for the net peering removal to be applied.") + + return nil +} + +func DatabaseNetworkConfigurationShow(ctx context.Context, databaseID string) error { + c, err := config.ScalingoClient(ctx) + if err != nil { + return errors.Wrap(ctx, err, "get Scalingo client") + } + + networkConfiguration, err := c.Preview().DatabaseNetworkConfigurationShow(ctx, databaseID) + if err != nil { + return errors.Wrap(ctx, err, "show database network configuration") + } + + t := tablewriter.NewWriter(os.Stdout) + _ = t.Bulk([][]string{ + {"Outscale account ID", networkConfiguration.OutscaleAccountID}, + {"Outscale net ID", networkConfiguration.OutscaleNetID}, + {"IP range", networkConfiguration.IPRange}, + }) + _ = t.Render() + + return nil +} diff --git a/detect/app.go b/detect/app.go index 94dc47383..1b406b57c 100644 --- a/detect/app.go +++ b/detect/app.go @@ -159,7 +159,7 @@ func CurrentApp(ctx context.Context, c *cli.Command) string { // It returns an empty string and errDatabaseNotFound error if the database name // is not provided or resource ID not found. func currentDatabaseNameAndUUID(ctx context.Context, c *cli.Command) (string, string, error) { - dbName := extractDatabaseNameFromCommandLineOrEnv(c) + dbName := ExtractDatabaseNameFromCommandLineOrEnv(c) if dbName == "" { return "", "", errDatabaseNotFound } @@ -251,7 +251,7 @@ func extractAppName(ctx context.Context, c *cli.Command) string { return appName } -func extractDatabaseNameFromCommandLineOrEnv(c *cli.Command) string { +func ExtractDatabaseNameFromCommandLineOrEnv(c *cli.Command) string { if os.Getenv("SCALINGO_PREVIEW_FEATURES") != "true" { return "" } diff --git a/go.mod b/go.mod index e4faf96b8..df85c3f20 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.25.0 require ( github.com/AlecAivazis/survey/v2 v2.3.7 - github.com/Scalingo/go-scalingo/v11 v11.0.3 + github.com/Scalingo/go-scalingo/v11 v11.0.1-0.20260513124010-187ac32aa251 github.com/Scalingo/go-utils/errors/v3 v3.2.1 - github.com/Scalingo/go-utils/logger v1.12.2 + github.com/Scalingo/go-utils/logger v1.12.1 github.com/Scalingo/go-utils/pagination v1.2.0 github.com/Scalingo/gopassword v1.1.0 github.com/briandowns/spinner v1.23.2 @@ -27,7 +27,7 @@ require ( go.uber.org/mock v0.6.0 golang.org/x/crypto v0.50.0 golang.org/x/term v0.42.0 - golang.org/x/text v0.36.0 + golang.org/x/text v0.37.0 ) require ( diff --git a/go.sum b/go.sum index 7fa8ae262..db79f9014 100644 --- a/go.sum +++ b/go.sum @@ -9,12 +9,12 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63n github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM= github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo= -github.com/Scalingo/go-scalingo/v11 v11.0.3 h1:CcrjEWjPiXjc92RKH3o9qziqwSH0QFUGgYx4jr4hnb8= -github.com/Scalingo/go-scalingo/v11 v11.0.3/go.mod h1:NHldjCv/tYLyTs5ed7kGVMvuCtoP2W8Lfhcnhm8Sl0Q= +github.com/Scalingo/go-scalingo/v11 v11.0.1-0.20260513124010-187ac32aa251 h1:L2yUr9oKobRcOiaw8oMCzcuVombzxmjren2pcwDkCjM= +github.com/Scalingo/go-scalingo/v11 v11.0.1-0.20260513124010-187ac32aa251/go.mod h1:SKmfy5pA4i9jb6Zxx5n2X9uh9Q7Hwkr1sCDICA/3Z4U= github.com/Scalingo/go-utils/errors/v3 v3.2.1 h1:2w3qUz6MxJa3aqx/biz2G3JquSKsFnfz/E7wrNf/LPc= github.com/Scalingo/go-utils/errors/v3 v3.2.1/go.mod h1:jVVNoOdYFjuNkR/BeEZWNWJVvu4jmyLY4udlsQQyBss= -github.com/Scalingo/go-utils/logger v1.12.2 h1:9vm83/gqjCIy5t+OuNYjkVOUrJtdMy78XNIv8E+OCCU= -github.com/Scalingo/go-utils/logger v1.12.2/go.mod h1:vaeFcI5LMHiRRmMfJbbnblbj3RXRJIzxUcyEjZpMFpg= +github.com/Scalingo/go-utils/logger v1.12.1 h1:r+RqwOcnsTtKoQdvcNVZCtu0Xhq01tp/3gT6+4Q7AxI= +github.com/Scalingo/go-utils/logger v1.12.1/go.mod h1:uH7LVG1pQR+5jpVgGDFyFfTMeHc3nUXC7GRUc2dPoZ4= github.com/Scalingo/go-utils/pagination v1.2.0 h1:dTvce+thcZXH/S13HF5dxGNPCMdGALNsW6p2EYe2Pno= github.com/Scalingo/go-utils/pagination v1.2.0/go.mod h1:MwT1RRecXktFgVNeib+B4dnM4r0cPc93JichOPs5tj0= github.com/Scalingo/gopassword v1.1.0 h1:UBK4U1l3gEZ78d6ESEhkN78DmrulqYgJTazeJl6Rtog= @@ -192,8 +192,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/AGENTS.md b/vendor/github.com/Scalingo/go-scalingo/v11/AGENTS.md new file mode 100644 index 000000000..b1272b15a --- /dev/null +++ b/vendor/github.com/Scalingo/go-scalingo/v11/AGENTS.md @@ -0,0 +1,19 @@ +# AGENTS Guidance + +This repository enforces strict linting. Follow these rules for new and modified Go code. + +## Imports And Formatting +- Always run `goimports -w -local github.com/Scalingo` on modified Go files. +- Keep imports in the order enforced by `goimports`: + 1. Standard library + 2. Third-party + 3. Local imports grouped under `github.com/Scalingo` +- Always use constants from net/http to deal with HTTP Status and Method (ie. http.StatusOK, or http.MethodGet) + +## Go Modernization +- Use `any` instead of `interface{}`. + +## Tests +- Prefer `t.Context()` over `context.Background()` inside tests. +- In `http.HandlerFunc` test callbacks, do not use `require.*`. +- In handlers, use `assert.*` and return early when an error should stop assertions in that callback. diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/CHANGELOG.md b/vendor/github.com/Scalingo/go-scalingo/v11/CHANGELOG.md index 337759677..0f134d1ba 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/CHANGELOG.md +++ b/vendor/github.com/Scalingo/go-scalingo/v11/CHANGELOG.md @@ -2,19 +2,6 @@ ## To Be Released -## 11.0.3 - -* fix(run): add JSON tag for `OperationURL` - -## 11.0.2 - -* feat(EventRestart): add `Reason` field - -## 11.0.1 - -* chore(deps): bump `golang.org/x/text` from `0.34.0` to `0.35.0` ([#494](https://github.com/Scalingo/go-scalingo/pull/494)) -* build: align Dockerfile Go version with `go.mod` ([#494](https://github.com/Scalingo/go-scalingo/pull/494)) - ## 11.0.0 * fix(privatenetworks): `PrivateNetworksDomainsList` must take a `pagination.Request` in argument (breaking change) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/Dockerfile b/vendor/github.com/Scalingo/go-scalingo/v11/Dockerfile index d7a757cd2..0d5ccec1c 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/Dockerfile +++ b/vendor/github.com/Scalingo/go-scalingo/v11/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25 +FROM golang:1.24 MAINTAINER Étienne Michon "etienne@scalingo.com" RUN go install github.com/cespare/reflex@latest diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/README.md b/vendor/github.com/Scalingo/go-scalingo/v11/README.md index afd86263b..758669753 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/README.md +++ b/vendor/github.com/Scalingo/go-scalingo/v11/README.md @@ -1,4 +1,4 @@ -# Go client for Scalingo API v11.0.3 +# Go client for Scalingo API v11.0.0 This repository is the Go client for the [Scalingo APIs](https://developers.scalingo.com/). @@ -81,7 +81,7 @@ Bump new version number in: Commit, tag and create a new release: ```sh -version="11.0.3" +version="11.0.0" git switch --create release/${version} git add CHANGELOG.md README.md version.go diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/addons.go b/vendor/github.com/Scalingo/go-scalingo/v11/addons.go index c4d524685..33aba0dac 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/addons.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/addons.go @@ -2,10 +2,11 @@ package scalingo import ( "context" + "net/http" "strconv" "time" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -63,7 +64,7 @@ type AddonLogsURLRes struct { func (c *Client) AddonsList(ctx context.Context, app string) ([]*Addon, error) { var addonsRes AddonsRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "addons", nil, &addonsRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, addonsResource, nil, &addonsRes) if err != nil { return nil, errors.Wrap(ctx, err, "list addons") } @@ -73,7 +74,7 @@ func (c *Client) AddonsList(ctx context.Context, app string) ([]*Addon, error) { func (c *Client) AddonShow(ctx context.Context, app, addonID string) (Addon, error) { var addonRes AddonRes - err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "addons", addonID, nil, &addonRes) + err := c.ScalingoAPI().SubresourceGet(ctx, appsResource, app, addonsResource, addonID, nil, &addonRes) if err != nil { return Addon{}, errors.Wrap(ctx, err, "show addon") } @@ -94,7 +95,7 @@ type AddonProvisionParamsWrapper struct { func (c *Client) AddonProvision(ctx context.Context, app string, params AddonProvisionParams) (AddonRes, error) { var addonRes AddonRes - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "addons", AddonProvisionParamsWrapper{params}, &addonRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, addonsResource, AddonProvisionParamsWrapper{params}, &addonRes) if err != nil { return AddonRes{}, errors.Wrap(ctx, err, "provision addon") } @@ -102,7 +103,7 @@ func (c *Client) AddonProvision(ctx context.Context, app string, params AddonPro } func (c *Client) AddonDestroy(ctx context.Context, app, addonID string) error { - return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "addons", addonID) + return c.ScalingoAPI().SubresourceDelete(ctx, appsResource, app, addonsResource, addonID) } type AddonUpgradeParams struct { @@ -116,7 +117,7 @@ type AddonUpgradeParamsWrapper struct { func (c *Client) AddonUpgrade(ctx context.Context, app, addonID string, params AddonUpgradeParams) (AddonRes, error) { var addonRes AddonRes err := c.ScalingoAPI().SubresourceUpdate( - ctx, "apps", app, "addons", addonID, + ctx, appsResource, app, addonsResource, addonID, AddonUpgradeParamsWrapper{Addon: params}, &addonRes, ) if err != nil { @@ -127,8 +128,8 @@ func (c *Client) AddonUpgrade(ctx context.Context, app, addonID string, params A func (c *Client) AddonToken(ctx context.Context, app, addonID string) (string, error) { var res AddonTokenRes - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "POST", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/apps/" + app + "/addons/" + addonID + "/token", }, &res) if err != nil { @@ -140,7 +141,7 @@ func (c *Client) AddonToken(ctx context.Context, app, addonID string) (string, e func (c *Client) AddonLogsURL(ctx context.Context, app, addonID string) (string, error) { var urlRes AddonLogsURLRes - err := c.DBAPI(app, addonID).DoRequest(ctx, &http.APIRequest{ + err := c.DBAPI(app, addonID).DoRequest(ctx, &httpclient.APIRequest{ Endpoint: "/databases/" + addonID + "/logs", }, &urlRes) if err != nil { @@ -152,7 +153,7 @@ func (c *Client) AddonLogsURL(ctx context.Context, app, addonID string) (string, func (c *Client) AddonLogsArchives(ctx context.Context, app, addonID string, page int) (*LogsArchivesResponse, error) { var logsRes LogsArchivesResponse - err := c.DBAPI(app, addonID).DoRequest(ctx, &http.APIRequest{ + err := c.DBAPI(app, addonID).DoRequest(ctx, &httpclient.APIRequest{ Endpoint: "/databases/" + addonID + "/logs_archives", Params: map[string]string{ "page": strconv.FormatInt(int64(page), 10), diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/alerts.go b/vendor/github.com/Scalingo/go-scalingo/v11/alerts.go index 7db9214eb..ffa75c3ee 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/alerts.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/alerts.go @@ -43,7 +43,7 @@ type AlertRes struct { func (c *Client) AlertsList(ctx context.Context, app string) ([]*Alert, error) { var alertsRes AlertsRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "alerts", nil, &alertsRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, alertsResource, nil, &alertsRes) if err != nil { return nil, errors.Wrap(ctx, err, "query the API to list an alert") } @@ -77,7 +77,7 @@ func (c *Client) AlertAdd(ctx context.Context, app string, params AlertAddParams if params.DurationBeforeTrigger != nil { a.DurationBeforeTrigger = *params.DurationBeforeTrigger } - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "alerts", AlertRes{ + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, alertsResource, AlertRes{ Alert: a, }, &alertRes) if err != nil { @@ -88,7 +88,7 @@ func (c *Client) AlertAdd(ctx context.Context, app string, params AlertAddParams func (c *Client) AlertShow(ctx context.Context, app, id string) (*Alert, error) { var alertRes AlertRes - err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "alerts", id, nil, &alertRes) + err := c.ScalingoAPI().SubresourceGet(ctx, appsResource, app, alertsResource, id, nil, &alertRes) if err != nil { return nil, errors.Wrap(ctx, err, "query the API to show an alert") } @@ -108,7 +108,7 @@ type AlertUpdateParams struct { func (c *Client) AlertUpdate(ctx context.Context, app, id string, params AlertUpdateParams) (*Alert, error) { var alertRes AlertRes - err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "alerts", id, params, &alertRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, appsResource, app, alertsResource, id, params, &alertRes) if err != nil { return nil, errors.Wrap(ctx, err, "query the API to update an alert") } @@ -116,7 +116,7 @@ func (c *Client) AlertUpdate(ctx context.Context, app, id string, params AlertUp } func (c *Client) AlertRemove(ctx context.Context, app, id string) error { - err := c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "alerts", id) + err := c.ScalingoAPI().SubresourceDelete(ctx, appsResource, app, alertsResource, id) if err != nil { return errors.Wrap(ctx, err, "query the API to remove an alert") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/apps.go b/vendor/github.com/Scalingo/go-scalingo/v11/apps.go index 02788c8bb..c99344a14 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/apps.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/apps.go @@ -167,9 +167,9 @@ func (c *Client) AppsShow(ctx context.Context, appName string) (*App, error) { func (c *Client) AppsDestroy(ctx context.Context, name string, currentName string) error { req := &httpclient.APIRequest{ - Method: "DELETE", + Method: http.MethodDelete, Endpoint: "/apps/" + name, - Expected: httpclient.Statuses{204}, + Expected: httpclient.Statuses{http.StatusNoContent}, Params: map[string]any{ "current_name": currentName, }, @@ -185,9 +185,9 @@ func (c *Client) AppsDestroy(ctx context.Context, name string, currentName strin func (c *Client) AppsRename(ctx context.Context, name string, newName string) (*App, error) { var appRes *AppResponse req := &httpclient.APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/apps/" + name + "/rename", - Expected: httpclient.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, Params: map[string]any{ "current_name": name, "new_name": newName, @@ -204,9 +204,9 @@ func (c *Client) AppsRename(ctx context.Context, name string, newName string) (* func (c *Client) AppsTransfer(ctx context.Context, name string, email string) (*App, error) { var appRes *AppResponse req := &httpclient.APIRequest{ - Method: "PATCH", + Method: http.MethodPatch, Endpoint: "/apps/" + name, - Expected: httpclient.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, Params: map[string]any{ "app": map[string]string{ "owner": email, @@ -223,9 +223,9 @@ func (c *Client) AppsTransfer(ctx context.Context, name string, email string) (* func (c *Client) AppsSetStack(ctx context.Context, app string, stackID string) (*App, error) { req := &httpclient.APIRequest{ - Method: "PATCH", + Method: http.MethodPatch, Endpoint: "/apps/" + app, - Expected: httpclient.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, Params: map[string]any{ "app": map[string]string{ "stack_id": stackID, @@ -246,9 +246,9 @@ func (c *Client) AppsSetStack(ctx context.Context, app string, stackID string) ( // It returns an operation URL to track its progress. func (c *Client) AppsRestart(ctx context.Context, app string, scope *AppsRestartParams) (string, error) { req := &httpclient.APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/apps/" + app + "/restart", - Expected: httpclient.Statuses{202}, + Expected: httpclient.Statuses{http.StatusAccepted}, Params: scope, } @@ -264,9 +264,9 @@ func (c *Client) AppsRestart(ctx context.Context, app string, scope *AppsRestart func (c *Client) AppsCreate(ctx context.Context, opts AppsCreateOpts) (*App, error) { var appRes *AppResponse req := &httpclient.APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/apps", - Expected: httpclient.Statuses{201}, + Expected: httpclient.Statuses{http.StatusCreated}, Params: map[string]any{"app": opts}, } err := c.ScalingoAPI().DoRequest(ctx, req, &appRes) @@ -321,11 +321,11 @@ type ScaleRes struct { // AppsScale scales an app and returns the updated containers and the operation URL when scaling is processed asynchronously. func (c *Client) AppsScale(ctx context.Context, app string, params *AppsScaleParams) ([]ContainerType, string, error) { req := &httpclient.APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/apps/" + app + "/scale", Params: params, - // Return "200 OK" if app is scaled before deployment. - // Otherwise async job is triggered, it's "202 Accepted". + // Return "http.StatusOK OK" if app is scaled before deployment. + // Otherwise async job is triggered, it's "http.StatusAccepted Accepted". Expected: httpclient.Statuses{http.StatusOK, http.StatusAccepted}, } res, err := c.ScalingoAPI().Do(ctx, req) @@ -372,7 +372,7 @@ func (c *Client) appsUpdate(ctx context.Context, name string, params map[string] req := &httpclient.APIRequest{ Method: "PUT", Endpoint: "/apps/" + name, - Expected: httpclient.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, Params: params, } err := c.ScalingoAPI().DoRequest(ctx, req, &appRes) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/autoscalers.go b/vendor/github.com/Scalingo/go-scalingo/v11/autoscalers.go index 79c9b98cf..99dce49d7 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/autoscalers.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/autoscalers.go @@ -35,7 +35,7 @@ type AutoscalerRes struct { func (c *Client) AutoscalersList(ctx context.Context, app string) ([]Autoscaler, error) { var autoscalersRes AutoscalersRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "autoscalers", nil, &autoscalersRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, autoscalersResource, nil, &autoscalersRes) if err != nil { return nil, errors.Wrap(ctx, err, "list autoscalers") } @@ -52,7 +52,7 @@ type AutoscalerAddParams struct { func (c *Client) AutoscalerAdd(ctx context.Context, app string, params AutoscalerAddParams) (*Autoscaler, error) { var autoscalerRes AutoscalerRes - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "autoscalers", AutoscalerRes{ + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, autoscalersResource, AutoscalerRes{ Autoscaler: Autoscaler{ ContainerType: params.ContainerType, Metric: params.Metric, @@ -69,7 +69,7 @@ func (c *Client) AutoscalerAdd(ctx context.Context, app string, params Autoscale func (c *Client) AutoscalerShow(ctx context.Context, app, id string) (*Autoscaler, error) { var autoscalerRes AutoscalerRes - err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "autoscalers", id, nil, &autoscalerRes) + err := c.ScalingoAPI().SubresourceGet(ctx, appsResource, app, autoscalersResource, id, nil, &autoscalerRes) if err != nil { return nil, errors.Wrap(ctx, err, "show autoscaler") } @@ -86,7 +86,7 @@ type AutoscalerUpdateParams struct { func (c *Client) AutoscalerUpdate(ctx context.Context, app, id string, params AutoscalerUpdateParams) (*Autoscaler, error) { var autoscalerRes AutoscalerRes - err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "autoscalers", id, params, &autoscalerRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, appsResource, app, autoscalersResource, id, params, &autoscalerRes) if err != nil { return nil, errors.Wrap(ctx, err, "update autoscaler") } @@ -94,7 +94,7 @@ func (c *Client) AutoscalerUpdate(ctx context.Context, app, id string, params Au } func (c *Client) AutoscalerRemove(ctx context.Context, app, id string) error { - err := c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "autoscalers", id) + err := c.ScalingoAPI().SubresourceDelete(ctx, appsResource, app, autoscalersResource, id) if err != nil { return errors.Wrap(ctx, err, "delete autoscaler") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/backups.go b/vendor/github.com/Scalingo/go-scalingo/v11/backups.go index a1f63902c..a8069f853 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/backups.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/backups.go @@ -2,9 +2,10 @@ package scalingo import ( "context" + "net/http" "time" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -56,7 +57,7 @@ type DownloadURLRes struct { func (c *Client) BackupList(ctx context.Context, app string, addonID string) ([]Backup, error) { var backupRes BackupsRes - err := c.DBAPI(app, addonID).SubresourceList(ctx, "databases", addonID, "backups", nil, &backupRes) + err := c.DBAPI(app, addonID).SubresourceList(ctx, databasesResource, addonID, backupsResource, nil, &backupRes) if err != nil { return nil, errors.Wrap(ctx, err, "get backup") } @@ -65,7 +66,7 @@ func (c *Client) BackupList(ctx context.Context, app string, addonID string) ([] func (c *Client) BackupCreate(ctx context.Context, app, addonID string) (*Backup, error) { var backupRes BackupRes - err := c.DBAPI(app, addonID).SubresourceAdd(ctx, "databases", addonID, "backups", nil, &backupRes) + err := c.DBAPI(app, addonID).SubresourceAdd(ctx, databasesResource, addonID, backupsResource, nil, &backupRes) if err != nil { return nil, errors.Wrap(ctx, err, "schedule a new backup") } @@ -83,8 +84,8 @@ func (c *Client) BackupShow(ctx context.Context, app, addonID, backup string) (* func (c *Client) BackupDownloadURL(ctx context.Context, app, addonID, backupID string) (string, error) { var downloadRes DownloadURLRes - req := &http.APIRequest{ - Method: "GET", + req := &httpclient.APIRequest{ + Method: http.MethodGet, Endpoint: "/databases/" + addonID + "/backups/" + backupID + "/archive", } err := c.DBAPI(app, addonID).DoRequest(ctx, req, &downloadRes) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/client.go b/vendor/github.com/Scalingo/go-scalingo/v11/client.go index a4bcb0a5b..52e94b003 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/client.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/client.go @@ -51,6 +51,35 @@ type API interface { var _ API = (*Client)(nil) +const ( + addonsResource = "addons" + alertsResource = "alerts" + appsResource = "apps" + autoscalersResource = "autoscalers" + collaboratorsResource = "collaborators" + cronTasksResource = "cron_tasks" + deploymentsResource = "deployments" + domainsResource = "domains" + eventsResource = "events" + logDrainsResource = "log_drains" + logsResource = "logs" + notifiersResource = "notifiers" + operationsResource = "operations" + privateNetworkResource = "private_network" + privateNetworkDomainNamesResource = "private_network_domain_names" + projectResource = "projects" + usersResource = "users" + variablesResource = "variables" + + // Database-related resources + backupsResource = "backups" + databasesResource = "databases" + firewallRulesResource = "firewall_rules" + maintenanceResource = "maintenance" + netPeeringsResource = "net_peerings" + networkConfigurationResource = "network_configuration" +) + type Client struct { config ClientConfig apiClient httpclient.Client diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/collaborators.go b/vendor/github.com/Scalingo/go-scalingo/v11/collaborators.go index 374d3dd21..6e434dc6b 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/collaborators.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/collaborators.go @@ -60,7 +60,7 @@ type CollaboratorUpdateParamsPayload struct { func (c *Client) CollaboratorsList(ctx context.Context, app string) ([]Collaborator, error) { var collaboratorsRes CollaboratorsRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "collaborators", nil, &collaboratorsRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, collaboratorsResource, nil, &collaboratorsRes) if err != nil { return nil, errors.Wrap(ctx, err, "list collaborators") } @@ -69,7 +69,7 @@ func (c *Client) CollaboratorsList(ctx context.Context, app string) ([]Collabora func (c *Client) CollaboratorAdd(ctx context.Context, app string, params CollaboratorAddParams) (Collaborator, error) { var collaboratorRes CollaboratorRes - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "collaborators", CollaboratorAddParamsPayload{params}, &collaboratorRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, collaboratorsResource, CollaboratorAddParamsPayload{params}, &collaboratorRes) if err != nil { return Collaborator{}, errors.Wrap(ctx, err, "add collaborator") } @@ -77,7 +77,7 @@ func (c *Client) CollaboratorAdd(ctx context.Context, app string, params Collabo } func (c *Client) CollaboratorRemove(ctx context.Context, app, collaboratorID string) error { - err := c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "collaborators", collaboratorID) + err := c.ScalingoAPI().SubresourceDelete(ctx, appsResource, app, collaboratorsResource, collaboratorID) if err != nil { return errors.Wrap(ctx, err, "remove collaborator") } @@ -86,7 +86,7 @@ func (c *Client) CollaboratorRemove(ctx context.Context, app, collaboratorID str func (c *Client) CollaboratorUpdate(ctx context.Context, app, collaboratorID string, params CollaboratorUpdateParams) (Collaborator, error) { var collaboratorRes CollaboratorRes - err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "collaborators", collaboratorID, CollaboratorUpdateParamsPayload{params}, &collaboratorRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, appsResource, app, collaboratorsResource, collaboratorID, CollaboratorUpdateParamsPayload{params}, &collaboratorRes) if err != nil { return Collaborator{}, errors.Wrap(ctx, err, "update collaborator") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/container.go b/vendor/github.com/Scalingo/go-scalingo/v11/container.go index 90075bfd4..b8b714785 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/container.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/container.go @@ -3,6 +3,7 @@ package scalingo import ( "context" "fmt" + "net/http" "time" httpclient "github.com/Scalingo/go-scalingo/v11/http" @@ -31,9 +32,9 @@ type Container struct { func (c *Client) ContainersStop(ctx context.Context, appName, containerID string) error { req := &httpclient.APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: fmt.Sprintf("/apps/%s/containers/%s/stop", appName, containerID), - Expected: httpclient.Statuses{202}, + Expected: httpclient.Statuses{http.StatusAccepted}, } err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { @@ -45,10 +46,10 @@ func (c *Client) ContainersStop(ctx context.Context, appName, containerID string func (c *Client) ContainersKill(ctx context.Context, app string, signal string, containerID string) error { req := &httpclient.APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/apps/" + app + "/containers/" + containerID + "/kill", Params: map[string]any{"signal": signal}, - Expected: httpclient.Statuses{204}, + Expected: httpclient.Statuses{http.StatusNoContent}, } err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/cron_tasks.go b/vendor/github.com/Scalingo/go-scalingo/v11/cron_tasks.go index 3352e72e4..8687494fd 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/cron_tasks.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/cron_tasks.go @@ -26,7 +26,7 @@ type CronTasks struct { func (c *Client) CronTasksGet(ctx context.Context, app string) (CronTasks, error) { resp := CronTasks{} - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "cron_tasks", nil, &resp) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, cronTasksResource, nil, &resp) if err != nil { return CronTasks{}, errors.Wrap(ctx, err, "get cron tasks") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/database_type_versions.go b/vendor/github.com/Scalingo/go-scalingo/v11/database_type_versions.go index 7fa94efac..554bd54d7 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/database_type_versions.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/database_type_versions.go @@ -3,9 +3,10 @@ package scalingo import ( "context" "fmt" + "net/http" "time" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -41,10 +42,10 @@ type DatabaseTypeVersionShowResponse struct { func (c Client) DatabaseTypeVersion(ctx context.Context, appID, addonID, versionID string) (DatabaseTypeVersion, error) { var res DatabaseTypeVersionShowResponse - err := c.DBAPI(appID, addonID).DoRequest(ctx, &http.APIRequest{ - Method: "GET", + err := c.DBAPI(appID, addonID).DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodGet, Endpoint: "/database_type_versions/" + versionID, - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, }, &res) if err != nil { return res.DatabaseTypeVersion, errors.Wrapf(ctx, err, "get database type version %v", versionID) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/databases_networking.go b/vendor/github.com/Scalingo/go-scalingo/v11/databases_networking.go new file mode 100644 index 000000000..e69b1d84f --- /dev/null +++ b/vendor/github.com/Scalingo/go-scalingo/v11/databases_networking.go @@ -0,0 +1,102 @@ +package scalingo + +import ( + "context" + "time" + + "github.com/Scalingo/go-utils/errors/v3" +) + +type DatabaseNetPeeringStatus string + +const ( + DatabaseNetPeeringStatusActive DatabaseNetPeeringStatus = "active" + DatabaseNetPeeringStatusDeleted DatabaseNetPeeringStatus = "deleted" +) + +type DatabaseNetPeering struct { + ID string `json:"id"` + DatabaseID string `json:"database_id"` + Status DatabaseNetPeeringStatus `json:"status"` + OutscaleNetPeeringID string `json:"outscale_net_peering_id"` + OutscaleSourceNetID string `json:"outscale_source_net_id"` + OutscaleSourceNetIPRange string `json:"outscale_source_net_ip_range"` + OutscaleSourceAccountID string `json:"outscale_source_account_id"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +type DatabaseNetPeeringCreateParams struct { + OutscaleNetPeeringID string `json:"outscale_net_peering_id"` +} + +type DatabaseNetPeeringResponse struct { + NetPeering DatabaseNetPeering `json:"net_peering"` +} + +type DatabaseNetPeeringsResponse struct { + NetPeerings []DatabaseNetPeering `json:"net_peerings"` +} + +type DatabaseNetworkConfiguration struct { + OutscaleAccountID string `json:"outscale_account_id"` + OutscaleNetID string `json:"outscale_net_id"` + IPRange string `json:"ip_range"` +} + +type DatabaseNetworkConfigurationResponse struct { + NetworkConfiguration DatabaseNetworkConfiguration `json:"network_configuration"` +} + +func (c *PreviewClient) DatabaseNetPeeringCreate(ctx context.Context, databaseID string, params DatabaseNetPeeringCreateParams) (DatabaseNetPeering, error) { + var res DatabaseNetPeeringResponse + + err := c.parent.ScalingoAPI().SubresourceAdd(ctx, databasesResource, databaseID, netPeeringsResource, params, &res) + if err != nil { + return DatabaseNetPeering{}, errors.Wrap(ctx, err, "create database net peering") + } + + return res.NetPeering, nil +} + +func (c *PreviewClient) DatabaseNetPeeringsList(ctx context.Context, databaseID string) ([]DatabaseNetPeering, error) { + var res DatabaseNetPeeringsResponse + + err := c.parent.ScalingoAPI().SubresourceList(ctx, databasesResource, databaseID, netPeeringsResource, nil, &res) + if err != nil { + return nil, errors.Wrap(ctx, err, "list database net peerings") + } + + return res.NetPeerings, nil +} + +func (c *PreviewClient) DatabaseNetPeeringShow(ctx context.Context, databaseID, netPeeringID string) (DatabaseNetPeering, error) { + var res DatabaseNetPeeringResponse + + err := c.parent.ScalingoAPI().SubresourceGet(ctx, databasesResource, databaseID, netPeeringsResource, netPeeringID, nil, &res) + if err != nil { + return DatabaseNetPeering{}, errors.Wrap(ctx, err, "show database net peering") + } + + return res.NetPeering, nil +} + +func (c *PreviewClient) DatabaseNetPeeringDestroy(ctx context.Context, databaseID, netPeeringID string) error { + err := c.parent.ScalingoAPI().SubresourceDelete(ctx, databasesResource, databaseID, netPeeringsResource, netPeeringID) + if err != nil { + return errors.Wrap(ctx, err, "destroy database net peering") + } + + return nil +} + +func (c *PreviewClient) DatabaseNetworkConfigurationShow(ctx context.Context, databaseID string) (DatabaseNetworkConfiguration, error) { + var res DatabaseNetworkConfigurationResponse + + err := c.parent.ScalingoAPI().SubresourceGetSingleton(ctx, databasesResource, databaseID, networkConfigurationResource, nil, &res) + if err != nil { + return DatabaseNetworkConfiguration{}, errors.Wrap(ctx, err, "show database network configuration") + } + + return res.NetworkConfiguration, nil +} diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/deployments.go b/vendor/github.com/Scalingo/go-scalingo/v11/deployments.go index d0cc2f521..cdeecc9c1 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/deployments.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/deployments.go @@ -153,7 +153,7 @@ func (c *Client) DeploymentList(ctx context.Context, app string) ([]*Deployment, func (c *Client) DeploymentListWithPagination(ctx context.Context, app string, paginationReq pagination.Request) ([]*Deployment, pagination.Meta, error) { var deployments DeploymentList - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "deployments", paginationReq.ToURLValues(), &deployments) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, deploymentsResource, paginationReq.ToURLValues(), &deployments) if err != nil { return []*Deployment{}, pagination.Meta{}, errors.Wrap(ctx, err, "list the deployments with pagination") } @@ -223,9 +223,9 @@ func (c *Client) DeploymentStream(ctx context.Context, deployURL string) (*webso func (c *Client) DeploymentsCreate(ctx context.Context, app string, params *DeploymentsCreateParams) (*Deployment, error) { var response *DeploymentsCreateRes req := &httpclient.APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/apps/" + app + "/deployments", - Expected: httpclient.Statuses{201}, + Expected: httpclient.Statuses{http.StatusCreated}, Params: map[string]any{ "deployment": params, }, @@ -242,8 +242,8 @@ func (c *Client) DeploymentsCreate(ctx context.Context, app string, params *Depl func (c *Client) DeploymentCacheReset(ctx context.Context, app string) error { req := &httpclient.APIRequest{ Endpoint: "/apps/" + app + "/caches/deployment", - Method: "DELETE", - Expected: httpclient.Statuses{204}, + Method: http.MethodDelete, + Expected: httpclient.Statuses{http.StatusNoContent}, } err := c.ScalingoAPI().DoRequest(ctx, req, nil) if err != nil { diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/domains.go b/vendor/github.com/Scalingo/go-scalingo/v11/domains.go index 0635a6299..82cf7f80d 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/domains.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/domains.go @@ -83,7 +83,7 @@ type DomainRes struct { func (c *Client) DomainsList(ctx context.Context, app string) ([]Domain, error) { var domainRes DomainsRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "domains", nil, &domainRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, domainsResource, nil, &domainRes) if err != nil { return nil, errors.Wrap(ctx, err, "list the domains") } @@ -100,7 +100,7 @@ type DomainsAddParams struct { func (c *Client) DomainsAdd(ctx context.Context, app string, params DomainsAddParams) (Domain, error) { var domainRes DomainRes - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "domains", map[string]DomainsAddParams{"domain": params}, &domainRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, domainsResource, map[string]DomainsAddParams{"domain": params}, &domainRes) if err != nil { return Domain{}, errors.Wrap(ctx, err, "add a domain") } @@ -108,13 +108,13 @@ func (c *Client) DomainsAdd(ctx context.Context, app string, params DomainsAddPa } func (c *Client) DomainsRemove(ctx context.Context, app, id string) error { - return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "domains", id) + return c.ScalingoAPI().SubresourceDelete(ctx, appsResource, app, domainsResource, id) } func (c *Client) DomainsShow(ctx context.Context, app, id string) (Domain, error) { var domainRes DomainRes - err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "domains", id, nil, &domainRes) + err := c.ScalingoAPI().SubresourceGet(ctx, appsResource, app, domainsResource, id, nil, &domainRes) if err != nil { return Domain{}, errors.Wrap(ctx, err, "show the domain") } @@ -131,7 +131,7 @@ type DomainsUpdateParams struct { func (c *Client) DomainsUpdate(ctx context.Context, app, id string, params DomainsUpdateParams) (Domain, error) { var domainRes DomainRes - err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "domains", id, map[string]DomainsUpdateParams{"domain": params}, &domainRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, appsResource, app, domainsResource, id, map[string]DomainsUpdateParams{"domain": params}, &domainRes) if err != nil { return Domain{}, errors.Wrap(ctx, err, "update the domain") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/env.go b/vendor/github.com/Scalingo/go-scalingo/v11/env.go index ba7db9359..2c5fca36b 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/env.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/env.go @@ -2,8 +2,9 @@ package scalingo import ( "context" + "net/http" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -52,7 +53,7 @@ func (c *Client) VariablesListWithoutAlias(ctx context.Context, app string) (Var func (c *Client) variableList(ctx context.Context, app string, aliases bool) (Variables, error) { var variablesRes VariablesRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "variables", map[string]bool{"aliases": aliases}, &variablesRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, variablesResource, map[string]bool{"aliases": aliases}, &variablesRes) if err != nil { return nil, errors.Wrap(ctx, err, "list app variables") } @@ -61,8 +62,8 @@ func (c *Client) variableList(ctx context.Context, app string, aliases bool) (Va func (c *Client) VariableSet(ctx context.Context, app string, name string, value string) (*Variable, error) { var variablesSetRes VariableSetParams - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "POST", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/apps/" + app + "/variables", Params: map[string]any{ "variable": map[string]string{ @@ -70,7 +71,7 @@ func (c *Client) VariableSet(ctx context.Context, app string, name string, value "value": value, }, }, - Expected: http.Statuses{200, 201}, + Expected: httpclient.Statuses{http.StatusOK, http.StatusCreated}, }, &variablesSetRes) if err != nil { return nil, errors.Wrap(ctx, err, "set app variable") @@ -81,13 +82,13 @@ func (c *Client) VariableSet(ctx context.Context, app string, name string, value func (c *Client) VariableMultipleSet(ctx context.Context, app string, variables Variables) (Variables, error) { var variabelsRes VariablesRes - req := &http.APIRequest{ + req := &httpclient.APIRequest{ Method: "PUT", Endpoint: "/apps/" + app + "/variables", Params: map[string]Variables{ "variables": variables, }, - Expected: http.Statuses{200, 201}, + Expected: httpclient.Statuses{http.StatusOK, http.StatusCreated}, } err := c.ScalingoAPI().DoRequest(ctx, req, &variabelsRes) if err != nil { @@ -98,5 +99,5 @@ func (c *Client) VariableMultipleSet(ctx context.Context, app string, variables } func (c *Client) VariableUnset(ctx context.Context, app string, id string) error { - return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "variables", id) + return c.ScalingoAPI().SubresourceDelete(ctx, appsResource, app, variablesResource, id) } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/events.go b/vendor/github.com/Scalingo/go-scalingo/v11/events.go index a202d0599..db13587f5 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/events.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/events.go @@ -29,7 +29,7 @@ type EventsRes struct { func (c *Client) EventsList(ctx context.Context, app string, paginationReq pagination.Request) (Events, pagination.Meta, error) { var eventsRes EventsRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "events", paginationReq.ToURLValues(), &eventsRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, eventsResource, paginationReq.ToURLValues(), &eventsRes) if err != nil { return nil, pagination.Meta{}, errors.Wrap(ctx, err, "list app events") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/events_app.go b/vendor/github.com/Scalingo/go-scalingo/v11/events_app.go index 474f794e6..106e37e84 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/events_app.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/events_app.go @@ -106,9 +106,8 @@ func (ev *EventTransferAppType) String() string { } type EventRestartTypeData struct { - Scope []string `json:"scope"` - AddonName string `json:"addon_name"` - Reason ContainerRestartReason `json:"reason"` + Scope []string `json:"scope"` + AddonName string `json:"addon_name"` } type EventRestartType struct { @@ -117,37 +116,11 @@ type EventRestartType struct { TypeData EventRestartTypeData `json:"type_data"` } -// ContainerRestartReason identifies the logical origin of a restart request -type ContainerRestartReason string - -const ( - ContainerRestartReasonUserRestart ContainerRestartReason = "user_restart" - ContainerRestartReasonUnexpectedFailure ContainerRestartReason = "unexpected_failure" - ContainerRestartReasonRebalancingOperation ContainerRestartReason = "rebalancing_operation" - ContainerRestartReasonSecurityMaintenance ContainerRestartReason = "security_maintenance" -) - func (ev *EventRestartType) String() string { - message := "containers began to restart" if len(ev.TypeData.Scope) != 0 { - message = fmt.Sprintf("containers %v began to restart", ev.TypeData.Scope) - } - if ev.TypeData.Reason != "" { - reason := ev.TypeData.Reason - switch ev.TypeData.Reason { - case ContainerRestartReasonUserRestart: - reason = "user restart" - case ContainerRestartReasonUnexpectedFailure: - reason = "unexpected failure" - case ContainerRestartReasonRebalancingOperation: - reason = "infrastructure rebalancing operation" - case ContainerRestartReasonSecurityMaintenance: - reason = "scheduled security maintenance" - } - - message = fmt.Sprintf("%s (reason: %s)", message, reason) + return fmt.Sprintf("containers %v began to restart", ev.TypeData.Scope) } - return message + return "containers began to restart" } func (ev *EventRestartType) Who() string { diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/firewall_rules.go b/vendor/github.com/Scalingo/go-scalingo/v11/firewall_rules.go index d154eaf7c..8cc0d6b4d 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/firewall_rules.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/firewall_rules.go @@ -2,13 +2,12 @@ package scalingo import ( "context" + "net/http" httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) -const firewallRulesResource = "firewall_rules" - type FirewallRuleType string const ( @@ -61,7 +60,7 @@ var _ FirewallRulesService = (*PreviewClient)(nil) func (c *PreviewClient) FirewallRulesCreate(ctx context.Context, appID string, addonID string, params FirewallRuleCreateParams) (FirewallRule, error) { var res FirewallRuleResponse - err := c.parent.DBAPI(appID, addonID).SubresourceAdd(ctx, "databases", addonID, firewallRulesResource, params, &res) + err := c.parent.DBAPI(appID, addonID).SubresourceAdd(ctx, databasesResource, addonID, firewallRulesResource, params, &res) if err != nil { return res.FirewallRule, errors.Wrap(ctx, err, "create firewall rule") } @@ -71,7 +70,7 @@ func (c *PreviewClient) FirewallRulesCreate(ctx context.Context, appID string, a func (c *PreviewClient) FirewallRulesList(ctx context.Context, appID string, addonID string) ([]FirewallRule, error) { var res FirewallRulesResponse - err := c.parent.DBAPI(appID, addonID).SubresourceList(ctx, "databases", addonID, firewallRulesResource, nil, &res) + err := c.parent.DBAPI(appID, addonID).SubresourceList(ctx, databasesResource, addonID, firewallRulesResource, nil, &res) if err != nil { return nil, errors.Wrap(ctx, err, "list firewall rules") } @@ -80,7 +79,7 @@ func (c *PreviewClient) FirewallRulesList(ctx context.Context, appID string, add } func (c *PreviewClient) FirewallRulesDestroy(ctx context.Context, appID string, addonID string, firewallRuleID string) error { - err := c.parent.DBAPI(appID, addonID).SubresourceDelete(ctx, "databases", addonID, firewallRulesResource, firewallRuleID) + err := c.parent.DBAPI(appID, addonID).SubresourceDelete(ctx, databasesResource, addonID, firewallRulesResource, firewallRuleID) if err != nil { return errors.Wrap(ctx, err, "destroy firewall rule") } @@ -91,7 +90,7 @@ func (c *PreviewClient) FirewallRulesGetManagedRanges(ctx context.Context, appID var res FirewallManagedRangesResponse req := &httpclient.APIRequest{ - Method: "GET", + Method: http.MethodGet, Endpoint: "/firewall/managed_ranges", } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/http/api_request.go b/vendor/github.com/Scalingo/go-scalingo/v11/http/api_request.go index 63a842729..74b9b0898 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/http/api_request.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/http/api_request.go @@ -35,10 +35,10 @@ type Statuses []int func (c *client) fillDefaultValues(ctx context.Context, req *APIRequest) error { if req.Method == "" { - req.Method = "GET" + req.Method = http.MethodGet } if len(req.Expected) == 0 { - req.Expected = Statuses{200} + req.Expected = Statuses{http.StatusOK} } if req.Params == nil { req.Params = make(map[string]any) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/http/client.go b/vendor/github.com/Scalingo/go-scalingo/v11/http/client.go index 44f8a41ae..116de2092 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/http/client.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/http/client.go @@ -24,6 +24,7 @@ type Client interface { SubresourceList(ctx context.Context, resource, resourceID, subresource string, payload, data any) error SubresourceAdd(ctx context.Context, resource, resourceID, subresource string, payload, data any) error SubresourceGet(ctx context.Context, resource, resourceID, subresource, id string, payload, data any) error + SubresourceGetSingleton(ctx context.Context, resource, resourceID, subresource string, payload, data any) error SubresourceUpdate(ctx context.Context, resource, resourceID, subresource, id string, payload, data any) error SubresourceDelete(ctx context.Context, resource, resourceID, subresource, id string) error DoRequest(ctx context.Context, req *APIRequest, data any) error @@ -84,7 +85,7 @@ func NewClient(cfg ClientConfig) Client { func (c *client) ResourceGet(ctx context.Context, resource, resourceID string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "GET", + Method: http.MethodGet, Endpoint: "/" + resource + "/" + resourceID, Params: payload, }, data) @@ -92,7 +93,7 @@ func (c *client) ResourceGet(ctx context.Context, resource, resourceID string, p func (c *client) ResourceList(ctx context.Context, resource string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "GET", + Method: http.MethodGet, Endpoint: "/" + resource, Params: payload, }, data) @@ -100,7 +101,7 @@ func (c *client) ResourceList(ctx context.Context, resource string, payload, dat func (c *client) ResourceAdd(ctx context.Context, resource string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/" + resource, Expected: Statuses{http.StatusCreated}, Params: payload, @@ -109,7 +110,7 @@ func (c *client) ResourceAdd(ctx context.Context, resource string, payload, data func (c client) ResourceUpdate(ctx context.Context, resource, resourceID string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "PATCH", + Method: http.MethodPatch, Endpoint: "/" + resource + "/" + resourceID, Params: payload, }, data) @@ -117,7 +118,7 @@ func (c client) ResourceUpdate(ctx context.Context, resource, resourceID string, func (c *client) ResourceDelete(ctx context.Context, resource, resourceID string) error { return c.DoRequest(ctx, &APIRequest{ - Method: "DELETE", + Method: http.MethodDelete, Endpoint: "/" + resource + "/" + resourceID, Expected: Statuses{http.StatusNoContent}, }, nil) @@ -125,15 +126,23 @@ func (c *client) ResourceDelete(ctx context.Context, resource, resourceID string func (c *client) SubresourceGet(ctx context.Context, resource, resourceID, subresource, id string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "GET", + Method: http.MethodGet, Endpoint: "/" + resource + "/" + resourceID + "/" + subresource + "/" + id, Params: payload, }, data) } +func (c *client) SubresourceGetSingleton(ctx context.Context, resource, resourceID, subresource string, payload, data any) error { + return c.DoRequest(ctx, &APIRequest{ + Method: http.MethodGet, + Endpoint: "/" + resource + "/" + resourceID + "/" + subresource, + Params: payload, + }, data) +} + func (c *client) SubresourceList(ctx context.Context, resource, resourceID, subresource string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "GET", + Method: http.MethodGet, Endpoint: "/" + resource + "/" + resourceID + "/" + subresource, Params: payload, }, data) @@ -141,7 +150,7 @@ func (c *client) SubresourceList(ctx context.Context, resource, resourceID, subr func (c *client) SubresourceAdd(ctx context.Context, resource, resourceID, subresource string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "POST", + Method: http.MethodPost, Endpoint: "/" + resource + "/" + resourceID + "/" + subresource, Expected: Statuses{http.StatusCreated}, Params: payload, @@ -150,7 +159,7 @@ func (c *client) SubresourceAdd(ctx context.Context, resource, resourceID, subre func (c *client) SubresourceDelete(ctx context.Context, resource, resourceID, subresource, id string) error { return c.DoRequest(ctx, &APIRequest{ - Method: "DELETE", + Method: http.MethodDelete, Endpoint: "/" + resource + "/" + resourceID + "/" + subresource + "/" + id, Expected: Statuses{http.StatusNoContent}, }, nil) @@ -158,7 +167,7 @@ func (c *client) SubresourceDelete(ctx context.Context, resource, resourceID, su func (c *client) SubresourceUpdate(ctx context.Context, resource, resourceID, subresource, id string, payload, data any) error { return c.DoRequest(ctx, &APIRequest{ - Method: "PATCH", + Method: http.MethodPatch, Endpoint: "/" + resource + "/" + resourceID + "/" + subresource + "/" + id, Params: payload, }, data) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/http/httpmock/client_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/http/httpmock/client_mock.go index 68fc9ff5f..1bf26a460 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/http/httpmock/client_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/http/httpmock/client_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11/http (interfaces: Client) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/http/httpmock/client_mock.go -package httpmock github.com/Scalingo/go-scalingo/v11/http Client -// // Package httpmock is a generated GoMock package. package httpmock @@ -225,6 +220,20 @@ func (mr *MockClientMockRecorder) SubresourceGet(ctx, resource, resourceID, subr return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceGet", reflect.TypeOf((*MockClient)(nil).SubresourceGet), ctx, resource, resourceID, subresource, id, payload, data) } +// SubresourceGetSingleton mocks base method. +func (m *MockClient) SubresourceGetSingleton(ctx context.Context, resource, resourceID, subresource string, payload, data any) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubresourceGetSingleton", ctx, resource, resourceID, subresource, payload, data) + ret0, _ := ret[0].(error) + return ret0 +} + +// SubresourceGetSingleton indicates an expected call of SubresourceGetSingleton. +func (mr *MockClientMockRecorder) SubresourceGetSingleton(ctx, resource, resourceID, subresource, payload, data any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubresourceGetSingleton", reflect.TypeOf((*MockClient)(nil).SubresourceGetSingleton), ctx, resource, resourceID, subresource, payload, data) +} + // SubresourceList mocks base method. func (m *MockClient) SubresourceList(ctx context.Context, resource, resourceID, subresource string, payload, data any) error { m.ctrl.T.Helper() diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/log_drains.go b/vendor/github.com/Scalingo/go-scalingo/v11/log_drains.go index 29fcb223d..2106b30e1 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/log_drains.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/log_drains.go @@ -34,7 +34,7 @@ type LogDrainsRes struct { func (c *Client) LogDrainsList(ctx context.Context, app string) ([]LogDrain, error) { var logDrainsRes LogDrainsRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "log_drains", nil, &logDrainsRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, logDrainsResource, nil, &logDrainsRes) if err != nil { return nil, errors.Wrap(ctx, err, "list the log drains") } @@ -44,7 +44,7 @@ func (c *Client) LogDrainsList(ctx context.Context, app string) ([]LogDrain, err func (c *Client) LogDrainsAddonList(ctx context.Context, app string, addonID string) ([]LogDrain, error) { var logDrainsRes LogDrainsRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "addons/"+addonID+"/log_drains", nil, &logDrainsRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, addonsResource+"/"+addonID+"/"+logDrainsResource, nil, &logDrainsRes) if err != nil { return nil, errors.Wrapf(ctx, err, "list the log drains of the addon %s", addonID) } @@ -70,7 +70,7 @@ func (c *Client) LogDrainAdd(ctx context.Context, app string, params LogDrainAdd Drain: params, } - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "log_drains", payload, &logDrainRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, logDrainsResource, payload, &logDrainRes) if err != nil { return nil, errors.Wrap(ctx, err, "add drain") } @@ -84,7 +84,7 @@ func (c *Client) LogDrainRemove(ctx context.Context, app, URL string) error { } req := &httpclient.APIRequest{ - Method: "DELETE", + Method: http.MethodDelete, Endpoint: "/apps/" + app + "/log_drains", Expected: httpclient.Statuses{http.StatusNoContent}, Params: payload, @@ -104,7 +104,7 @@ func (c *Client) LogDrainAddonRemove(ctx context.Context, app, addonID string, U } req := &httpclient.APIRequest{ - Method: "DELETE", + Method: http.MethodDelete, Endpoint: "/apps/" + app + "/addons/" + addonID + "/log_drains", Expected: httpclient.Statuses{http.StatusNoContent}, Params: payload, @@ -124,7 +124,7 @@ func (c *Client) LogDrainAddonAdd(ctx context.Context, app string, addonID strin Drain: params, } - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "addons/"+addonID+"/log_drains", payload, &logDrainRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, addonsResource+"/"+addonID+"/"+logDrainsResource, payload, &logDrainRes) if err != nil { return nil, errors.Wrapf(ctx, err, "add log drain to the addon %s", addonID) } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/logs.go b/vendor/github.com/Scalingo/go-scalingo/v11/logs.go index 54de0c605..e84a7858e 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/logs.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/logs.go @@ -4,6 +4,7 @@ import ( "context" stderrors "errors" "io" + "net/http" "net/url" httpclient "github.com/Scalingo/go-scalingo/v11/http" @@ -26,7 +27,7 @@ type LogsURLRes struct { func (c *Client) LogsURL(ctx context.Context, app string) (*LogsURLRes, error) { var logsURLRes LogsURLRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "logs", nil, &logsURLRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, logsResource, nil, &logsURLRes) if err != nil { return nil, errors.Wrap(ctx, err, "get app logs URL") } @@ -43,7 +44,7 @@ func (c *Client) Logs(ctx context.Context, logsURL string, n int, filter string) } req := &httpclient.APIRequest{ NoAuth: true, - Expected: httpclient.Statuses{200, 204, 404}, + Expected: httpclient.Statuses{http.StatusOK, http.StatusNoContent, http.StatusNotFound}, URL: u.Scheme + "://" + u.Host, Endpoint: u.Path, Params: map[string]any{ @@ -58,7 +59,7 @@ func (c *Client) Logs(ctx context.Context, logsURL string, n int, filter string) return nil, errors.Wrap(ctx, err, "request Scalingo API to get the application logs") } - if res.StatusCode == 404 || res.StatusCode == 204 { + if res.StatusCode == http.StatusNotFound || res.StatusCode == http.StatusNoContent { return nil, ErrNoLogs } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/maintenance.go b/vendor/github.com/Scalingo/go-scalingo/v11/maintenance.go index b50b60bf8..9af083cac 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/maintenance.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/maintenance.go @@ -63,7 +63,7 @@ type ListMaintenanceResponse struct { func (c *Client) DatabaseListMaintenance(ctx context.Context, app, addonID string, paginationReq pagination.Request) ([]*Maintenance, pagination.Meta, error) { var maintenanceRes ListMaintenanceResponse - err := c.DBAPI(app, addonID).SubresourceList(ctx, "databases", addonID, "maintenance", paginationReq.ToURLValues(), &maintenanceRes) + err := c.DBAPI(app, addonID).SubresourceList(ctx, databasesResource, addonID, maintenanceResource, paginationReq.ToURLValues(), &maintenanceRes) if err != nil { return nil, pagination.Meta{}, errors.Wrapf(ctx, err, "list database '%v' maintenance", addonID) } @@ -72,7 +72,7 @@ func (c *Client) DatabaseListMaintenance(ctx context.Context, app, addonID strin func (c *Client) DatabaseShowMaintenance(ctx context.Context, app, addonID, maintenanceID string) (Maintenance, error) { var maintenanceRes Maintenance - err := c.DBAPI(app, addonID).SubresourceGet(ctx, "databases", addonID, "maintenance", maintenanceID, nil, &maintenanceRes) + err := c.DBAPI(app, addonID).SubresourceGet(ctx, databasesResource, addonID, maintenanceResource, maintenanceID, nil, &maintenanceRes) if err != nil { return maintenanceRes, errors.Wrapf(ctx, err, "get database '%v' maintenance", addonID) } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/mocks.json b/vendor/github.com/Scalingo/go-scalingo/v11/mocks.json index c0a2fe7e0..02086eddd 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/mocks.json +++ b/vendor/github.com/Scalingo/go-scalingo/v11/mocks.json @@ -1,5 +1,4 @@ { - "base_directory": "github.com/Scalingo/go-scalingo", "base_package": "github.com/Scalingo/go-scalingo/v11", "mocks": [ { diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/mocks_sig.json b/vendor/github.com/Scalingo/go-scalingo/v11/mocks_sig.json index 58315b9ca..0be65e8ed 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/mocks_sig.json +++ b/vendor/github.com/Scalingo/go-scalingo/v11/mocks_sig.json @@ -1,34 +1,34 @@ { - "github.com/Scalingo/go-scalingo.API": "FORCE_REGENERATE", - "github.com/Scalingo/go-scalingo.AddonProvidersService": "f0 56 1c c9 ae 9b 6e a5 2f 98 fa 72 1f a2 f0 e6 a7 23 b4 4c", - "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": "22 f1 ba 14 dd 25 00 06 c4 2e 51 66 16 a1 15 3c ed 86 8b 93", - "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": "c9 3a 93 de 00 2d e8 87 9c cc bd 3f f0 0e a1 48 78 a4 d7 3a", - "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.DatabasesService": "7c 84 0b 87 60 d6 b9 c7 3a a9 53 d2 3a 1c b4 e4 46 f1 83 28", - "github.com/Scalingo/go-scalingo.DeploymentsService": "e1 c5 95 e5 0e 4d db 1e ec 9a 83 d8 e5 41 cc 24 ce f6 ea ba", - "github.com/Scalingo/go-scalingo.DomainsService": "b5 19 0f 10 5b f2 48 74 c6 c2 7b 27 7d 3b b8 ff 10 80 b3 6f", - "github.com/Scalingo/go-scalingo.EventsService": "13 7a 12 83 bf 3f 84 49 dc db 64 c3 d5 e8 4a c0 08 8c 78 f6", - "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.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": "8e ec dc 9f 21 7e 20 d8 76 25 a4 92 4f 25 58 e0 a3 7d f0 20", - "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.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": "9c 37 58 d7 9c c1 04 6c 3d 33 32 f4 4d bd 25 47 33 7a 9c e9", - "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": "8c d1 eb bc dc ab a9 7e 98 c5 8e 58 03 63 1f 35 5b f4 e6 2a", - "github.com/Scalingo/go-scalingo/http.Client": "26 26 d6 21 12 7a b4 88 dc 46 fe 51 21 d6 00 94 94 a1 7f 89", - "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" + "..API": "FORCE_REGENERATE", + "..AddonProvidersService": "f0 56 1c c9 ae 9b 6e a5 2f 98 fa 72 1f a2 f0 e6 a7 23 b4 4c", + "..AddonsService": "e5 fd 9a 36 39 fc 08 7d 37 ef 0d a9 5c a5 ba dc 53 db e8 39", + "..AlertsService": "31 44 7d d3 3f 5b 0b 61 26 03 79 65 a2 16 77 a1 66 66 e8 05", + "..AppsService": "22 f1 ba 14 dd 25 00 06 c4 2e 51 66 16 a1 15 3c ed 86 8b 93", + "..AutoscalersService": "9f cf 1b 7a dc 9d e3 d3 62 89 41 0f d4 30 83 28 7b 40 f1 72", + "..BackupsService": "66 59 74 49 68 65 69 e4 b0 97 8e a2 45 e6 ff fc 71 85 06 16", + "..CollaboratorsService": "c9 3a 93 de 00 2d e8 87 9c cc bd 3f f0 0e a1 48 78 a4 d7 3a", + "..ContainerSizesService": "e2 db 25 a1 01 52 dc e9 6f 7b f4 59 68 95 86 b9 5e 39 8a 61", + "..ContainersService": "ef 14 ae 81 c9 b4 6a 13 48 e8 bf 44 7d b5 b2 a6 4d e5 02 11", + "..CronTasksService": "9b d9 a3 ca 9f 9a f7 73 cb b1 aa 80 df 90 21 ff 14 92 b4 4d", + "..DatabasesService": "7c 84 0b 87 60 d6 b9 c7 3a a9 53 d2 3a 1c b4 e4 46 f1 83 28", + "..DeploymentsService": "e1 c5 95 e5 0e 4d db 1e ec 9a 83 d8 e5 41 cc 24 ce f6 ea ba", + "..DomainsService": "b5 19 0f 10 5b f2 48 74 c6 c2 7b 27 7d 3b b8 ff 10 80 b3 6f", + "..EventsService": "13 7a 12 83 bf 3f 84 49 dc db 64 c3 d5 e8 4a c0 08 8c 78 f6", + "..KeysService": "b9 5f 5d 8e 88 9d db 82 d6 69 e5 bd 94 6c 7e 08 14 69 23 48", + "..LogDrainsService": "d4 05 d0 5e a7 7f b7 3e 58 19 07 8d 25 c5 af ca dc d3 6e d9", + "..LogsArchivesService": "35 b6 c3 7b 41 1a 47 5c 3c df ab a6 d6 93 1e 6e b1 b1 f9 11", + "..LogsService": "8e ec dc 9f 21 7e 20 d8 76 25 a4 92 4f 25 58 e0 a3 7d f0 20", + "..NotificationPlatformsService": "9b a8 93 13 ed 36 09 92 be dc cb 95 17 02 93 28 18 53 ae 01", + "..NotifiersService": "b7 82 f2 c1 a1 81 70 05 ed 5a 65 c0 56 13 de 6e 2c 13 ca 1f", + "..OperationsService": "28 1a bc 62 4c bd 9f e2 ef 45 90 7f 0d 82 5f 30 23 07 93 2a", + "..RegionsService": "bc d0 b0 22 5b 7c df 31 02 b7 b3 4d 1f b4 9a 88 a2 7c 8a 6a", + "..RunsService": "b3 27 40 57 21 c2 64 f8 08 89 c9 0e 06 45 0d 1b ff 5b 5a 45", + "..SCMRepoLinkService": "9c 37 58 d7 9c c1 04 6c 3d 33 32 f4 4d bd 25 47 33 7a 9c e9", + "..SignUpService": "ae 46 80 88 8e b6 bd c3 ea d9 2c e5 d4 b5 37 ac a9 e8 4f cf", + "..SourcesService": "05 1f 06 73 0a 43 2a 6a 35 d2 b9 41 d2 be 8e 7c ad b0 63 3e", + "..TokensService": "32 2d 05 42 b4 9c a9 3b 1b 6c ce 0e da 18 cf 6f 8f cb fc 2a", + "..UsersService": "9e c5 75 1e aa 05 dd a7 a3 17 5f 4e 82 80 e2 34 55 a2 70 df", + "..VariablesService": "8c d1 eb bc dc ab a9 7e 98 c5 8e 58 03 63 1f 35 5b f4 e6 2a", + "http.Client": "cd 64 72 49 80 46 82 9f ff f0 be a7 a7 36 95 10 ae 84 09 39", + "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/vendor/github.com/Scalingo/go-scalingo/v11/notifiers.go b/vendor/github.com/Scalingo/go-scalingo/v11/notifiers.go index bec14089a..02f9ed405 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/notifiers.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/notifiers.go @@ -68,7 +68,7 @@ type notifiersRequestRes struct { func (c *Client) NotifiersList(ctx context.Context, app string) (Notifiers, error) { var notifiersRes notifiersRequestRes - err := c.ScalingoAPI().SubresourceList(ctx, "apps", app, "notifiers", nil, ¬ifiersRes) + err := c.ScalingoAPI().SubresourceList(ctx, appsResource, app, notifiersResource, nil, ¬ifiersRes) if err != nil { return nil, errors.Wrap(ctx, err, "list notifiers") } @@ -84,7 +84,7 @@ func (c *Client) NotifierProvision(ctx context.Context, app string, params Notif notifier := newOutputNotifier(params) notifierRequestParams := ¬ifierRequestParams{notifier} - err := c.ScalingoAPI().SubresourceAdd(ctx, "apps", app, "notifiers", notifierRequestParams, ¬ifierRes) + err := c.ScalingoAPI().SubresourceAdd(ctx, appsResource, app, notifiersResource, notifierRequestParams, ¬ifierRes) if err != nil { return nil, errors.Wrap(ctx, err, "provision notifier") @@ -94,7 +94,7 @@ func (c *Client) NotifierProvision(ctx context.Context, app string, params Notif func (c *Client) NotifierByID(ctx context.Context, app, ID string) (*Notifier, error) { var notifierRes notifierRequestRes - err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "notifiers", ID, nil, ¬ifierRes) + err := c.ScalingoAPI().SubresourceGet(ctx, appsResource, app, notifiersResource, ID, nil, ¬ifierRes) if err != nil { return nil, errors.Wrap(ctx, err, "show notifier") } @@ -109,7 +109,7 @@ func (c *Client) NotifierUpdate(ctx context.Context, app, ID string, params Noti debug.Printf("[Notifier params]\n%+v", notifier) - err := c.ScalingoAPI().SubresourceUpdate(ctx, "apps", app, "notifiers", ID, notifierRequestParams, ¬ifierRes) + err := c.ScalingoAPI().SubresourceUpdate(ctx, appsResource, app, notifiersResource, ID, notifierRequestParams, ¬ifierRes) if err != nil { return nil, errors.Wrap(ctx, err, "update notifier") } @@ -117,5 +117,5 @@ func (c *Client) NotifierUpdate(ctx context.Context, app, ID string, params Noti } func (c *Client) NotifierDestroy(ctx context.Context, app, ID string) error { - return c.ScalingoAPI().SubresourceDelete(ctx, "apps", app, "notifiers", ID) + return c.ScalingoAPI().SubresourceDelete(ctx, appsResource, app, notifiersResource, ID) } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/operations.go b/vendor/github.com/Scalingo/go-scalingo/v11/operations.go index bf78090ad..1f67be860 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/operations.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/operations.go @@ -2,6 +2,7 @@ package scalingo import ( "context" + "net/http" "time" httpclient "github.com/Scalingo/go-scalingo/v11/http" @@ -58,7 +59,7 @@ func (op *Operation) ElapsedDuration() float64 { func (c *Client) OperationsShowFromURL(ctx context.Context, url string) (*Operation, error) { var opRes OperationResponse err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ - Method: "GET", URL: url, + Method: http.MethodGet, URL: url, }, &opRes) if err != nil { return nil, errors.Wrap(ctx, err, "show operation from URL") @@ -68,7 +69,7 @@ func (c *Client) OperationsShowFromURL(ctx context.Context, url string) (*Operat func (c *Client) OperationsShow(ctx context.Context, app, opID string) (*Operation, error) { var opRes OperationResponse - err := c.ScalingoAPI().SubresourceGet(ctx, "apps", app, "operations", opID, nil, &opRes) + err := c.ScalingoAPI().SubresourceGet(ctx, appsResource, app, operationsResource, opID, nil, &opRes) if err != nil { return nil, errors.Wrap(ctx, err, "show operation") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/privatenetworks.go b/vendor/github.com/Scalingo/go-scalingo/v11/privatenetworks.go index a1327de40..0bd147433 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/privatenetworks.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/privatenetworks.go @@ -33,7 +33,7 @@ func (c *Client) PrivateNetworksDomainsList(ctx context.Context, app string, pag var domainRes PrivateNetworkDomainsRes err := c.ScalingoAPI().SubresourceList(ctx, - "apps", app, "private_network_domain_names", paginationReq.ToURLValues(), + appsResource, app, privateNetworkDomainNamesResource, paginationReq.ToURLValues(), &domainRes, ) if err != nil { diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/projects.go b/vendor/github.com/Scalingo/go-scalingo/v11/projects.go index 2af04ada2..08714cebc 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/projects.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/projects.go @@ -7,8 +7,6 @@ import ( "github.com/Scalingo/go-utils/errors/v3" ) -const projectResource = "projects" - type ProjectsService interface { ProjectsList(ctx context.Context) ([]Project, error) ProjectAdd(ctx context.Context, params ProjectAddParams) (Project, error) @@ -118,7 +116,7 @@ func (c *Client) ProjectDelete(ctx context.Context, projectID string) error { func (c *Client) ProjectPrivateNetworkGet(ctx context.Context, projectID string) (ProjectPrivateNetwork, error) { var privateNetwork ProjectPrivateNetwork - err := c.ScalingoAPI().SubresourceList(ctx, projectResource, projectID, "private_network", nil, &privateNetwork) + err := c.ScalingoAPI().SubresourceList(ctx, projectResource, projectID, privateNetworkResource, nil, &privateNetwork) if err != nil { return ProjectPrivateNetwork{}, errors.Wrap(ctx, err, "get project private network") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/regions.go b/vendor/github.com/Scalingo/go-scalingo/v11/regions.go index 9568f3228..f348e5d1b 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/regions.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/regions.go @@ -3,9 +3,10 @@ package scalingo import ( "context" stderrors "errors" + "net/http" "sync" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -36,8 +37,8 @@ type regionsRes struct { func (c *Client) RegionsList(ctx context.Context) ([]Region, error) { var res regionsRes - err := c.AuthAPI().DoRequest(ctx, &http.APIRequest{ - Method: "GET", + err := c.AuthAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodGet, Endpoint: "/regions", }, &res) if err != nil { diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/resources.go b/vendor/github.com/Scalingo/go-scalingo/v11/resources.go deleted file mode 100644 index 48aab9520..000000000 --- a/vendor/github.com/Scalingo/go-scalingo/v11/resources.go +++ /dev/null @@ -1,6 +0,0 @@ -package scalingo - -const ( - databasesResource = "databases" - usersResource = "users" -) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/run.go b/vendor/github.com/Scalingo/go-scalingo/v11/run.go index 588f99ab0..98369fa55 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/run.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/run.go @@ -2,9 +2,10 @@ package scalingo import ( "context" + "net/http" "strings" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -26,13 +27,13 @@ type RunOpts struct { type RunRes struct { Container *Container `json:"container"` AttachURL string `json:"attach_url"` - OperationURL string `json:"operation_url"` + OperationURL string `json:"-"` } func (c *Client) Run(ctx context.Context, opts RunOpts) (*RunRes, error) { var runRes RunRes - req := &http.APIRequest{ - Method: "POST", + req := &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/apps/" + opts.App + "/run", Params: map[string]any{ "command": strings.Join(opts.Command, " "), diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonprovidersservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonprovidersservice_mock.go index ca4d6c2b0..7897b118f 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonprovidersservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonprovidersservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: AddonProvidersService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/addonprovidersservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 AddonProvidersService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonsservice_mock.go index 580072272..de2b013db 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/addonsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: AddonsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/addonsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 AddonsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/alertsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/alertsservice_mock.go index 0270c475f..428ca2940 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/alertsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/alertsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: AlertsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/alertsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 AlertsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/api_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/api_mock.go index d612ea672..c66d95647 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/api_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/api_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: API) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/api_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 API -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/appsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/appsservice_mock.go index b24022ab7..ae3d36436 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/appsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/appsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: AppsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/appsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 AppsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/autoscalersservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/autoscalersservice_mock.go index 276a94a54..a64e04eb8 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/autoscalersservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/autoscalersservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: AutoscalersService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/autoscalersservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 AutoscalersService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/backupsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/backupsservice_mock.go index b48387f12..fa763d88a 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/backupsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/backupsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: BackupsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/backupsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 BackupsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/collaboratorsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/collaboratorsservice_mock.go index 85ba734ff..528bc209b 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/collaboratorsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/collaboratorsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: CollaboratorsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/collaboratorsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 CollaboratorsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersizesservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersizesservice_mock.go index ccd88542d..23ee2f4ac 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersizesservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersizesservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: ContainerSizesService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/containersizesservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 ContainerSizesService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersservice_mock.go index c89f76604..cc595ca22 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/containersservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: ContainersService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/containersservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 ContainersService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/crontasksservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/crontasksservice_mock.go index 471c1d754..2090bcf46 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/crontasksservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/crontasksservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: CronTasksService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/crontasksservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 CronTasksService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/databasesservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/databasesservice_mock.go index 2328822b5..d573286ec 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/databasesservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/databasesservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: DatabasesService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/databasesservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 DatabasesService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/deploymentsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/deploymentsservice_mock.go index e47fdaa67..7c5d13206 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/deploymentsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/deploymentsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: DeploymentsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/deploymentsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 DeploymentsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/domainsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/domainsservice_mock.go index 9f21b7e3d..6d8b28a76 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/domainsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/domainsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: DomainsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/domainsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 DomainsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/eventsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/eventsservice_mock.go index 0c5195ed5..1c99d6b71 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/eventsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/eventsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: EventsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/eventsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 EventsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/keysservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/keysservice_mock.go index c0236d6ea..3050b2d52 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/keysservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/keysservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: KeysService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/keysservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 KeysService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logdrainsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logdrainsservice_mock.go index f7463fa29..710bc75f2 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logdrainsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logdrainsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: LogDrainsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/logdrainsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 LogDrainsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsarchivesservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsarchivesservice_mock.go index 2b91cb084..d73fb4085 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsarchivesservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsarchivesservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: LogsArchivesService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/logsarchivesservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 LogsArchivesService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsservice_mock.go index 581293359..d5e3a42f0 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/logsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: LogsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/logsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 LogsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notificationplatformsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notificationplatformsservice_mock.go index 49094388d..26ebcb3d5 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notificationplatformsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notificationplatformsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: NotificationPlatformsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/notificationplatformsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 NotificationPlatformsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notifiersservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notifiersservice_mock.go index 89d48851d..5aa04c056 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notifiersservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/notifiersservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: NotifiersService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/notifiersservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 NotifiersService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/operationsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/operationsservice_mock.go index 7e2d255a0..56205f9a9 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/operationsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/operationsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: OperationsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/operationsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 OperationsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/regionsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/regionsservice_mock.go index ef624da9f..2bd544799 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/regionsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/regionsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: RegionsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/regionsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 RegionsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/runsservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/runsservice_mock.go index 50d07fd51..3d975fbbc 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/runsservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/runsservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: RunsService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/runsservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 RunsService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/scmrepolinkservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/scmrepolinkservice_mock.go index e1e6363eb..d5be94281 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/scmrepolinkservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/scmrepolinkservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: SCMRepoLinkService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/scmrepolinkservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 SCMRepoLinkService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/signupservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/signupservice_mock.go index c0cb44fc2..365a410ad 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/signupservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/signupservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: SignUpService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/signupservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 SignUpService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/sourcesservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/sourcesservice_mock.go index 3cfbb4976..021cebb70 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/sourcesservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/sourcesservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: SourcesService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/sourcesservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 SourcesService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/tokensservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/tokensservice_mock.go index 73586a2fc..bd1f2a5f4 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/tokensservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/tokensservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: TokensService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/tokensservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 TokensService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/usersservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/usersservice_mock.go index dcee44583..ea55d6680 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/usersservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/usersservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: UsersService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/usersservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 UsersService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/variablesservice_mock.go b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/variablesservice_mock.go index a13d41b28..c91140ffd 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/variablesservice_mock.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scalingomock/variablesservice_mock.go @@ -1,10 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/Scalingo/go-scalingo/v11 (interfaces: VariablesService) -// -// Generated by this command: -// -// mockgen --build_flags=--mod=mod -destination /home/etienne/Documents/Scalingo/golang/src/github.com/Scalingo/go-scalingo/scalingomock/variablesservice_mock.go -package scalingomock github.com/Scalingo/go-scalingo/v11 VariablesService -// // Package scalingomock is a generated GoMock package. package scalingomock diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scm_integrations.go b/vendor/github.com/Scalingo/go-scalingo/v11/scm_integrations.go index 5f20b1d07..2a8de3feb 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scm_integrations.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scm_integrations.go @@ -2,9 +2,10 @@ package scalingo import ( "context" + "net/http" "time" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -118,11 +119,11 @@ func (c *Client) SCMIntegrationsDelete(ctx context.Context, id string) error { func (c *Client) SCMIntegrationsImportKeys(ctx context.Context, id string) ([]Key, error) { var res KeysRes - var err = c.AuthAPI().DoRequest(ctx, &http.APIRequest{ - Method: "POST", + var err = c.AuthAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/scm_integrations/" + id + "/import_keys", Params: nil, - Expected: http.Statuses{201}, + Expected: httpclient.Statuses{http.StatusCreated}, }, &res) if err != nil { return nil, errors.Wrap(ctx, err, "import ssh keys from this SCM integration") diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/scm_repo_link.go b/vendor/github.com/Scalingo/go-scalingo/v11/scm_repo_link.go index 1e2238340..23ec5409c 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/scm_repo_link.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/scm_repo_link.go @@ -3,9 +3,10 @@ package scalingo import ( "context" "fmt" + "net/http" "time" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" "github.com/Scalingo/go-utils/pagination" ) @@ -126,10 +127,10 @@ func (c *Client) SCMRepoLinkList(ctx context.Context, paginationReq pagination.R func (c *Client) SCMRepoLinkShow(ctx context.Context, app string) (*SCMRepoLink, error) { var res ScmRepoLinkResponse - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "GET", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodGet, Endpoint: "/apps/" + app + "/scm_repo_link", - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, }, &res) if err != nil { return nil, errors.Wrap(ctx, err, "get this SCM repo link") @@ -139,10 +140,10 @@ func (c *Client) SCMRepoLinkShow(ctx context.Context, app string) (*SCMRepoLink, func (c *Client) SCMRepoLinkCreate(ctx context.Context, app string, params SCMRepoLinkCreateParams) (*SCMRepoLink, error) { var res ScmRepoLinkResponse - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "POST", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/apps/" + app + "/scm_repo_link", - Expected: http.Statuses{201}, + Expected: httpclient.Statuses{http.StatusCreated}, Params: map[string]SCMRepoLinkCreateParams{"scm_repo_link": params}, }, &res) if err != nil { @@ -154,10 +155,10 @@ func (c *Client) SCMRepoLinkCreate(ctx context.Context, app string, params SCMRe func (c *Client) SCMRepoLinkUpdate(ctx context.Context, app string, params SCMRepoLinkUpdateParams) (*SCMRepoLink, error) { var res ScmRepoLinkResponse - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "PATCH", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodPatch, Endpoint: "/apps/" + app + "/scm_repo_link", - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, Params: map[string]SCMRepoLinkUpdateParams{"scm_repo_link": params}, }, &res) if err != nil { @@ -168,10 +169,10 @@ func (c *Client) SCMRepoLinkUpdate(ctx context.Context, app string, params SCMRe } func (c *Client) SCMRepoLinkDelete(ctx context.Context, app string) error { - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "DELETE", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodDelete, Endpoint: "/apps/" + app + "/scm_repo_link", - Expected: http.Statuses{204}, + Expected: httpclient.Statuses{http.StatusNoContent}, }, nil) if err != nil { return errors.Wrap(ctx, err, "delete this SCM repo link") @@ -182,10 +183,10 @@ func (c *Client) SCMRepoLinkDelete(ctx context.Context, app string) error { func (c *Client) SCMRepoLinkPullRequest(ctx context.Context, app string, number int) (*RepoLinkPullRequest, error) { var res SCMRepoLinkPullRequestResponse - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "GET", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodGet, Endpoint: fmt.Sprintf("/apps/%s/scm_repo_link/pulls/%d", app, number), - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, }, &res) if err != nil { return nil, errors.Wrap(ctx, err, "get this SCM repo link") @@ -195,10 +196,10 @@ func (c *Client) SCMRepoLinkPullRequest(ctx context.Context, app string, number func (c *Client) SCMRepoLinkManualDeploy(ctx context.Context, app, branch string) (*Deployment, error) { var res SCMRepoLinkManualDeployResponse - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "POST", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/apps/" + app + "/scm_repo_link/manual_deploy", - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, Params: map[string]string{"branch": branch}, }, &res) if err != nil { @@ -209,10 +210,10 @@ func (c *Client) SCMRepoLinkManualDeploy(ctx context.Context, app, branch string } func (c *Client) SCMRepoLinkManualReviewApp(ctx context.Context, app, pullRequestID string) error { - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "POST", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/apps/" + app + "/scm_repo_link/manual_review_app", - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, Params: map[string]string{"pull_request_id": pullRequestID}, }, nil) if err != nil { @@ -225,10 +226,10 @@ func (c *Client) SCMRepoLinkManualReviewApp(ctx context.Context, app, pullReques func (c *Client) SCMRepoLinkDeployments(ctx context.Context, app string) ([]*Deployment, error) { var res SCMRepoLinkDeploymentsResponse - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "GET", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodGet, Endpoint: "/apps/" + app + "/scm_repo_link/deployments", - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, }, &res) if err != nil { return nil, errors.Wrap(ctx, err, "list deployments of this SCM repo link") @@ -239,10 +240,10 @@ func (c *Client) SCMRepoLinkDeployments(ctx context.Context, app string) ([]*Dep func (c *Client) SCMRepoLinkReviewApps(ctx context.Context, app string) ([]*ReviewApp, error) { var res SCMRepoLinkReviewAppsResponse - err := c.ScalingoAPI().DoRequest(ctx, &http.APIRequest{ - Method: "GET", + err := c.ScalingoAPI().DoRequest(ctx, &httpclient.APIRequest{ + Method: http.MethodGet, Endpoint: "/apps/" + app + "/scm_repo_link/review_apps", - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, }, &res) if err != nil { return nil, errors.Wrap(ctx, err, "list review apps of this SCM repo link") diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/signup.go b/vendor/github.com/Scalingo/go-scalingo/v11/signup.go index 79b8ca78d..a78724faf 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/signup.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/signup.go @@ -2,8 +2,9 @@ package scalingo import ( "context" + "net/http" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -14,11 +15,11 @@ type SignUpService interface { var _ SignUpService = (*Client)(nil) func (c *Client) SignUp(ctx context.Context, email, password string) error { - req := &http.APIRequest{ + req := &httpclient.APIRequest{ NoAuth: true, - Method: "POST", + Method: http.MethodPost, Endpoint: "/users", - Expected: http.Statuses{201}, + Expected: httpclient.Statuses{http.StatusCreated}, Params: map[string]any{ "user": map[string]string{ "email": email, diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/tokens.go b/vendor/github.com/Scalingo/go-scalingo/v11/tokens.go index 391a2f1ed..06e2d98ca 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/tokens.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/tokens.go @@ -2,10 +2,11 @@ package scalingo import ( "context" + "net/http" "strconv" "time" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -19,13 +20,13 @@ type TokensService interface { var _ TokensService = (*Client)(nil) // Deprecated: use http.ErrOTPRequired instead of this wrapper. -var ErrOTPRequired = http.ErrOTPRequired +var ErrOTPRequired = httpclient.ErrOTPRequired // IsOTPRequired tests if the authentication backend return an OTP Required error // -// Deprecated: use http.IsOTPRequired instead of this wrapper. +// Deprecated: use httpclient.IsOTPRequired instead of this wrapper. func IsOTPRequired(err error) bool { - return http.IsOTPRequired(err) + return httpclient.IsOTPRequired(err) } type Token struct { @@ -74,9 +75,9 @@ func (c *Client) TokensList(ctx context.Context) (Tokens, error) { func (c *Client) TokenExchange(ctx context.Context, token string) (string, error) { var btRes BearerTokenRes - req := &http.APIRequest{ + req := &httpclient.APIRequest{ NoAuth: true, - Method: "POST", + Method: http.MethodPost, Endpoint: "/tokens/exchange", Password: token, } @@ -90,11 +91,11 @@ func (c *Client) TokenExchange(ctx context.Context, token string) (string, error } func (c *Client) TokenCreateWithLogin(ctx context.Context, params TokenCreateParams, login LoginParams) (Token, error) { - req := &http.APIRequest{ + req := &httpclient.APIRequest{ NoAuth: true, - Method: "POST", + Method: http.MethodPost, Endpoint: "/tokens", - Expected: http.Statuses{201}, + Expected: httpclient.Statuses{http.StatusCreated}, Username: login.Identifier, Password: login.Password, OTP: login.OTP, @@ -105,8 +106,8 @@ func (c *Client) TokenCreateWithLogin(ctx context.Context, params TokenCreatePar var tokenRes TokenRes err := c.AuthAPI().DoRequest(ctx, req, &tokenRes) if err != nil { - if http.IsOTPRequired(err) { - return Token{}, http.ErrOTPRequired + if httpclient.IsOTPRequired(err) { + return Token{}, httpclient.ErrOTPRequired } return Token{}, errors.Wrap(ctx, err, "create token with login") } diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/users.go b/vendor/github.com/Scalingo/go-scalingo/v11/users.go index 7d45595f8..df68c9a9f 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/users.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/users.go @@ -2,8 +2,9 @@ package scalingo import ( "context" + "net/http" - "github.com/Scalingo/go-scalingo/v11/http" + httpclient "github.com/Scalingo/go-scalingo/v11/http" "github.com/Scalingo/go-utils/errors/v3" ) @@ -29,7 +30,7 @@ type SelfResponse struct { func (c *Client) Self(ctx context.Context) (*User, error) { var selfRes SelfResponse - req := &http.APIRequest{ + req := &httpclient.APIRequest{ Endpoint: "/users/self", } err := c.AuthAPI().DoRequest(ctx, req, &selfRes) @@ -53,13 +54,13 @@ func (c *Client) UpdateUser(ctx context.Context, params UpdateUserParams) (*User return nil, nil } - req := &http.APIRequest{ - Method: "PATCH", + req := &httpclient.APIRequest{ + Method: http.MethodPatch, Endpoint: "/account/profile", Params: map[string]any{ "user": params, }, - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, } var updateUserRes UpdateUserResponse err := c.AuthAPI().DoRequest(ctx, req, &updateUserRes) @@ -71,11 +72,11 @@ func (c *Client) UpdateUser(ctx context.Context, params UpdateUserParams) (*User } func (c *Client) UserStopFreeTrial(ctx context.Context) error { - req := &http.APIRequest{ - Method: "POST", + req := &httpclient.APIRequest{ + Method: http.MethodPost, Endpoint: "/users/stop_free_trial", Params: map[string]any{}, - Expected: http.Statuses{200}, + Expected: httpclient.Statuses{http.StatusOK}, } err := c.AuthAPI().DoRequest(ctx, req, nil) diff --git a/vendor/github.com/Scalingo/go-scalingo/v11/version.go b/vendor/github.com/Scalingo/go-scalingo/v11/version.go index 84f28181c..b54991bf5 100644 --- a/vendor/github.com/Scalingo/go-scalingo/v11/version.go +++ b/vendor/github.com/Scalingo/go-scalingo/v11/version.go @@ -1,3 +1,3 @@ package scalingo -var Version = "11.0.3" +var Version = "11.0.0" diff --git a/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md b/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md index 20581f033..f11ffedf7 100644 --- a/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md +++ b/vendor/github.com/Scalingo/go-utils/logger/CHANGELOG.md @@ -2,10 +2,6 @@ ## To be Released -## v1.12.2 - -* refactor: replace `github.com/pkg/errors` with `errors` - ## v1.12.1 * chore(deps): bump github.com/Scalingo/logrus-rollbar from 1.4.3 to 1.4.4 diff --git a/vendor/github.com/Scalingo/go-utils/logger/README.md b/vendor/github.com/Scalingo/go-utils/logger/README.md index e95726a68..3cb2226bc 100644 --- a/vendor/github.com/Scalingo/go-utils/logger/README.md +++ b/vendor/github.com/Scalingo/go-utils/logger/README.md @@ -1,4 +1,4 @@ -# Package `logger` v1.12.2 +# Package `logger` v1.12.1 This package will provide you a generic way to handle logging. diff --git a/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go b/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go index 0d5072a47..44c351335 100644 --- a/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go +++ b/vendor/github.com/Scalingo/go-utils/logger/redacting_formatter.go @@ -1,9 +1,9 @@ package logger import ( - "errors" "regexp" + "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/vendor/modules.txt b/vendor/modules.txt index 4800e831c..52a2be141 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -37,8 +37,8 @@ github.com/ProtonMail/go-crypto/openpgp/packet github.com/ProtonMail/go-crypto/openpgp/s2k github.com/ProtonMail/go-crypto/openpgp/x25519 github.com/ProtonMail/go-crypto/openpgp/x448 -# github.com/Scalingo/go-scalingo/v11 v11.0.3 -## explicit; go 1.25.0 +# github.com/Scalingo/go-scalingo/v11 v11.0.1-0.20260513124010-187ac32aa251 +## explicit; go 1.24.0 github.com/Scalingo/go-scalingo/v11 github.com/Scalingo/go-scalingo/v11/billing github.com/Scalingo/go-scalingo/v11/debug @@ -49,8 +49,8 @@ github.com/Scalingo/go-scalingo/v11/scalingomock # github.com/Scalingo/go-utils/errors/v3 v3.2.1 ## explicit; go 1.24 github.com/Scalingo/go-utils/errors/v3 -# github.com/Scalingo/go-utils/logger v1.12.2 -## explicit; go 1.25.0 +# github.com/Scalingo/go-utils/logger v1.12.1 +## explicit; go 1.25 github.com/Scalingo/go-utils/logger # github.com/Scalingo/go-utils/pagination v1.2.0 ## explicit; go 1.24 @@ -328,7 +328,7 @@ golang.org/x/sys/windows # golang.org/x/term v0.42.0 ## explicit; go 1.25.0 golang.org/x/term -# golang.org/x/text v0.36.0 +# golang.org/x/text v0.37.0 ## explicit; go 1.25.0 golang.org/x/text/cases golang.org/x/text/internal