diff --git a/README.md b/README.md index a2db08f02a..c2ba2f53e3 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ To enable beta features, you can set `SCW_ENABLE_BETA=1` in your environment. | Namespace | Description | Documentation | |----------------|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------| -| `account` | Account API | [CLI](./docs/commands/account.md) | +| `account` | User related data | [CLI](./docs/commands/account.md) / [API](https://developers.scaleway.com/en/products/account/api/v2/) | | `applesilicon` | Apple silicon API | [CLI](./docs/commands/apple-silicon.md) / [API](https://developers.scaleway.com/en/products/apple-silicon/api/) | | `autocomplete` | Autocomplete related commands | [CLI](./docs/commands/autocomplete.md) | | `baremetal` | Baremetal API | [CLI](./docs/commands/baremetal.md) / [API](https://developers.scaleway.com/en/products/baremetal/api/) | diff --git a/cmd/scw/testdata/test-all-usage-account-usage.golden b/cmd/scw/testdata/test-all-usage-account-usage.golden index 553a4a91e7..74d9941231 100644 --- a/cmd/scw/testdata/test-all-usage-account-usage.golden +++ b/cmd/scw/testdata/test-all-usage-account-usage.golden @@ -1,13 +1,12 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -Account API +This API allows you to manage projects. USAGE: scw account AVAILABLE COMMANDS: project Project management commands - ssh-key SSH keys management commands FLAGS: -h, --help help for account diff --git a/cmd/scw/testdata/test-all-usage-iam-ssh-key-init-usage.golden b/cmd/scw/testdata/test-all-usage-iam-ssh-key-init-usage.golden new file mode 100644 index 0000000000..83b1780bae --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-iam-ssh-key-init-usage.golden @@ -0,0 +1,15 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Initialize SSH key. + +USAGE: + scw iam ssh-key init + +FLAGS: + -h, --help help for init + +GLOBAL FLAGS: + -c, --config string The path to the config file + -D, --debug Enable debug mode + -o, --output string Output format: json or human, see 'scw help output' for more info (default "human") + -p, --profile string The config profile to use diff --git a/cmd/scw/testdata/test-all-usage-iam-ssh-key-usage.golden b/cmd/scw/testdata/test-all-usage-iam-ssh-key-usage.golden index b222389690..b03ef500b7 100644 --- a/cmd/scw/testdata/test-all-usage-iam-ssh-key-usage.golden +++ b/cmd/scw/testdata/test-all-usage-iam-ssh-key-usage.golden @@ -9,6 +9,7 @@ AVAILABLE COMMANDS: create Create an SSH key delete Delete an SSH key get Get an SSH key + init Initialize SSH key list List SSH keys update Update an SSH key diff --git a/cmd/scw/testdata/test-main-usage-usage.golden b/cmd/scw/testdata/test-main-usage-usage.golden index 9a05abd0a1..475476dcbd 100644 --- a/cmd/scw/testdata/test-main-usage-usage.golden +++ b/cmd/scw/testdata/test-main-usage-usage.golden @@ -4,7 +4,7 @@ USAGE: scw AVAILABLE COMMANDS: - account Account API + account User related data apple-silicon Apple silicon API autocomplete Autocomplete related commands baremetal Elastic metal API diff --git a/docs/commands/account.md b/docs/commands/account.md index d3d96b4d1e..1ceae6b494 100644 --- a/docs/commands/account.md +++ b/docs/commands/account.md @@ -8,13 +8,6 @@ This API allows you to manage projects. - [Get project](#get-project) - [List projects](#list-projects) - [Update project](#update-project) -- [SSH keys management commands](#ssh-keys-management-commands) - - [Add an SSH key to your project](#add-an-ssh-key-to-your-project) - - [Get an SSH key from your project](#get-an-ssh-key-from-your-project) - - [Initialize SSH key](#initialize-ssh-key) - - [List all SSH keys of your project](#list-all-ssh-keys-of-your-project) - - [Remove an SSH key from your project](#remove-an-ssh-key-from-your-project) - - [Update an SSH key on your project](#update-an-ssh-key-on-your-project) ## Project management commands @@ -124,142 +117,3 @@ scw account project update [arg=value ...] -## SSH keys management commands - -SSH keys management commands. - - -### Add an SSH key to your project - -Add an SSH key to your project. - -**Usage:** - -``` -scw account ssh-key add [arg=value ...] -``` - - -**Args:** - -| Name | | Description | -|------|---|-------------| -| name | | The name of the SSH key | -| public-key | Required | SSH public key. Currently ssh-rsa, ssh-dss (DSA), ssh-ed25519 and ecdsa keys with NIST curves are supported | -| project-id | | Project ID to use. If none is passed the default project ID will be used | -| organization-id | | Organization ID to use. If none is passed the default organization ID will be used | - - -**Examples:** - - -Add a given ssh key -``` -scw account ssh-key add name=foobar public-key="$(cat )" -``` - - - - -### Get an SSH key from your project - -Get an SSH key from your project. - -**Usage:** - -``` -scw account ssh-key get [arg=value ...] -``` - - -**Args:** - -| Name | | Description | -|------|---|-------------| -| ssh-key-id | Required | The ID of the SSH key | - - - -### Initialize SSH key - -Initialize SSH key. - -**Usage:** - -``` -scw account ssh-key init -``` - - - -### List all SSH keys of your project - -List all SSH keys of your project. - -**Usage:** - -``` -scw account ssh-key list [arg=value ...] -``` - - -**Args:** - -| Name | | Description | -|------|---|-------------| -| order-by | One of: `created_at_asc`, `created_at_desc`, `updated_at_asc`, `updated_at_desc`, `name_asc`, `name_desc` | | -| name | | | -| project-id | | | -| organization-id | | | - - - -### Remove an SSH key from your project - -Remove an SSH key from your project. - -**Usage:** - -``` -scw account ssh-key remove [arg=value ...] -``` - - -**Args:** - -| Name | | Description | -|------|---|-------------| -| ssh-key-id | Required | | - - -**Examples:** - - -Remove a given SSH key -``` -scw account ssh-key remove 11111111-1111-1111-1111-111111111111 -``` - - - - -### Update an SSH key on your project - -Update an SSH key on your project. - -**Usage:** - -``` -scw account ssh-key update [arg=value ...] -``` - - -**Args:** - -| Name | | Description | -|------|---|-------------| -| ssh-key-id | Required | | -| name | | Name of the SSH key | - - - diff --git a/docs/commands/iam.md b/docs/commands/iam.md index 1d48e83c46..821c975ff5 100644 --- a/docs/commands/iam.md +++ b/docs/commands/iam.md @@ -37,6 +37,7 @@ IAM API - [Create an SSH key](#create-an-ssh-key) - [Delete an SSH key](#delete-an-ssh-key) - [Get an SSH key](#get-an-ssh-key) + - [Initialize SSH key](#initialize-ssh-key) - [List SSH keys](#list-ssh-keys) - [Update an SSH key](#update-an-ssh-key) - [Users management commands](#users-management-commands) @@ -736,6 +737,18 @@ scw iam ssh-key get [arg=value ...] +### Initialize SSH key + +Initialize SSH key. + +**Usage:** + +``` +scw iam ssh-key init +``` + + + ### List SSH keys List SSH keys. diff --git a/internal/account/account.go b/internal/account/account.go index cd28c199ab..428eef0eb0 100644 --- a/internal/account/account.go +++ b/internal/account/account.go @@ -1,13 +1,5 @@ package account -import ( - "context" - "encoding/json" - "fmt" - "io" - "net/http" -) - // Token represents a Token type Token struct { ID string `json:"id"` @@ -31,32 +23,3 @@ type LoginRequest struct { Description string `json:"description,omitempty"` Expires bool `json:"expires"` } - -var ( - accountURL = "https://api.scaleway.com/account/v1" -) - -func GetAPIKey(ctx context.Context, secretKey string) (*Token, error) { - resp, err := extractHTTPClient(ctx).Get(accountURL + "/tokens/" + secretKey) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("could not get token") - } - - token := &LoginResponse{} - b, err := io.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - err = json.Unmarshal(b, token) - if err != nil { - return nil, err - } - - return token.Token, err -} diff --git a/internal/account/test.go b/internal/account/test.go index 687b97cacb..c301ef2349 100644 --- a/internal/account/test.go +++ b/internal/account/test.go @@ -16,11 +16,3 @@ var contextKey = contextKeyType{} func InjectHTTPClient(ctx context.Context, httpClient *http.Client) context.Context { return context.WithValue(ctx, contextKey, httpClient) } - -func extractHTTPClient(ctx context.Context) *http.Client { - httpClient, isHTTPClient := ctx.Value(contextKey).(*http.Client) - if httpClient != nil && isHTTPClient { - return httpClient - } - return http.DefaultClient -} diff --git a/internal/core/context.go b/internal/core/context.go index 7600a23b01..060cd2b808 100644 --- a/internal/core/context.go +++ b/internal/core/context.go @@ -177,7 +177,7 @@ func ExtractProfileFlag(ctx context.Context) string { return extractMeta(ctx).ProfileFlag } -// GetDocGenContext reuturn a minimal context that can be used by scw-doc-gen +// GetDocGenContext returns a minimal context that can be used by scw-doc-gen func GetDocGenContext() context.Context { ctx := context.Background() client, _ := scw.NewClient( diff --git a/internal/core/validate.go b/internal/core/validate.go index d361282640..5001b8f724 100644 --- a/internal/core/validate.go +++ b/internal/core/validate.go @@ -172,6 +172,7 @@ func stringExists(strs []string, s string) bool { return false } +// ValidateSecretKey validates a secret key ID. func ValidateSecretKey() ArgSpecValidateFunc { return func(argSpec *ArgSpec, valueI interface{}) error { value := valueI.(string) @@ -186,6 +187,21 @@ func ValidateSecretKey() ArgSpecValidateFunc { } } +// ValidateAccessKey validates an access key ID. +func ValidateAccessKey() ArgSpecValidateFunc { + return func(argSpec *ArgSpec, valueI interface{}) error { + value := valueI.(string) + err := DefaultArgSpecValidateFunc()(argSpec, value) + if err != nil { + return err + } + if !validation.IsAccessKey(value) { + return InvalidAccessKeyError(value) + } + return nil + } +} + // ValidateOrganizationID validates a non-required organization ID. // By default, for most command, the organization ID is not required. // In that case, we allow the empty-string value "". diff --git a/internal/namespaces/get_commands.go b/internal/namespaces/get_commands.go index 2ce81f8dcd..b3097df4ba 100644 --- a/internal/namespaces/get_commands.go +++ b/internal/namespaces/get_commands.go @@ -5,7 +5,6 @@ import ( "github.com/scaleway/scaleway-cli/v2/internal/core" accountv2 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/account/v2" - account "github.com/scaleway/scaleway-cli/v2/internal/namespaces/account/v2alpha1" applesilicon "github.com/scaleway/scaleway-cli/v2/internal/namespaces/applesilicon/v1alpha1" autocompleteNamespace "github.com/scaleway/scaleway-cli/v2/internal/namespaces/autocomplete" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/baremetal/v1" @@ -54,7 +53,6 @@ func GetCommands(beta ...bool) *core.Commands { marketplace.GetCommands(), initNamespace.GetCommands(), configNamespace.GetCommands(), - account.GetCommands(), accountv2.GetCommands(), autocompleteNamespace.GetCommands(), object.GetCommands(), diff --git a/internal/namespaces/iam/v1alpha1/custom.go b/internal/namespaces/iam/v1alpha1/custom.go index 1c1633b369..f469899be5 100644 --- a/internal/namespaces/iam/v1alpha1/custom.go +++ b/internal/namespaces/iam/v1alpha1/custom.go @@ -2,8 +2,14 @@ package iam import ( "context" + "os" + "path" + "reflect" + "strings" + "github.com/scaleway/scaleway-cli/v2/internal/args" "github.com/scaleway/scaleway-cli/v2/internal/core" + "github.com/scaleway/scaleway-cli/v2/internal/interactive" iam "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -11,6 +17,10 @@ import ( func GetCommands() *core.Commands { cmds := GetGeneratedCommands() + cmds.Merge(core.NewCommands( + initWithSSHCommand(), + )) + // These commands have an "optional" organization-id that is required for now. for _, commandPath := range [][]string{ {"iam", "group", "list"}, @@ -47,6 +57,19 @@ func GetCommands() *core.Commands { return cmds } +func initWithSSHCommand() *core.Command { + return &core.Command{ + Short: `Initialize SSH key`, + Long: `Initialize SSH key.`, + Namespace: "iam", + Resource: "ssh-key", + Verb: "init", + ArgsType: reflect.TypeOf(args.RawArgs{}), + ArgSpecs: core.ArgSpecs{}, + Run: InitWithSSHKeyRun, + } +} + func setOrganizationDefaultValue(c *core.Command) *core.Command { c.ArgSpecs.GetByName("organization-id").Default = func(ctx context.Context) (value string, doc string) { organizationID := core.GetOrganizationIDFromContext(ctx) @@ -54,3 +77,69 @@ func setOrganizationDefaultValue(c *core.Command) *core.Command { } return c } + +func InitWithSSHKeyRun(ctx context.Context, argsI interface{}) (i interface{}, e error) { + // Get default local SSH key + var shortenedFilename string + var err error + var localSSHKeyContent []byte + for _, keyName := range [3]string{"id_ecdsa.pub", "id_ed25519.pub", "id_rsa.pub"} { + // element is the element from someSlice for where we are + relativePath := path.Join(".ssh", keyName) + filename := path.Join(core.ExtractUserHomeDir(ctx), relativePath) + shortenedFilename = "~/" + relativePath + localSSHKeyContent, err = os.ReadFile(filename) + // If we managed to load an ssh key, let's stop there + if err == nil { + break + } + } + addKeyInstructions := `scw iam ssh-key create name=my-key key="$(cat path/to/my/key.pub)"` + if err != nil && os.IsNotExist(err) { + return nil, sshKeyNotFound(shortenedFilename, addKeyInstructions) + } + + // Get all SSH keys from Scaleway + client := core.ExtractClient(ctx) + api := iam.NewAPI(client) + listSSHKeysResponse, err := api.ListSSHKeys(&iam.ListSSHKeysRequest{}, scw.WithAllPages()) + if err != nil { + return nil, err + } + + // Early exit if the SSH key is present locally and on Scaleway + for _, SSHKey := range listSSHKeysResponse.SSHKeys { + if strings.TrimSpace(SSHKey.PublicKey) == strings.TrimSpace(string(localSSHKeyContent)) { + _, _ = interactive.Println("Looks like your local SSH key " + shortenedFilename + " is already present in your Scaleway account.") + return nil, nil + } + } + + // Ask user + _, _ = interactive.Println("An SSH key is required if you want to connect to a server. More info at https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/") + addSSHKey, err := interactive.PromptBoolWithConfig(&interactive.PromptBoolConfig{ + Ctx: ctx, + Prompt: "We found an SSH key in " + shortenedFilename + ". Do you want to add it to your Scaleway project?", + DefaultValue: true, + }) + if err != nil { + return nil, err + } + + // Early exit if user doesn't want to add the key + if !addSSHKey { + return nil, installationCanceled(addKeyInstructions) + } + + // Add key + _, err = api.CreateSSHKey(&iam.CreateSSHKeyRequest{ + PublicKey: string(localSSHKeyContent), + }) + if err != nil { + return nil, err + } + + return &core.SuccessResult{ + Message: "Key " + shortenedFilename + " successfully added", + }, nil +} diff --git a/internal/namespaces/iam/v1alpha1/custom_test.go b/internal/namespaces/iam/v1alpha1/custom_test.go new file mode 100644 index 0000000000..35051a6df5 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/custom_test.go @@ -0,0 +1,72 @@ +package iam + +import ( + "os" + "path" + "testing" + + "github.com/scaleway/scaleway-cli/v2/internal/core" + iamsdk "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1" +) + +func Test_initWithSSHKeyCommand(t *testing.T) { + tmpDir := os.TempDir() + key := `ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar` + t.Run("simple", core.Test(&core.TestConfig{ + Commands: GetCommands(), + BeforeFunc: func(ctx *core.BeforeFuncCtx) error { + pathToPublicKey := path.Join(tmpDir, ".ssh", "id_rsa.pub") + _, err := os.Stat(pathToPublicKey) + if err != nil { + err := os.MkdirAll(path.Join(tmpDir, ".ssh"), 0755) + if err != nil { + return err + } + err = os.WriteFile(pathToPublicKey, []byte(key), 0644) + return err + } + return err + }, + Cmd: `scw iam ssh-key init with-ssh-key=true`, + Check: core.TestCheckCombine( + core.TestCheckGolden(), + core.TestCheckExitCode(0), + ), + OverrideEnv: map[string]string{ + "HOME": tmpDir, + }, + })) +} + +func Test_SSHKeyCreateCommand(t *testing.T) { + key := `ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar` + t.Run("simple", core.Test(&core.TestConfig{ + Commands: GetCommands(), + Args: []string{ + "scw", "iam", "ssh-key", "create", "name=foobar", "public-key=" + key, + }, + Check: core.TestCheckCombine( + core.TestCheckGolden(), + core.TestCheckExitCode(0), + ), + AfterFunc: func(ctx *core.AfterFuncCtx) error { + api := iamsdk.NewAPI(ctx.Client) + return api.DeleteSSHKey(&iamsdk.DeleteSSHKeyRequest{ + SSHKeyID: ctx.CmdResult.(*iamsdk.SSHKey).ID, + }) + }, + })) +} + +func Test_SSHKeyRemoveCommand(t *testing.T) { + key := `ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGh9rvkJKMu5ljnevB4oRu4i/EnxGS734/UJ6fSDvXGIvT08jIglahc7tM5dvo02abPVXsbiazO25avZZtL6fjo= foobar@foobar` + t.Run("simple", core.Test(&core.TestConfig{ + Commands: GetCommands(), + BeforeFunc: addSSHKey("Key", key), + Cmd: "scw iam ssh-key delete {{ .Key.ID }}", + Check: core.TestCheckCombine( + core.TestCheckGolden(), + core.TestCheckExitCode(0), + ), + })) +} diff --git a/internal/namespaces/iam/v1alpha1/error.go b/internal/namespaces/iam/v1alpha1/error.go new file mode 100644 index 0000000000..a2f727dc9c --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/error.go @@ -0,0 +1,21 @@ +package iam + +import ( + "fmt" + + "github.com/scaleway/scaleway-cli/v2/internal/core" +) + +func installationCanceled(addKeyInstructions string) *core.CliError { + return &core.CliError{ + Err: fmt.Errorf("installation of SSH key canceled"), + Hint: "You can add it later using " + addKeyInstructions, + } +} + +func sshKeyNotFound(filename string, addKeyInstructions string) *core.CliError { + return &core.CliError{ + Err: fmt.Errorf("could not find an SSH key at " + filename), + Hint: "You can add one later using " + addKeyInstructions, + } +} diff --git a/internal/namespaces/iam/v1alpha1/helpers_test.go b/internal/namespaces/iam/v1alpha1/helpers_test.go new file mode 100644 index 0000000000..87cfa24bb2 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/helpers_test.go @@ -0,0 +1,12 @@ +package iam + +import "github.com/scaleway/scaleway-cli/v2/internal/core" + +func addSSHKey(metaKey string, key string) core.BeforeFunc { + return func(ctx *core.BeforeFuncCtx) error { + ctx.Meta[metaKey] = ctx.ExecuteCmd([]string{ + "scw", "iam", "ssh-key", "create", "public-key=" + key, + }) + return nil + } +} diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-init-with-ssh-key-command-simple.cassette.yaml b/internal/namespaces/iam/v1alpha1/testdata/test-init-with-ssh-key-command-simple.cassette.yaml new file mode 100644 index 0000000000..62d40ff3e7 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-init-with-ssh-key-command-simple.cassette.yaml @@ -0,0 +1,73 @@ +--- +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1 + method: GET + response: + body: '{"ssh_keys":[],"total_count":0}' + headers: + Content-Length: + - "3508" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Wed, 15 Feb 2023 16:02:46 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 6139b965-ed34-498c-8e8d-ad77b24e9c4d + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys + method: POST + response: + body: '{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}' + headers: + Content-Length: + - "581" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Wed, 15 Feb 2023 16:02:46 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 953b4083-ca64-4997-9450-55127c9cc88f + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-init-with-ssh-key-command-simple.golden b/internal/namespaces/iam/v1alpha1/testdata/test-init-with-ssh-key-command-simple.golden new file mode 100644 index 0000000000..265f81d640 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-init-with-ssh-key-command-simple.golden @@ -0,0 +1,8 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟩🟩🟩 STDOUT️ 🟩🟩🟩️ +βœ… Key ~/.ssh/id_rsa.pub successfully added. +🟩🟩🟩 JSON STDOUT 🟩🟩🟩 +{ + "message": "Key ~/.ssh/id_rsa.pub successfully added", + "details": "" +} diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-add-command-simple.cassette.yaml b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-add-command-simple.cassette.yaml new file mode 100644 index 0000000000..13366e97fa --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-add-command-simple.cassette.yaml @@ -0,0 +1,73 @@ +--- +version: 1 +interactions: +- request: + body: '{"name":"foobar","public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","project_id":"105bdce1-64c0-48ab-899d-868455867ecf"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys + method: POST + response: + body: '{"id":"f2b8cbd6-6d01-4c3e-a901-e578c46af91a", "name":"foobar", "public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar", "fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)", "created_at":"2023-02-15T11:01:01.193946Z", + "updated_at":"2023-02-15T11:01:01.193946Z", "organization_id":"105bdce1-64c0-48ab-899d-868455867ecf", + "project_id":"105bdce1-64c0-48ab-899d-868455867ecf", "disabled":false}' + headers: + Content-Length: + - "579" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Wed, 15 Feb 2023 11:01:01 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 9d0d0822-9cb3-4aae-9a19-ce55efd6a7f5 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys/f2b8cbd6-6d01-4c3e-a901-e578c46af91a + method: DELETE + response: + body: "" + headers: + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Wed, 15 Feb 2023 11:01:01 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 2b283938-06b1-4147-ae5f-225dd1230048 + status: 204 No Content + code: 204 + duration: "" diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-add-command-simple.golden b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-add-command-simple.golden new file mode 100644 index 0000000000..9dcfd8dd48 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-add-command-simple.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟩🟩🟩 STDOUT️ 🟩🟩🟩️ +ID f2b8cbd6-6d01-4c3e-a901-e578c46af91a +Name foobar +PublicKey ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar +Fingerprint 256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 foobar@foobar (ecdsa-sha2-nistp256) +CreatedAt few seconds ago +UpdatedAt few seconds ago +OrganizationID 105bdce1-64c0-48ab-899d-868455867ecf +ProjectID 105bdce1-64c0-48ab-899d-868455867ecf +Disabled false +🟩🟩🟩 JSON STDOUT 🟩🟩🟩 +{ + "id": "f2b8cbd6-6d01-4c3e-a901-e578c46af91a", + "name": "foobar", + "public_key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar", + "fingerprint": "256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 foobar@foobar (ecdsa-sha2-nistp256)", + "created_at": "1970-01-01T00:00:00.0Z", + "updated_at": "1970-01-01T00:00:00.0Z", + "organization_id": "105bdce1-64c0-48ab-899d-868455867ecf", + "project_id": "105bdce1-64c0-48ab-899d-868455867ecf", + "disabled": false +} diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-create-command-simple.cassette.yaml b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-create-command-simple.cassette.yaml new file mode 100644 index 0000000000..6dfa5d2cad --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-create-command-simple.cassette.yaml @@ -0,0 +1,71 @@ +--- +version: 1 +interactions: +- request: + body: '{"name":"foobar","public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys + method: POST + response: + body: '{"id":"61feb7c8-3878-42e4-9d57-cdc491c20634","name":"foobar","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-20T13:39:44.364037Z","updated_at":"2023-02-20T13:39:44.364037Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}' + headers: + Content-Length: + - "571" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:39:44 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - f566e970-36fe-4745-8175-ba96eedf010c + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys/61feb7c8-3878-42e4-9d57-cdc491c20634 + method: DELETE + response: + body: "" + headers: + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:39:44 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 21d0257a-838b-4c1c-9ab7-c7e3efb23bea + status: 204 No Content + code: 204 + duration: "" diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-create-command-simple.golden b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-create-command-simple.golden new file mode 100644 index 0000000000..172d7347e0 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-create-command-simple.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟩🟩🟩 STDOUT️ 🟩🟩🟩️ +ID 61feb7c8-3878-42e4-9d57-cdc491c20634 +Name foobar +PublicKey ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar +Fingerprint 256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 foobar@foobar (ecdsa-sha2-nistp256) +CreatedAt few seconds ago +UpdatedAt few seconds ago +OrganizationID 63a66ec9-a385-4194-bc15-04aa6921274a +ProjectID 63a66ec9-a385-4194-bc15-04aa6921274a +Disabled false +🟩🟩🟩 JSON STDOUT 🟩🟩🟩 +{ + "id": "61feb7c8-3878-42e4-9d57-cdc491c20634", + "name": "foobar", + "public_key": "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar", + "fingerprint": "256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 foobar@foobar (ecdsa-sha2-nistp256)", + "created_at": "1970-01-01T00:00:00.0Z", + "updated_at": "1970-01-01T00:00:00.0Z", + "organization_id": "63a66ec9-a385-4194-bc15-04aa6921274a", + "project_id": "63a66ec9-a385-4194-bc15-04aa6921274a", + "disabled": false +} diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-remove-command-simple.cassette.yaml b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-remove-command-simple.cassette.yaml new file mode 100644 index 0000000000..6440edad72 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-remove-command-simple.cassette.yaml @@ -0,0 +1,74 @@ +--- +version: 1 +interactions: +- request: + body: '{"name":"cli-key-friendly-stonebraker","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGh9rvkJKMu5ljnevB4oRu4i/EnxGS734/UJ6fSDvXGIvT08jIglahc7tM5dvo02abPVXsbiazO25avZZtL6fjo= + foobar@foobar","project_id":"105bdce1-64c0-48ab-899d-868455867ecf"}' + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys + method: POST + response: + body: '{"id":"812d00b5-213d-4fbc-919b-9dd03beec81d", "name":"cli-key-friendly-stonebraker", + "public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGh9rvkJKMu5ljnevB4oRu4i/EnxGS734/UJ6fSDvXGIvT08jIglahc7tM5dvo02abPVXsbiazO25avZZtL6fjo= + foobar@foobar", "fingerprint":"256 MD5:66:2f:05:a4:64:d2:22:89:b6:ad:e8:a9:3e:38:22:95 + foobar@foobar (ecdsa-sha2-nistp256)", "created_at":"2023-02-15T11:01:13.868674Z", + "updated_at":"2023-02-15T11:01:13.868674Z", "organization_id":"105bdce1-64c0-48ab-899d-868455867ecf", + "project_id":"105bdce1-64c0-48ab-899d-868455867ecf", "disabled":false}' + headers: + Content-Length: + - "601" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Wed, 15 Feb 2023 11:01:13 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 95d47c94-4622-4cf2-9cac-01769a55fc5d + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys/812d00b5-213d-4fbc-919b-9dd03beec81d + method: DELETE + response: + body: "" + headers: + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Wed, 15 Feb 2023 11:01:13 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - a4d77bdd-36b2-49f9-bdb5-3314b6c3a072 + status: 204 No Content + code: 204 + duration: "" diff --git a/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-remove-command-simple.golden b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-remove-command-simple.golden new file mode 100644 index 0000000000..0d95315773 --- /dev/null +++ b/internal/namespaces/iam/v1alpha1/testdata/test-ssh-key-remove-command-simple.golden @@ -0,0 +1,8 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟩🟩🟩 STDOUT️ 🟩🟩🟩️ +βœ… Ssh-key has been successfully deleted. +🟩🟩🟩 JSON STDOUT 🟩🟩🟩 +{ + "message": "ssh-key has been successfully deleted.", + "details": "" +} diff --git a/internal/namespaces/init/custom_init_autocomplete_test.go b/internal/namespaces/init/custom_init_autocomplete_test.go index 9a37ea783a..fce1da9f0c 100644 --- a/internal/namespaces/init/custom_init_autocomplete_test.go +++ b/internal/namespaces/init/custom_init_autocomplete_test.go @@ -15,6 +15,8 @@ func baseBeforeFunc() core.BeforeFunc { return func(ctx *core.BeforeFuncCtx) error { ctx.Meta["AccessKey"], _ = ctx.Client.GetAccessKey() ctx.Meta["SecretKey"], _ = ctx.Client.GetSecretKey() + ctx.Meta["ProjectID"], _ = ctx.Client.GetDefaultProjectID() + ctx.Meta["OrganizationID"], _ = ctx.Client.GetDefaultOrganizationID() return nil } } @@ -27,10 +29,12 @@ const ( func Test_InitAutocomplete(t *testing.T) { defaultSettings := map[string]string{ - "access-key": "{{ .AccessKey }}", - "secret-key": "{{ .SecretKey }}", - "send-telemetry": "false", - "with-ssh-key": "false", + "access-key": "{{ .AccessKey }}", + "secret-key": "{{ .SecretKey }}", + "send-telemetry": "false", + "with-ssh-key": "false", + "organization-id": "{{ .OrganizationID }}", + "project-id": "{{ .ProjectID }}", } runAllShells := func(t *testing.T) { diff --git a/internal/namespaces/init/custom_init_ssh_test.go b/internal/namespaces/init/custom_init_ssh_test.go index 884a884b78..ae565625bf 100644 --- a/internal/namespaces/init/custom_init_ssh_test.go +++ b/internal/namespaces/init/custom_init_ssh_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/scaleway/scaleway-cli/v2/internal/core" - account "github.com/scaleway/scaleway-cli/v2/internal/namespaces/account/v2alpha1" - accountsdk "github.com/scaleway/scaleway-sdk-go/api/account/v2alpha1" + iamcommands "github.com/scaleway/scaleway-cli/v2/internal/namespaces/iam/v1alpha1" + iamsdk "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -36,8 +36,8 @@ func setUpSSHKeyLocallyWithKeyName(key string, name string) core.BeforeFunc { func removeSSHKeyFromAccount(publicSSHKey string) core.AfterFunc { return func(ctx *core.AfterFuncCtx) error { - api := accountsdk.NewAPI(ctx.Client) - resp, err := api.ListSSHKeys(&accountsdk.ListSSHKeysRequest{}, + api := iamsdk.NewAPI(ctx.Client) + resp, err := api.ListSSHKeys(&iamsdk.ListSSHKeysRequest{}, scw.WithAllPages()) if err != nil { return err @@ -49,7 +49,7 @@ func removeSSHKeyFromAccount(publicSSHKey string) core.AfterFunc { } } if id != "" { - err = api.DeleteSSHKey(&accountsdk.DeleteSSHKeyRequest{SSHKeyID: id}) + err = api.DeleteSSHKey(&iamsdk.DeleteSSHKeyRequest{SSHKeyID: id}) } return err } @@ -59,7 +59,7 @@ func removeSSHKeyFromAccount(publicSSHKey string) core.AfterFunc { func addSSHKeyToAccount(metaKey string, name string, key string) core.BeforeFunc { return func(ctx *core.BeforeFuncCtx) error { cmd := []string{ - "scw", "account", "ssh-key", "add", "public-key=" + key, "name=" + name, + "scw", "iam", "ssh-key", "create", "public-key=" + key, "name=" + name, } ctx.Meta[metaKey] = ctx.ExecuteCmd(cmd) return nil @@ -74,7 +74,7 @@ func Test_InitSSH(t *testing.T) { "install-autocomplete": "false", } cmds := GetCommands() - cmds.Merge(account.GetCommands()) + cmds.Merge(iamcommands.GetCommands()) // We create a key in each tests to be able to run those tests in parallel diff --git a/internal/namespaces/init/init.go b/internal/namespaces/init/init.go index 14787b3c1d..cee22c484d 100644 --- a/internal/namespaces/init/init.go +++ b/internal/namespaces/init/init.go @@ -2,17 +2,19 @@ package init import ( "context" + "errors" "fmt" + "net/http" "reflect" "strings" "github.com/fatih/color" - "github.com/scaleway/scaleway-cli/v2/internal/account" "github.com/scaleway/scaleway-cli/v2/internal/core" "github.com/scaleway/scaleway-cli/v2/internal/interactive" - accountcommands "github.com/scaleway/scaleway-cli/v2/internal/namespaces/account/v2alpha1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/autocomplete" + iamcommands "github.com/scaleway/scaleway-cli/v2/internal/namespaces/iam/v1alpha1" "github.com/scaleway/scaleway-cli/v2/internal/terminal" + iam "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1" "github.com/scaleway/scaleway-sdk-go/logger" "github.com/scaleway/scaleway-sdk-go/scw" "github.com/scaleway/scaleway-sdk-go/validation" @@ -33,7 +35,7 @@ See below the schema `scw init` follows to ask for default config: | v +------+---+ - |Get access| + |Read access| | key | +------+---+ | @@ -58,8 +60,11 @@ func GetCommands() *core.Commands { } type initArgs struct { - AccessKey string - SecretKey string + AccessKey string + SecretKey string + ProjectID string + OrganizationID string + Region scw.Region Zone scw.Zone SendTelemetry *bool @@ -86,6 +91,21 @@ Default path for configuration file is based on the following priority order: Short: "Scaleway secret-key", ValidateFunc: core.ValidateSecretKey(), }, + { + Name: "access-key", + Short: "Scaleway access-key", + ValidateFunc: core.ValidateAccessKey(), + }, + { + Name: "organization-id", + Short: "Scaleway organization ID", + ValidateFunc: core.ValidateOrganizationID(), + }, + { + Name: "project-id", + Short: "Scaleway project ID", + ValidateFunc: core.ValidateProjectID(), + }, { Name: "send-telemetry", Short: "Send usage statistics and diagnostics", @@ -99,8 +119,8 @@ Default path for configuration file is based on the following priority order: Name: "install-autocomplete", Short: "Whether the autocomplete script should be installed during initialisation", }, - core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms), - core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + core.RegionArgSpec(scw.AllRegions...), + core.ZoneArgSpec(scw.AllZones...), }, SeeAlsos: []*core.SeeAlso{ { @@ -150,6 +170,31 @@ Default path for configuration file is based on the following priority order: } } + if args.AccessKey == "" { + _, _ = interactive.Println() + args.AccessKey, err = promptAccessKey(ctx) + if err != nil { + return err + } + } + + if args.OrganizationID == "" { + _, _ = interactive.Println() + args.OrganizationID, err = interactive.PromptStringWithConfig(&interactive.PromptStringConfig{ + Ctx: ctx, + Prompt: "Choose your default organization ID", + ValidateFunc: func(s string) error { + if !validation.IsUUID(s) { + return fmt.Errorf("organization id is not a valid uuid") + } + return nil + }, + }) + if err != nil { + return err + } + } + // Zone if args.Zone == "" { _, _ = interactive.Println() @@ -231,30 +276,55 @@ Default path for configuration file is based on the following priority order: configPath := core.ExtractConfigPath(ctx) config, err := scw.LoadConfigFromPath(configPath) if err != nil { - config = &scw.Config{} - interactive.Printf("Creating new config at %s\n", configPath) + _, ok := err.(*scw.ConfigFileNotFoundError) + if ok { + config = &scw.Config{} + interactive.Printf("Creating new config at %s\n", configPath) + } else { + return nil, err + } } if args.SendTelemetry != nil { config.SendTelemetry = args.SendTelemetry } - // Get access key - apiKey, err := account.GetAPIKey(ctx, args.SecretKey) - if err != nil { - return "", &core.CliError{ - Err: err, - Details: "Failed to retrieve Access Key from the given Secret Key.", + client := core.ExtractClient(ctx) + api := iam.NewAPI(client) + + apiKey, err := api.GetAPIKey(&iam.GetAPIKeyRequest{AccessKey: args.AccessKey}, scw.WithAuthRequest(args.AccessKey, args.SecretKey)) + if err != nil && !is403Error(err) { + // If 403 Unauthorized, API Key does not have permissions to get himself + return nil, err + } + + if apiKey != nil && args.ProjectID == "" { + args.ProjectID = apiKey.DefaultProjectID + } + + if args.ProjectID == "" { + args.ProjectID, err = interactive.PromptStringWithConfig(&interactive.PromptStringConfig{ + Ctx: ctx, + Prompt: "Default project ID", + ValidateFunc: func(s string) error { + if !validation.IsUUID(s) { + return fmt.Errorf("given project ID is not a valid UUID") + } + return nil + }, + }) + if err != nil { + return nil, err } } profile := &scw.Profile{ - AccessKey: &apiKey.AccessKey, + AccessKey: &args.AccessKey, SecretKey: &args.SecretKey, DefaultZone: scw.StringPtr(args.Zone.String()), DefaultRegion: scw.StringPtr(args.Region.String()), - DefaultOrganizationID: &apiKey.OrganizationID, - DefaultProjectID: &apiKey.ProjectID, // An API key is always bound to a project. + DefaultOrganizationID: &args.OrganizationID, + DefaultProjectID: &args.ProjectID, // An API key is always bound to a project. } // Save the profile as default or as a named profile @@ -276,7 +346,7 @@ Default path for configuration file is based on the following priority order: return nil, err } - // Now that the config has been save we reload the client with the new config + // Now that the config has been recorded we reload the client with the new config err = core.ReloadClient(ctx) if err != nil { return nil, err @@ -295,7 +365,7 @@ Default path for configuration file is based on the following priority order: // Init SSH Key if *args.WithSSHKey { _, _ = interactive.Println() - _, err := accountcommands.InitRun(ctx, nil) + _, err := iamcommands.InitWithSSHKeyRun(ctx, nil) if err != nil { successDetails = append(successDetails, "Except for SSH key: "+err.Error()) } @@ -342,6 +412,57 @@ func promptSecret(ctx context.Context) (string, error) { } } +func promptAccessKey(ctx context.Context) (string, error) { + key, err := interactive.Readline(&interactive.ReadlineConfig{ + Ctx: ctx, + PromptFunc: func(value string) string { + accessKey := "access-key" + switch { + case validation.IsAccessKey(value): + accessKey = terminal.Style(accessKey, color.FgBlue) + } + return terminal.Style(fmt.Sprintf("Enter a valid %s: ", accessKey), color.Bold) + }, + ValidateFunc: func(s string) error { + if !validation.IsAccessKey(s) { + return fmt.Errorf("invalid access-key") + } + + return nil + }, + }) + if err != nil { + return "", err + } + + switch { + case validation.IsAccessKey(key): + return key, nil + + default: + return "", fmt.Errorf("invalid access-key: '%v'", key) + } +} + +// isHTTPCodeError returns true if err is an http error with code statusCode +func isHTTPCodeError(err error, statusCode int) bool { + if err == nil { + return false + } + + responseError := &scw.ResponseError{} + if errors.As(err, &responseError) && responseError.StatusCode == statusCode { + return true + } + return false +} + +// is403Error returns true if err is an HTTP 403 error +func is403Error(err error) bool { + permissionsDeniedError := &scw.PermissionsDeniedError{} + return isHTTPCodeError(err, http.StatusForbidden) || errors.As(err, &permissionsDeniedError) +} + const logo = ` @@@@@@@@@@@@@@@. @@@@@@@@@@@@@@@@@@@@ __ __ _ diff --git a/internal/namespaces/init/init_test.go b/internal/namespaces/init/init_test.go index 373bf13300..40807c20a1 100644 --- a/internal/namespaces/init/init_test.go +++ b/internal/namespaces/init/init_test.go @@ -42,6 +42,8 @@ func TestInit(t *testing.T) { "send-telemetry": "true", "install-autocomplete": "false", "with-ssh-key": "false", + "organization-id": "{{ .OrganizationID }}", + "project-id": "{{ .ProjectID }}", } t.Run("Simple", core.Test(&core.TestConfig{ diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-bash.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-bash.cassette.yaml index d2111b74a6..aebd651698 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-bash.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-bash.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:24:39 GMT + - Mon, 20 Feb 2023 13:44:28 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - d779d017-d204-4883-b317-5d4ce285e8ff + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-fish.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-fish.cassette.yaml index 163bfa9ffc..84dcd9b821 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-fish.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-fish.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:24:39 GMT + - Mon, 20 Feb 2023 13:44:28 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - 90829fc8-d298-40a0-8a28-c41fb3a76e68 + - 8ba42abf-4aaa-4e0c-bf83-6dd99a4a6c73 status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-without.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-without.cassette.yaml index 61587bdada..130d9a4d1b 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-without.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-without.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:24:39 GMT + - Mon, 20 Feb 2023 13:44:28 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - 0fd6870a-a4ef-4eee-9632-beaa450ea1d6 + - d7b50924-9bda-4beb-b48f-c04e225367cd status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-zsh.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-zsh.cassette.yaml index dfc94b81ce..a4b250c5a1 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-darwin-zsh.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-darwin-zsh.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:24:39 GMT + - Mon, 20 Feb 2023 13:44:28 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - bce27228-1d87-4098-8c55-a78e88e87010 + - c3515bcb-d8cd-45df-bae4-d219c286a13d status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-linux-bash.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-linux-bash.cassette.yaml index b576b488f5..8b272e189a 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-linux-bash.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-linux-bash.cassette.yaml @@ -1,32 +1,33 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:08:49 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: {} + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-linux-fish.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-linux-fish.cassette.yaml index b576b488f5..8b272e189a 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-linux-fish.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-linux-fish.cassette.yaml @@ -1,32 +1,33 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:08:49 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: {} + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-linux-without.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-linux-without.cassette.yaml index b576b488f5..e8d1f80e7f 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-linux-without.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-linux-without.cassette.yaml @@ -1,32 +1,35 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:08:49 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-linux-zsh.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-linux-zsh.cassette.yaml index b576b488f5..8b272e189a 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-linux-zsh.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-linux-zsh.cassette.yaml @@ -1,32 +1,33 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:08:49 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: {} + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-windows-bash.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-windows-bash.cassette.yaml index 82f7d63d5c..8b272e189a 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-windows-bash.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-windows-bash.cassette.yaml @@ -1,32 +1,33 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:19:31 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: {} + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-windows-fish.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-windows-fish.cassette.yaml index 82f7d63d5c..8b272e189a 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-windows-fish.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-windows-fish.cassette.yaml @@ -1,32 +1,33 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:19:31 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: {} + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-windows-without.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-windows-without.cassette.yaml index 82f7d63d5c..8b272e189a 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-windows-without.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-windows-without.cassette.yaml @@ -1,32 +1,33 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:19:31 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: {} + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-autocomplete-windows-zsh.cassette.yaml b/internal/namespaces/init/testdata/test-init-autocomplete-windows-zsh.cassette.yaml index 82f7d63d5c..8b272e189a 100644 --- a/internal/namespaces/init/testdata/test-init-autocomplete-windows-zsh.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-autocomplete-windows-zsh.cassette.yaml @@ -1,32 +1,33 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCW8XT5JRAV4B0WQSHPE", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "expires": null, "creation_date": "2020-06-23T14:06:56.763352+00:00", "creation_ip": - "195.154.229.35", "category": "user_created", "deletion_date": null, "inherits_user_perms": - true, "roles": {"role": null, "organization": null}, "description": "sieben-macbook", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "use_role_key": false}}' - headers: - Connection: - - keep-alive - Content-Length: - - "445" - Content-Type: - - application/json - Date: - - Tue, 23 Jun 2020 15:19:31 GMT - Server: - - nginx - Strict-Transport-Security: - - max-age=15552000 - status: 200 OK - code: 200 - duration: "" + - request: + body: "" + form: {} + headers: {} + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' + headers: + Content-Length: + - "340" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Mon, 20 Feb 2023 13:44:28 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - edbe64c1-9d5f-42e6-8705-6b6c91df28f5 + status: 200 OK + code: 200 + duration: "" diff --git a/internal/namespaces/init/testdata/test-init-cl-iv2-config-overwrite.cassette.yaml b/internal/namespaces/init/testdata/test-init-cl-iv2-config-overwrite.cassette.yaml index 84dd39dc66..74fb099f3c 100644 --- a/internal/namespaces/init/testdata/test-init-cl-iv2-config-overwrite.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-cl-iv2-config-overwrite.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:25:37 GMT + - Mon, 20 Feb 2023 12:57:23 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - 8eb542c5-88c6-4fa4-bfbb-6854f580b259 + - fc80a7f1-08a1-4dd1-8b74-401681c056e5 status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-configuration-path.cassette.yaml b/internal/namespaces/init/testdata/test-init-configuration-path.cassette.yaml index 1c07e55eef..84152a85bb 100644 --- a/internal/namespaces/init/testdata/test-init-configuration-path.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-configuration-path.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:26:43 GMT + - Mon, 20 Feb 2023 12:57:23 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - 8621e264-f36b-4f36-b374-99420b47e8c6 + - 71d5bc95-a5fd-4058-a64b-4ad7a69243e8 status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-profile.cassette.yaml b/internal/namespaces/init/testdata/test-init-profile.cassette.yaml index 918d213f9b..c08bdc8b98 100644 --- a/internal/namespaces/init/testdata/test-init-profile.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-profile.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:25:37 GMT + - Mon, 20 Feb 2023 12:57:23 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - 156bd729-bd50-42db-bd15-f33392b5a700 + - 3f3e1163-55f8-46ea-85a2-ebf2ca041874 status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-simple.cassette.yaml b/internal/namespaces/init/testdata/test-init-simple.cassette.yaml index 71ea8d1fbb..7cfd7fb043 100644 --- a/internal/namespaces/init/testdata/test-init-simple.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-simple.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:25:37 GMT + - Mon, 20 Feb 2023 12:57:23 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - eb45b699-5262-4cc7-9023-c6984f0bde3a + - cfb78b79-9ca1-4b37-bc93-153a60c709d9 status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-ssh-key-registered.cassette.yaml b/internal/namespaces/init/testdata/test-init-ssh-key-registered.cassette.yaml index 9ec797db85..0569d00f40 100644 --- a/internal/namespaces/init/testdata/test-init-ssh-key-registered.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-ssh-key-registered.cassette.yaml @@ -3,28 +3,28 @@ version: 1 interactions: - request: body: '{"name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE - foobar@foobar","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}' + foobar@foobar","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a"}' form: {} headers: Content-Type: - application/json User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys method: POST response: - body: '{"id":"fd3be52e-c218-4489-b09d-c2362256c19e","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 + body: '{"id":"b5031816-c15a-4b0a-945d-e22b60228077","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE foobar@foobar","fingerprint":"256 - MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.569521Z","updated_at":"2022-05-17T15:46:09.569521Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}' + MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.370383Z","updated_at":"2023-02-20T14:47:54.370383Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}' headers: Content-Length: - - "547" + - "499" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -34,44 +34,39 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 6808fcea-7861-4ebc-9574-85c0b631d6e2 + - 1e7c379f-9bc5-4649-a4d3-ea4e392d5f39 status: 200 OK code: 200 duration: "" - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - 6cec1f0a-20ed-4e05-a6c1-8b413efdb630 + - 71db8764-daa2-4be0-a4bb-57f115acaa87 status: 200 OK code: 200 duration: "" @@ -80,30 +75,27 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys?order_by=created_at_asc&page=1 + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1 method: GET response: - body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc","name":"rleone@scaleway.com","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-03-29T07:50:11.839583Z","updated_at":"2022-03-29T07:50:17.762922Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"01b5a42f-31d0-4a08-b239-7c452490315c","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-20T16:47:46.265496Z","updated_at":"2022-04-20T16:47:46.265496Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"16f762bf-41a5-4018-a7bb-a1a4e70e5206","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-27T17:40:45.047682Z","updated_at":"2022-04-27T17:40:45.047682Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"fd3be52e-c218-4489-b09d-c2362256c19e","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 + body: '{"ssh_keys":[{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"b5031816-c15a-4b0a-945d-e22b60228077","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE foobar@foobar","fingerprint":"256 - MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.569521Z","updated_at":"2022-05-17T15:46:09.569521Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"f293da9e-f8d9-4f77-962a-65ac09536370","name":"","public_key":"ssh-ed25519 + MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.370383Z","updated_at":"2023-02-20T14:47:54.370383Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"cb3d0e42-1441-4b90-89a7-74ff85ea5f4e","name":"key-nostalgic-kalam","public_key":"ssh-ed25519 + AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.460075Z","updated_at":"2023-02-20T14:47:54.460075Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"34caa2f1-cd4c-4cbe-b315-2522ac7925e6","name":"key-friendly-kare","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 - MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.668473Z","updated_at":"2022-05-17T15:46:09.668473Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}],"total_count":5}' + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.461997Z","updated_at":"2023-02-20T14:47:54.461997Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}],"total_count":4}' headers: - Content-Length: - - "2747" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -113,7 +105,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 021bf4a4-1ce1-429e-9fdb-e791cd913a14 + - e1d441ad-f59f-4eb5-aa64-dc45779aea25 status: 200 OK code: 200 duration: "" @@ -122,30 +114,27 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys?order_by=created_at_asc&page=1 + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1 method: GET response: - body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc","name":"rleone@scaleway.com","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-03-29T07:50:11.839583Z","updated_at":"2022-03-29T07:50:17.762922Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"01b5a42f-31d0-4a08-b239-7c452490315c","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-20T16:47:46.265496Z","updated_at":"2022-04-20T16:47:46.265496Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"16f762bf-41a5-4018-a7bb-a1a4e70e5206","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-27T17:40:45.047682Z","updated_at":"2022-04-27T17:40:45.047682Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"fd3be52e-c218-4489-b09d-c2362256c19e","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 + body: '{"ssh_keys":[{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"b5031816-c15a-4b0a-945d-e22b60228077","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE foobar@foobar","fingerprint":"256 - MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.569521Z","updated_at":"2022-05-17T15:46:09.569521Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"f293da9e-f8d9-4f77-962a-65ac09536370","name":"","public_key":"ssh-ed25519 + MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.370383Z","updated_at":"2023-02-20T14:47:54.370383Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"cb3d0e42-1441-4b90-89a7-74ff85ea5f4e","name":"key-nostalgic-kalam","public_key":"ssh-ed25519 + AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.460075Z","updated_at":"2023-02-20T14:47:54.460075Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"34caa2f1-cd4c-4cbe-b315-2522ac7925e6","name":"key-friendly-kare","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 - MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.668473Z","updated_at":"2022-05-17T15:46:09.668473Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}],"total_count":5}' + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.461997Z","updated_at":"2023-02-20T14:47:54.461997Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}],"total_count":4}' headers: - Content-Length: - - "2747" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -155,7 +144,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - ba751e93-6cc3-4132-b41e-5e35687fc93c + - 049136e6-a318-4de7-ac8c-717b8bc067d4 status: 200 OK code: 200 duration: "" @@ -164,8 +153,8 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-key/fd3be52e-c218-4489-b09d-c2362256c19e + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys/b5031816-c15a-4b0a-945d-e22b60228077 method: DELETE response: body: "" @@ -175,7 +164,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -185,7 +174,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - d74ca901-763a-4a7f-8931-f3850d22a3b7 + - 0b5837ba-8a71-4d99-91f5-1b80cb2a6296 status: 204 No Content code: 204 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-ssh-key-unregistered.cassette.yaml b/internal/namespaces/init/testdata/test-init-ssh-key-unregistered.cassette.yaml index 9c06d453f1..e38f148590 100644 --- a/internal/namespaces/init/testdata/test-init-ssh-key-unregistered.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-ssh-key-unregistered.cassette.yaml @@ -1,70 +1,25 @@ --- version: 1 interactions: -- request: - body: "" - form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 - method: GET - response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' - headers: - Content-Length: - - "552" - Content-Security-Policy: - - default-src 'none'; frame-ancestors 'none' - Content-Type: - - application/json - Date: - - Tue, 17 May 2022 15:46:09 GMT - Server: - - Scaleway API-Gateway - Strict-Transport-Security: - - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - DENY - X-Request-Id: - - 1fdaeb68-a922-490e-acf5-eb5bbb426908 - status: 200 OK - code: 200 - duration: "" - request: body: "" form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys?order_by=created_at_asc&page=1 + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc","name":"rleone@scaleway.com","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-03-29T07:50:11.839583Z","updated_at":"2022-03-29T07:50:17.762922Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"01b5a42f-31d0-4a08-b239-7c452490315c","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-20T16:47:46.265496Z","updated_at":"2022-04-20T16:47:46.265496Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"16f762bf-41a5-4018-a7bb-a1a4e70e5206","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-27T17:40:45.047682Z","updated_at":"2022-04-27T17:40:45.047682Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"fd3be52e-c218-4489-b09d-c2362256c19e","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE foobar@foobar","fingerprint":"256 - MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.569521Z","updated_at":"2022-05-17T15:46:09.569521Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}],"total_count":4}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "2221" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 15:15:49 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -74,34 +29,43 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 64ab5065-c90c-48e0-8931-48a9f4ca36ff + - 6ce75a26-0b3b-4eaf-9a7a-a20f9ad7c8eb status: 200 OK code: 200 duration: "" - request: - body: '{"name":"","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg - foobar@foobar","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}' + body: "" form: {} headers: - Content-Type: - - application/json User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys - method: POST + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1 + method: GET response: - body: '{"id":"f293da9e-f8d9-4f77-962a-65ac09536370","name":"","public_key":"ssh-ed25519 + body: '{"ssh_keys":[{"id":"2da3ec1a-0d06-415d-924c-51b125501543","name":"Olivier","public_key":"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAACAQDE7p52JI0c0XBmnfO4N2zjR8yfiq3gluTikmeMWYs+2o0raz36Y5B++8MWiuRyuSdchK6JYAi1qHQBollA/a7UqWdM+GHoKBV2XKBr+nRFlSXDSFNPMA3p6I/1pRyY32Fs/lUVSsfOMJ2COcyQsZF38+qJgY/9d2OvmJI0tqo+1lQho1Y17I0n+rFS36R4EigyX15pK6/IJkOfeIcBrdDeZuxypZr/BBXWEd67+Xp4yf//75kGG+h/y+Q0cxJZL19zTs0XusDkhHfS96WrRYFh2vyYYIgsObt3CLTK5AtSzZrkY0+QxnydGpxKNZkZRNuO+q7l+3UBhllm5hpV2lJ8jgK+qzcxQLnIXnfttKcvfN3bB//X4yofWrDdkS6kzEBpYlEHnod738V1CFL+w2MpI8SD697INFr3qSZxVlDFTQNFHspUvNKaLVRmWBkzClZ+YTXmCRzDw++aspMNRKMMP3VpQWDDPUoBuiYu7eCiA9p1jOE7ZIJo8QAOLYQCGLOyO7aI+/GTeB+y3l/C6Ygn7v/frmY4gmnxRNe7glemKWFPFqcwLPM8LpUAQhiXsCnE0/YVB35SB3zJenHttw7sJ01C8NI2FxV265hah5bBdXO850TO2x/9W13OeGoPFwwTtCnRU6TV6s4QL0+8kVVlUavYMeAz/S1QxERZI/q2VQ== + ocano@MacBook-Pro-de-Olivier.local","fingerprint":"4096 MD5:b7:3d:ef:fa:38:c7:35:4e:17:ad:81:03:70:e7:1c:d4 + ocano@MacBook-Pro-de-Olivier.local (ssh-rsa)","created_at":"2022-11-17T14:39:42.418284Z","updated_at":"2022-11-17T14:39:42.418284Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"98e729db-3f23-4172-9729-a3c0cb6e4c72","disabled":false},{"id":"bb9ab03f-cfa2-4a10-bbb8-b3c302677ccf","name":"matthias","public_key":"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABgQDQmEcYD6rO+FhMDQWbowKtZZnKYq6jNMWrFf1bb17ic/qsk72oIVQXGNBHUzKoQ1q/G90ZHdUe8mrr/DPnMx9oDeQQxON1yL4iAGwd5UH7gNQLmzrVgxEQvwSvRa5K2NokhhE0QS6YR5tQq/PpyE0Jba1Jdfh/aC0rBgdusk4EFA94DUw9Rk0hT5xA2rFkfCHPHN+mlInK4VTcYqTiNQBbm+TfrDJONCXjflvVJUXZAYc45DPbhAnELZ5vi2qp7b5T+Fbhydb5fljlEqF+ZpuTtKaR+JecvA7jcEd+Oal+JMT3RKUcTuJ0mYevu46TvTZ4rugZ3hbK1GkERtfRtWQUd9R2MYlFWSGwPvgq4MHDpG6IKDdLg+wnfT3/xHN83oZKYok60F9CaxipiLYOvOohJbS6d+BQ3ho0NhcubCHvHDnOCioHXq8tRdhqMz9gCtRyPM81KWxMP/GEB/LjZqPQHbQDRaZHiTpBvyAmofTumwNG5ynsHKRl+3gS7G0Sk+k= + mprost@Matthiass-MacBook-Pro.local","fingerprint":"3072 MD5:a7:47:c4:bc:af:33:d2:e7:45:aa:1d:e7:13:9d:22:7a + mprost@Matthiass-MacBook-Pro.local (ssh-rsa)","created_at":"2022-11-21T10:03:35.871283Z","updated_at":"2022-11-21T10:03:35.871283Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"98e729db-3f23-4172-9729-a3c0cb6e4c72","disabled":false},{"id":"c9055c27-1d34-4db6-a0b0-e4c7cdf20f12","name":"foobar","public_key":"ssh-ed25519 + AAAAC3NzaC1lZDI1NTE5AAAAIJHiThf999h+6ioK06c81vqbS00lUHRHJBvabjnYFB+Z foobar","fingerprint":"256 + MD5:5d:0a:a2:67:7c:df:49:80:96:d8:60:91:20:cd:00:d8 foobar (ssh-ed25519)","created_at":"2023-02-08T13:01:58.526707Z","updated_at":"2023-02-08T13:01:58.526707Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"b3ab103a-4121-412f-b9ca-d26e486bd0c8","name":"key-vigorous-sanderson","public_key":"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQCtgC9e4/orbRdBCJpsZsLxpkU/SioOKZuOsQJfl6++QmYzOaMBDzdk7HNWG/Vt+2TT75cxpH5eB5emEOZywzQF8/36SMQwxeYlAgC6Gigx+CNp6//GQqDPcMPBaxhkj3K1DAm2XNyk/B0QPUwxBr2VDrZfVa371inyDXWqwF0pqV/Zju8QFKoROkYPxvXrIva2FI7nXIwDxU0J+HQGRB1wSMDnnD3xMsmKV+27XoHBxj6EDV++41RUtuKiHQMWuoXAFrQlq0O/3ADwX8UNq0bKG9lngpQUuy3X+I0PUiZCw5jL0lOskT14kfoZ6Uq0uBT/O4Xa3hSQiGzLRPZH9863 + foobar@foobar.local","fingerprint":"2048 MD5:ea:16:29:03:e0:c3:44:e8:c7:b4:be:79:da:8b:fa:46 + foobar@foobar.local (ssh-rsa)","created_at":"2023-02-15T15:28:07.051260Z","updated_at":"2023-02-15T15:28:07.051260Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"cb3d0e42-1441-4b90-89a7-74ff85ea5f4e","name":"key-nostalgic-kalam","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 - MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.668473Z","updated_at":"2022-05-17T15:46:09.668473Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}' + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.460075Z","updated_at":"2023-02-20T14:47:54.460075Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}],"total_count":6}' headers: - Content-Length: - - "525" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 15:15:49 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -111,7 +75,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 338d2fca-eb43-49bc-8a57-aaf734bff3b2 + - 2a9304cd-2786-4888-a658-d8e69c16a4e3 status: 200 OK code: 200 duration: "" @@ -120,30 +84,34 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys?order_by=created_at_asc&page=1 + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1 method: GET response: - body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc","name":"rleone@scaleway.com","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-03-29T07:50:11.839583Z","updated_at":"2022-03-29T07:50:17.762922Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"01b5a42f-31d0-4a08-b239-7c452490315c","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-20T16:47:46.265496Z","updated_at":"2022-04-20T16:47:46.265496Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"16f762bf-41a5-4018-a7bb-a1a4e70e5206","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-27T17:40:45.047682Z","updated_at":"2022-04-27T17:40:45.047682Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"fd3be52e-c218-4489-b09d-c2362256c19e","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE foobar@foobar","fingerprint":"256 - MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.569521Z","updated_at":"2022-05-17T15:46:09.569521Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"f293da9e-f8d9-4f77-962a-65ac09536370","name":"","public_key":"ssh-ed25519 + body: '{"ssh_keys":[{"id":"2da3ec1a-0d06-415d-924c-51b125501543","name":"Olivier","public_key":"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAACAQDE7p52JI0c0XBmnfO4N2zjR8yfiq3gluTikmeMWYs+2o0raz36Y5B++8MWiuRyuSdchK6JYAi1qHQBollA/a7UqWdM+GHoKBV2XKBr+nRFlSXDSFNPMA3p6I/1pRyY32Fs/lUVSsfOMJ2COcyQsZF38+qJgY/9d2OvmJI0tqo+1lQho1Y17I0n+rFS36R4EigyX15pK6/IJkOfeIcBrdDeZuxypZr/BBXWEd67+Xp4yf//75kGG+h/y+Q0cxJZL19zTs0XusDkhHfS96WrRYFh2vyYYIgsObt3CLTK5AtSzZrkY0+QxnydGpxKNZkZRNuO+q7l+3UBhllm5hpV2lJ8jgK+qzcxQLnIXnfttKcvfN3bB//X4yofWrDdkS6kzEBpYlEHnod738V1CFL+w2MpI8SD697INFr3qSZxVlDFTQNFHspUvNKaLVRmWBkzClZ+YTXmCRzDw++aspMNRKMMP3VpQWDDPUoBuiYu7eCiA9p1jOE7ZIJo8QAOLYQCGLOyO7aI+/GTeB+y3l/C6Ygn7v/frmY4gmnxRNe7glemKWFPFqcwLPM8LpUAQhiXsCnE0/YVB35SB3zJenHttw7sJ01C8NI2FxV265hah5bBdXO850TO2x/9W13OeGoPFwwTtCnRU6TV6s4QL0+8kVVlUavYMeAz/S1QxERZI/q2VQ== + ocano@MacBook-Pro-de-Olivier.local","fingerprint":"4096 MD5:b7:3d:ef:fa:38:c7:35:4e:17:ad:81:03:70:e7:1c:d4 + ocano@MacBook-Pro-de-Olivier.local (ssh-rsa)","created_at":"2022-11-17T14:39:42.418284Z","updated_at":"2022-11-17T14:39:42.418284Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"98e729db-3f23-4172-9729-a3c0cb6e4c72","disabled":false},{"id":"bb9ab03f-cfa2-4a10-bbb8-b3c302677ccf","name":"matthias","public_key":"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABgQDQmEcYD6rO+FhMDQWbowKtZZnKYq6jNMWrFf1bb17ic/qsk72oIVQXGNBHUzKoQ1q/G90ZHdUe8mrr/DPnMx9oDeQQxON1yL4iAGwd5UH7gNQLmzrVgxEQvwSvRa5K2NokhhE0QS6YR5tQq/PpyE0Jba1Jdfh/aC0rBgdusk4EFA94DUw9Rk0hT5xA2rFkfCHPHN+mlInK4VTcYqTiNQBbm+TfrDJONCXjflvVJUXZAYc45DPbhAnELZ5vi2qp7b5T+Fbhydb5fljlEqF+ZpuTtKaR+JecvA7jcEd+Oal+JMT3RKUcTuJ0mYevu46TvTZ4rugZ3hbK1GkERtfRtWQUd9R2MYlFWSGwPvgq4MHDpG6IKDdLg+wnfT3/xHN83oZKYok60F9CaxipiLYOvOohJbS6d+BQ3ho0NhcubCHvHDnOCioHXq8tRdhqMz9gCtRyPM81KWxMP/GEB/LjZqPQHbQDRaZHiTpBvyAmofTumwNG5ynsHKRl+3gS7G0Sk+k= + mprost@Matthiass-MacBook-Pro.local","fingerprint":"3072 MD5:a7:47:c4:bc:af:33:d2:e7:45:aa:1d:e7:13:9d:22:7a + mprost@Matthiass-MacBook-Pro.local (ssh-rsa)","created_at":"2022-11-21T10:03:35.871283Z","updated_at":"2022-11-21T10:03:35.871283Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"98e729db-3f23-4172-9729-a3c0cb6e4c72","disabled":false},{"id":"c9055c27-1d34-4db6-a0b0-e4c7cdf20f12","name":"foobar","public_key":"ssh-ed25519 + AAAAC3NzaC1lZDI1NTE5AAAAIJHiThf999h+6ioK06c81vqbS00lUHRHJBvabjnYFB+Z foobar","fingerprint":"256 + MD5:5d:0a:a2:67:7c:df:49:80:96:d8:60:91:20:cd:00:d8 foobar (ssh-ed25519)","created_at":"2023-02-08T13:01:58.526707Z","updated_at":"2023-02-08T13:01:58.526707Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"b3ab103a-4121-412f-b9ca-d26e486bd0c8","name":"key-vigorous-sanderson","public_key":"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQCtgC9e4/orbRdBCJpsZsLxpkU/SioOKZuOsQJfl6++QmYzOaMBDzdk7HNWG/Vt+2TT75cxpH5eB5emEOZywzQF8/36SMQwxeYlAgC6Gigx+CNp6//GQqDPcMPBaxhkj3K1DAm2XNyk/B0QPUwxBr2VDrZfVa371inyDXWqwF0pqV/Zju8QFKoROkYPxvXrIva2FI7nXIwDxU0J+HQGRB1wSMDnnD3xMsmKV+27XoHBxj6EDV++41RUtuKiHQMWuoXAFrQlq0O/3ADwX8UNq0bKG9lngpQUuy3X+I0PUiZCw5jL0lOskT14kfoZ6Uq0uBT/O4Xa3hSQiGzLRPZH9863 + foobar@foobar.local","fingerprint":"2048 MD5:ea:16:29:03:e0:c3:44:e8:c7:b4:be:79:da:8b:fa:46 + foobar@foobar.local (ssh-rsa)","created_at":"2023-02-15T15:28:07.051260Z","updated_at":"2023-02-15T15:28:07.051260Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"cb3d0e42-1441-4b90-89a7-74ff85ea5f4e","name":"key-nostalgic-kalam","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 - MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2022-05-17T15:46:09.668473Z","updated_at":"2022-05-17T15:46:09.668473Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}],"total_count":5}' + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.460075Z","updated_at":"2023-02-20T14:47:54.460075Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}],"total_count":6}' headers: - Content-Length: - - "2747" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 15:15:49 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -153,7 +121,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 3011be7e-9f37-49ae-802e-feed37ddf94c + - 331d149a-97af-4931-8a83-0bbc011876d8 status: 200 OK code: 200 duration: "" @@ -162,8 +130,8 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-key/f293da9e-f8d9-4f77-962a-65ac09536370 + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys/cb3d0e42-1441-4b90-89a7-74ff85ea5f4e method: DELETE response: body: "" @@ -173,7 +141,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 15:15:49 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -183,7 +151,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 0fd78903-64b8-4977-900c-96d71b68b3bb + - 880fddc0-07a8-4a69-a6ce-bae44b5958f4 status: 204 No Content code: 204 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-ssh-no-local-key.cassette.yaml b/internal/namespaces/init/testdata/test-init-ssh-no-local-key.cassette.yaml index d257de889b..856ca7776f 100644 --- a/internal/namespaces/init/testdata/test-init-ssh-no-local-key.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-ssh-no-local-key.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Tue, 17 May 2022 15:46:09 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - bd1bb7a7-e168-401c-9217-ff427444e36c + - e4abfa23-56df-4126-9147-a4a7e7dc8295 status: 200 OK code: 200 duration: "" diff --git a/internal/namespaces/init/testdata/test-init-ssh-with-local-ed25519-key.cassette.yaml b/internal/namespaces/init/testdata/test-init-ssh-with-local-ed25519-key.cassette.yaml index f04a0b5265..685b1127b2 100644 --- a/internal/namespaces/init/testdata/test-init-ssh-with-local-ed25519-key.cassette.yaml +++ b/internal/namespaces/init/testdata/test-init-ssh-with-local-ed25519-key.cassette.yaml @@ -4,37 +4,32 @@ interactions: - request: body: "" form: {} - headers: {} - url: https://api.scaleway.com/account/v1/tokens/11111111-1111-1111-1111-111111111111 + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX method: GET response: - body: '{"token": {"access_key": "SCWFEREJ5D3PW6WTVEH1", "user_id": "721f2fde-1a01-4854-822b-fcca5638d73e", - "iam_user_id": null, "iam_application_id": null, "expires": null, "creation_date": - "2021-04-16T12:46:06.403601+00:00", "deletion_date": null, "creation_ip": "195.154.229.35", - "category": "user_created", "inherits_user_perms": false, "role_id": "5737d70a-84fc-46ce-ae5c-5d31170f733a", - "description": "sieben-macbook", "project_id": "951df375-e094-4d26-97c1-ba548eeb9c42", - "organization_id": "951df375-e094-4d26-97c1-ba548eeb9c42", "use_role_key": true}}' + body: '{"access_key":"SCWXXXXXXXXXXXXXXXXX","secret_key":null,"description":"default","created_at":"2023-02-08T13:37:42.867291Z","updated_at":"2023-02-08T13:37:42.867291Z","expires_at":null,"default_project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","editable":true,"creation_ip":"195.154.228.158","user_id":"284d6fc3-6cf7-485b-bd32-efa92c2335d9"}' headers: Content-Length: - - "552" + - "340" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Wed, 18 May 2022 15:25:42 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: - max-age=63072000 - Warning: - - 299 - "Deprecated API please use https://api.scaleway.com/account/v1" X-Content-Type-Options: - nosniff X-Frame-Options: - DENY X-Request-Id: - - 3083f9b4-2f54-4df2-8e33-55a60b3d3d1d + - 7af2110c-e34b-47de-b968-ca24857d7cfa status: 200 OK code: 200 duration: "" @@ -43,26 +38,23 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys?order_by=created_at_asc&page=1 + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1 method: GET response: - body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc","name":"rleone@scaleway.com","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-03-29T07:50:11.839583Z","updated_at":"2022-03-29T07:50:17.762922Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"01b5a42f-31d0-4a08-b239-7c452490315c","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-20T16:47:46.265496Z","updated_at":"2022-04-20T16:47:46.265496Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"16f762bf-41a5-4018-a7bb-a1a4e70e5206","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-27T17:40:45.047682Z","updated_at":"2022-04-27T17:40:45.047682Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}],"total_count":3}' + body: '{"ssh_keys":[{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"b5031816-c15a-4b0a-945d-e22b60228077","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 + AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE foobar@foobar","fingerprint":"256 + MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.370383Z","updated_at":"2023-02-20T14:47:54.370383Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}],"total_count":2}' headers: - Content-Length: - - "1673" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Wed, 18 May 2022 15:25:42 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -72,34 +64,34 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - ffec9783-2fa2-45d4-bbf0-e570b5168697 + - 821d8967-1ea2-491e-bb04-f26ab5059daa status: 200 OK code: 200 duration: "" - request: - body: '{"name":"","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg - foobar@foobar","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}' + body: '{"name":"key-nostalgic-kalam","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg + foobar@foobar","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a"}' form: {} headers: Content-Type: - application/json User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys method: POST response: - body: '{"id":"33abd263-5b89-4650-ab19-f38ca59bb78f","name":"","public_key":"ssh-ed25519 + body: '{"id":"cb3d0e42-1441-4b90-89a7-74ff85ea5f4e","name":"key-nostalgic-kalam","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 - MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2022-05-18T15:25:42.683445Z","updated_at":"2022-05-18T15:25:42.683445Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}' + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.460075Z","updated_at":"2023-02-20T14:47:54.460075Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}' headers: Content-Length: - - "525" + - "496" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Wed, 18 May 2022 15:25:42 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -109,7 +101,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 5174053d-3bf6-4799-84b2-c573069a12ac + - e3eea3c8-47fd-4830-9134-287d3665e1f2 status: 200 OK code: 200 duration: "" @@ -118,28 +110,27 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-keys?order_by=created_at_asc&page=1 + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1 method: GET response: - body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc","name":"rleone@scaleway.com","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-03-29T07:50:11.839583Z","updated_at":"2022-03-29T07:50:17.762922Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"01b5a42f-31d0-4a08-b239-7c452490315c","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-20T16:47:46.265496Z","updated_at":"2022-04-20T16:47:46.265496Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"16f762bf-41a5-4018-a7bb-a1a4e70e5206","name":"pouet","public_key":"ssh-ed25519 - AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl rleone@scaleway.com","fingerprint":"256 - MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55 rleone@scaleway.com (ssh-ed25519)","created_at":"2022-04-27T17:40:45.047682Z","updated_at":"2022-04-27T17:40:45.047682Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"},{"id":"33abd263-5b89-4650-ab19-f38ca59bb78f","name":"","public_key":"ssh-ed25519 + body: '{"ssh_keys":[{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 + AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= + foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44 + foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"b5031816-c15a-4b0a-945d-e22b60228077","name":"test-cli-KeyRegistered","public_key":"ssh-ed25519 + AAAAC3NzaC1lZDI1NTE5AAAAICd8ZxAm9mXQsRHhQ5iADEJuO+Ai8EbXMI7TIlsh9jbE foobar@foobar","fingerprint":"256 + MD5:2e:c9:d3:87:1c:04:5f:c8:86:0c:08:4d:34:3f:ff:4c foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.370383Z","updated_at":"2023-02-20T14:47:54.370383Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"cb3d0e42-1441-4b90-89a7-74ff85ea5f4e","name":"key-nostalgic-kalam","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 - MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2022-05-18T15:25:42.683445Z","updated_at":"2022-05-18T15:25:42.683445Z","creation_info":{"address":"","user_agent":"","country_code":""},"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","project_id":"951df375-e094-4d26-97c1-ba548eeb9c42"}],"total_count":4}' + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.460075Z","updated_at":"2023-02-20T14:47:54.460075Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false},{"id":"34caa2f1-cd4c-4cbe-b315-2522ac7925e6","name":"key-friendly-kare","public_key":"ssh-ed25519 + AAAAC3NzaC1lZDI1NTE5AAAAIIQE67HxSRicWd4ol7ntM2jdeD/qEehPJxK/3thmMiZg foobar@foobar","fingerprint":"256 + MD5:ea:c1:a1:82:4b:41:2b:65:26:9c:18:27:da:0d:bd:91 foobar@foobar (ssh-ed25519)","created_at":"2023-02-20T14:47:54.461997Z","updated_at":"2023-02-20T14:47:54.461997Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}],"total_count":4}' headers: - Content-Length: - - "2199" Content-Security-Policy: - default-src 'none'; frame-ancestors 'none' Content-Type: - application/json Date: - - Wed, 18 May 2022 15:25:42 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -149,7 +140,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 7974bbb1-0d9c-4f26-b829-63566e488c10 + - c6af86a9-745c-4669-9848-2a2853cbfcc7 status: 200 OK code: 200 duration: "" @@ -158,8 +149,8 @@ interactions: form: {} headers: User-Agent: - - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.18.2; darwin; amd64) cli-e2e-test - url: https://api.scaleway.com/account/v2alpha1/ssh-key/33abd263-5b89-4650-ab19-f38ca59bb78f + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/ssh-keys/34caa2f1-cd4c-4cbe-b315-2522ac7925e6 method: DELETE response: body: "" @@ -169,7 +160,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 18 May 2022 15:25:42 GMT + - Mon, 20 Feb 2023 14:47:54 GMT Server: - Scaleway API-Gateway Strict-Transport-Security: @@ -179,7 +170,7 @@ interactions: X-Frame-Options: - DENY X-Request-Id: - - 972e989b-fd13-48f2-af80-1af61b23419b + - bb2c59a8-1002-4eaf-91ed-09bfc942a5bb status: 204 No Content code: 204 duration: ""