Skip to content
Snippets Groups Projects

feat: rotate personal, project or group access tokens

1 unresolved thread
2 files
+ 5
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -41,11 +41,11 @@ func NewCmdRotate(f *cmdutils.Factory, runE func(opts *RotateOptions) error) *co
cmd := &cobra.Command{
Use: "rotate <token-name|token-id>",
Short: "Rotate user, group or project access tokens.",
Short: "Rotate user, group, or project access tokens",
Aliases: []string{"rotate", "rot"},
Args: cobra.RangeArgs(1, 1),
Long: heredoc.Doc(`
Rotate an user, group or project access token and print the new token on stdout. If multiple tokens with
Rotate user, group, or project access token, then print the new token on stdout. If multiple tokens with
the same name exist, you can specify the ID of the token.
The expiration date of the token will be calculated by adding the duration (default 30 days) to the
@@ -154,7 +154,7 @@ func rotateTokenRun(opts *RotateOptions) error {
case 0:
return cmdutils.FlagError{Err: fmt.Errorf("no token found with the name '%v'", opts.Name)}
default:
return cmdutils.FlagError{Err: fmt.Errorf("multiple tokens found with the name '%v', use the ID instead", opts.Name)}
return cmdutils.FlagError{Err: fmt.Errorf("multiple tokens found with the name '%v'. Use the ID instead.", opts.Name)}
}
rotateOptions := &gitlab.RotatePersonalAccessTokenOptions{
ExpiresAt: &expirationDate,
Loading