Chore: Remove Result field from serviceaccounts, ualert (#62476)

* Chore: Remove Result field from serviceaccounts
* Chore: Remove Result field from ualert
This commit is contained in:
suntala
2023-01-31 09:51:55 +01:00
committed by GitHub
parent d3897b612f
commit 51bef166c2
13 changed files with 37 additions and 43 deletions

View File

@@ -206,9 +206,9 @@ func (sa *ServiceAccountsService) ListTokens(ctx context.Context, query *service
return sa.store.ListTokens(ctx, query)
}
func (sa *ServiceAccountsService) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, query *serviceaccounts.AddServiceAccountTokenCommand) error {
func (sa *ServiceAccountsService) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, query *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error) {
if err := validServiceAccountID(serviceAccountID); err != nil {
return err
return nil, err
}
return sa.store.AddServiceAccountToken(ctx, serviceAccountID, query)
}

View File

@@ -19,7 +19,8 @@ type FakeServiceAccountStore struct {
ExpectedSearchServiceAccountQueryResult *serviceaccounts.SearchOrgServiceAccountsResult
ExpectedServiceAccountMigrationStatus *serviceaccounts.APIKeysMigrationStatus
ExpectedStats *serviceaccounts.Stats
ExpectedApiKeys []apikey.APIKey
ExpectedAPIKeys []apikey.APIKey
ExpectedAPIKey *apikey.APIKey
ExpectedError error
}
@@ -85,7 +86,7 @@ func (f *FakeServiceAccountStore) RevertApiKey(ctx context.Context, saId int64,
// ListTokens is a fake listing tokens.
func (f *FakeServiceAccountStore) ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error) {
return f.ExpectedApiKeys, f.ExpectedError
return f.ExpectedAPIKeys, f.ExpectedError
}
// RevokeServiceAccountToken is a fake revoking a service account token.
@@ -94,8 +95,8 @@ func (f *FakeServiceAccountStore) RevokeServiceAccountToken(ctx context.Context,
}
// AddServiceAccountToken is a fake adding a service account token.
func (f *FakeServiceAccountStore) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) error {
return f.ExpectedError
func (f *FakeServiceAccountStore) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error) {
return f.ExpectedAPIKey, f.ExpectedError
}
// DeleteServiceAccountToken is a fake deleting a service account token.

View File

@@ -33,7 +33,7 @@ type store interface {
RevertApiKey(ctx context.Context, saId int64, keyId int64) error
ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)
RevokeServiceAccountToken(ctx context.Context, orgId, serviceAccountId, tokenId int64) error
AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) error
AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error)
DeleteServiceAccountToken(ctx context.Context, orgID, serviceAccountID, tokenID int64) error
GetUsageMetrics(ctx context.Context) (*serviceaccounts.Stats, error)
}