diff --git a/pkg/metadata/http_routes.go b/pkg/metadata/http_routes.go index e3b6d2540..65c85be75 100644 --- a/pkg/metadata/http_routes.go +++ b/pkg/metadata/http_routes.go @@ -857,6 +857,7 @@ func (h HttpHandler) SampleDataLoaded(echoCtx echo.Context) (bool, error) { integrations, err := integrationClient.ListIntegrations(ctx, nil) if err != nil { + h.logger.Error("failed to list integrations", zap.Error(err)) return false, echo.NewHTTPError(http.StatusInternalServerError, "failed to list integrations") } @@ -868,10 +869,11 @@ func (h HttpHandler) SampleDataLoaded(echoCtx echo.Context) (bool, error) { credentials, err := integrationClient.ListCredentials(ctx) if err != nil { + h.logger.Error("failed to list credentials", zap.Error(err)) return false, echo.NewHTTPError(http.StatusInternalServerError, "failed to list credentials") } credentialsMap := make(map[string]bool) - for _, c := range credentials { + for _, c := range credentials.Credentials { credentialsMap[c.ID] = true } diff --git a/services/integration/client/integration.go b/services/integration/client/integration.go index 4eb3f9184..4e427233b 100644 --- a/services/integration/client/integration.go +++ b/services/integration/client/integration.go @@ -16,7 +16,7 @@ type IntegrationServiceClient interface { ListIntegrationsByFilters(ctx *httpclient.Context, req models.ListIntegrationsRequest) (*models.ListIntegrationsResponse, error) IntegrationHealthcheck(ctx *httpclient.Context, integrationID string) (*models.Integration, error) GetCredential(ctx *httpclient.Context, credentialID string) (*models.Credential, error) - ListCredentials(ctx *httpclient.Context) ([]models.Credential, error) + ListCredentials(ctx *httpclient.Context) (models.ListCredentialsResponse, error) GetIntegrationGroup(ctx *httpclient.Context, integrationGroupName string) (*models.IntegrationGroup, error) ListIntegrationGroups(ctx *httpclient.Context) ([]models.IntegrationGroup, error) } @@ -96,9 +96,9 @@ func (c *integrationClient) GetCredential(ctx *httpclient.Context, credentialID return response, nil } -func (c *integrationClient) ListCredentials(ctx *httpclient.Context) ([]models.Credential, error) { +func (c *integrationClient) ListCredentials(ctx *httpclient.Context) (models.ListCredentialsResponse, error) { url := fmt.Sprintf("%s/api/v1/credentials", c.baseURL) - var response []models.Credential + var response models.ListCredentialsResponse if statusCode, err := httpclient.DoRequest(ctx.Ctx, http.MethodGet, url, ctx.ToHeaders(), nil, &response); err != nil { if 400 <= statusCode && statusCode < 500 {