@@ -2,6 +2,7 @@ package iam
22
33import (
44 "context"
5+ "errors"
56 "fmt"
67 "reflect"
78
@@ -61,15 +62,16 @@ func (a applicationEntity) entityType(ctx context.Context, api *iam.API) (string
6162
6263func buildEntity (apiKey * iam.APIKey ) (entity , error ) {
6364 if apiKey == nil {
64- return nil , fmt . Errorf ("invalid API key" )
65+ return nil , errors . New ("invalid API key" )
6566 }
6667 if apiKey .UserID != nil {
6768 return userEntity {UserID : * apiKey .UserID }, nil
6869 }
6970 if apiKey .ApplicationID != nil {
7071 return applicationEntity {ApplicationID : * apiKey .ApplicationID }, nil
7172 }
72- return nil , fmt .Errorf ("invalid API key" )
73+
74+ return nil , errors .New ("invalid API key" )
7375}
7476
7577func (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
7981 if err != nil {
8082 return nil , err
8183 }
84+
8285 return policies .Policies , nil
8386}
8487
@@ -89,6 +92,7 @@ func (a applicationEntity) getPolicies(ctx context.Context, api *iam.API) ([]*ia
8992 if err != nil {
9093 return nil , err
9194 }
95+
9296 return policies .Policies , nil
9397}
9498
@@ -120,10 +124,7 @@ func getApiKey(
120124 response .EntityType = entityType
121125
122126 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)"
127128
128129 return response , nil
129130 }
0 commit comments