-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(iam): replace account on init command #2778
feat(iam): replace account on init command #2778
Conversation
073be65
to
2d09007
Compare
2d09007
to
0d70000
Compare
5310fec
to
0723af1
Compare
Codecov Report
@@ Coverage Diff @@
## master #2778 +/- ##
==========================================
+ Coverage 75.15% 75.18% +0.02%
==========================================
Files 134 137 +3
Lines 26083 27805 +1722
==========================================
+ Hits 19603 20904 +1301
- Misses 5810 6186 +376
- Partials 670 715 +45
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't mean anything. Could you rephrase to something like, scan for ssh keys on your local machine and send them to your scaleway account.
@@ -0,0 +1,15 @@ | |||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | |||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | |||
Initialize SSH key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to chance the phrasing here.
@@ -4,7 +4,7 @@ USAGE: | |||
scw <command> | |||
|
|||
AVAILABLE COMMANDS: | |||
account Account API | |||
account User related data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the phrasing here too.
@@ -54,7 +53,6 @@ func GetCommands(beta ...bool) *core.Commands { | |||
marketplace.GetCommands(), | |||
initNamespace.GetCommands(), | |||
configNamespace.GetCommands(), | |||
account.GetCommands(), | |||
accountv2.GetCommands(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have one account. Rename it to simply account or avoid renaming entirely if possible.
@@ -736,6 +737,18 @@ scw iam ssh-key get <ssh-key-id ...> [arg=value ...] | |||
|
|||
|
|||
|
|||
### Initialize SSH key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change phrasing
"io" | ||
"net/http" | ||
) | ||
|
||
// Token represents a Token | ||
type Token struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is token maintained in this package? Should we use only the one in the IAM package?
@@ -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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems weird that we have to delete this code. Why? Why does using IAM instead of accountv2 impact this function?
var shortenedFilename string | ||
var err error | ||
var localSSHKeyContent []byte | ||
for _, keyName := range [3]string{"id_ecdsa.pub", "id_ed25519.pub", "id_rsa.pub"} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract this in a dedicated variable
@@ -150,6 +155,14 @@ Default path for configuration file is based on the following priority order: | |||
} | |||
} | |||
|
|||
if args.AccessKey == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed?
@@ -342,6 +358,38 @@ func promptSecret(ctx context.Context) (string, error) { | |||
} | |||
} | |||
|
|||
func promptAccessKey(ctx context.Context) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change required? access key can be found once you got the secret key.
also support if key does not have permissions to fetch himself
Community Note
Relates OR Closes #0000
Release note for CHANGELOG: