Add APIs to import/export IAM data (#15014)

This commit is contained in:
Poorna
2022-06-23 09:25:15 -07:00
committed by GitHub
parent 42e2fd35d8
commit 580d9db85e
6 changed files with 696 additions and 5 deletions

View File

@@ -240,3 +240,11 @@ func importError(ctx context.Context, err error, fname, entity string) APIError
}
return toAPIError(ctx, fmt.Errorf("error importing %s from %s with: %w", entity, fname, err))
}
// wraps import error for more context
func importErrorWithAPIErr(ctx context.Context, apiErr APIErrorCode, err error, fname, entity string) APIError {
if entity == "" {
return errorCodes.ToAPIErrWithErr(apiErr, fmt.Errorf("error importing %s with: %w", fname, err))
}
return errorCodes.ToAPIErrWithErr(apiErr, fmt.Errorf("error importing %s from %s with: %w", entity, fname, err))
}