Skip to content

Commit 125fecd

Browse files
committed
rename functions to make more sense
1 parent 97be25b commit 125fecd

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

internal/token/scope.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (i Scope) Value() string {
145145
return i.String()
146146
}
147147

148-
func ScopeParse(value string) (Scope, error) {
148+
func ParseScope(value string) (Scope, error) {
149149
if slices.Contains(ValidGroupTokenScopes, value) ||
150150
slices.Contains(ValidPipelineProjectTokenScopes, value) ||
151151
slices.Contains(ValidGroupDeployTokenScopes, value) ||

internal/token/scope_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func TestTokenScope(t *testing.T) {
7979

8080
for _, test := range tests {
8181
t.Logf("assert parse(%s) = %s (err: %v)", test.input, test.expected, test.err)
82-
val, err := token.ScopeParse(test.input)
82+
val, err := token.ParseScope(test.input)
8383
assert.EqualValues(t, test.expected, val)
8484
assert.EqualValues(t, test.expected.Value(), test.expected.String())
8585
if test.err {

internal/token/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (i Type) Value() string {
4343
return i.String()
4444
}
4545

46-
func TypeParse(value string) (Type, error) {
46+
func ParseType(value string) (Type, error) {
4747
if slices.Contains(ValidTokenTypes, value) {
4848
return Type(value), nil
4949
}

internal/token/type_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestTokenType(t *testing.T) {
6363

6464
for _, test := range tests {
6565
t.Logf("assert parse(%s) = %s (err: %v)", test.input, test.expected, test.err)
66-
val, err := token.TypeParse(test.input)
66+
val, err := token.ParseType(test.input)
6767
assert.EqualValues(t, test.expected, val)
6868
assert.EqualValues(t, test.expected.Value(), test.expected.String())
6969
if test.err {

path_role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func (b *Backend) pathRolesWrite(ctx context.Context, req *logical.Request, data
220220
return logical.ErrorResponse(errs.ErrBackendNotConfigured.Error()), nil
221221
}
222222

223-
tokenType, _ = token.TypeParse(data.Get("token_type").(string))
223+
tokenType, _ = token.ParseType(data.Get("token_type").(string))
224224
accessLevel, _ = AccessLevelParse(data.Get("access_level").(string))
225225

226226
var role = EntryRole{

secret_access_tokens.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (b *Backend) secretAccessTokenRevoke(ctx context.Context, req *logical.Requ
8484
var parentId = req.Secret.InternalData["parent_id"].(string)
8585
var tokenType token.Type
8686
var tokenTypeValue = req.Secret.InternalData["token_type"].(string)
87-
tokenType, _ = token.TypeParse(tokenTypeValue)
87+
tokenType, _ = token.ParseType(tokenTypeValue)
8888

8989
if vaultRevokesToken {
9090
var client Client

0 commit comments

Comments
 (0)