Skip to content

Commit

Permalink
[Log Explorer] Explicitly set Fleet API version for Datasets service (e…
Browse files Browse the repository at this point in the history
…lastic#168202)

## 📓 Summary

These changes set an explicit version of the Fleet API when consumed by
the Log Explorer to prevent API failures while developing locally due to
the missing configuration parameter `server.versioned.versionResolution:
oldest`

Co-authored-by: Marco Antonio Ghiani <[email protected]>
  • Loading branch information
tonyghiani and Marco Antonio Ghiani authored Oct 6, 2023
1 parent 377a3e4 commit 3d77448
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import { HttpStart } from '@kbn/core/public';

import { API_VERSIONS } from '@kbn/fleet-plugin/common';
import { Dataset, Integration } from '../../../common/datasets';
import {
DATASETS_URL,
Expand Down Expand Up @@ -43,9 +44,11 @@ export class DatasetsClient implements IDatasetsClient {

const query = findIntegrationsRequestQueryRT.encode(search);

const response = await this.http.get(INTEGRATIONS_URL, { query }).catch((error) => {
throw new FindIntegrationsError(`Failed to fetch integrations": ${error}`);
});
const response = await this.http
.get(INTEGRATIONS_URL, { query, version: API_VERSIONS.public.v1 })
.catch((error) => {
throw new FindIntegrationsError(`Failed to fetch integrations": ${error}`);
});

const data = decodeOrThrow(
findIntegrationsResponseRT,
Expand All @@ -61,9 +64,11 @@ export class DatasetsClient implements IDatasetsClient {

const query = findDatasetsRequestQueryRT.encode(search);

const response = await this.http.get(DATASETS_URL, { query }).catch((error) => {
throw new FindDatasetsError(`Failed to fetch data streams": ${error}`);
});
const response = await this.http
.get(DATASETS_URL, { query, version: API_VERSIONS.public.v1 })
.catch((error) => {
throw new FindDatasetsError(`Failed to fetch data streams": ${error}`);
});

const data = decodeOrThrow(
findDatasetsResponseRT,
Expand Down

0 comments on commit 3d77448

Please sign in to comment.