Skip to content

Commit

Permalink
Only query inventory metadata for AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Nov 18, 2020
1 parent b2daf3d commit eafc72b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions x-pack/plugins/infra/server/routes/inventory_metadata/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Boom from '@hapi/boom';
import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { findInventoryModel } from '../../../common/inventory_models';
import { InfraBackendLibs } from '../../lib/infra_types';
import { throwErrors } from '../../../common/runtime_types';

Expand Down Expand Up @@ -38,10 +39,24 @@ export const initInventoryMetaRoute = (libs: InfraBackendLibs) => {
fold(throwErrors(Boom.badRequest), identity)
);

const model = findInventoryModel(nodeType);

// Only run this for AWS modules, eventually we might have more.
if (model.requiredModule !== 'aws') {
return response.ok({
body: {
accounts: [],
projects: [],
regions: [],
},
});
}

const { configuration } = await libs.sources.getSourceConfiguration(
requestContext.core.savedObjects.client,
sourceId
);

const awsMetadata = await getCloudMetadata(
framework,
requestContext,
Expand Down

0 comments on commit eafc72b

Please sign in to comment.