@@ -2,6 +2,7 @@ package iam
2
2
3
3
import (
4
4
"context"
5
+ "errors"
5
6
"fmt"
6
7
"reflect"
7
8
@@ -61,15 +62,16 @@ func (a applicationEntity) entityType(ctx context.Context, api *iam.API) (string
61
62
62
63
func buildEntity (apiKey * iam.APIKey ) (entity , error ) {
63
64
if apiKey == nil {
64
- return nil , fmt . Errorf ("invalid API key" )
65
+ return nil , errors . New ("invalid API key" )
65
66
}
66
67
if apiKey .UserID != nil {
67
68
return userEntity {UserID : * apiKey .UserID }, nil
68
69
}
69
70
if apiKey .ApplicationID != nil {
70
71
return applicationEntity {ApplicationID : * apiKey .ApplicationID }, nil
71
72
}
72
- return nil , fmt .Errorf ("invalid API key" )
73
+
74
+ return nil , errors .New ("invalid API key" )
73
75
}
74
76
75
77
func (u userEntity ) getPolicies (ctx context.Context , api * iam.API ) ([]* iam.Policy , error ) {
@@ -79,6 +81,7 @@ func (u userEntity) getPolicies(ctx context.Context, api *iam.API) ([]*iam.Polic
79
81
if err != nil {
80
82
return nil , err
81
83
}
84
+
82
85
return policies .Policies , nil
83
86
}
84
87
@@ -89,6 +92,7 @@ func (a applicationEntity) getPolicies(ctx context.Context, api *iam.API) ([]*ia
89
92
if err != nil {
90
93
return nil , err
91
94
}
95
+
92
96
return policies .Policies , nil
93
97
}
94
98
@@ -120,10 +124,7 @@ func getApiKey(
120
124
response .EntityType = entityType
121
125
122
126
if entityType == string (iam .UserTypeOwner ) {
123
- response .EntityType = fmt .Sprintf (
124
- "%s (owner has all permissions over the organization)" ,
125
- entityType ,
126
- )
127
+ response .EntityType = entityType + " (owner has all permissions over the organization)"
127
128
128
129
return response , nil
129
130
}
0 commit comments