Skip to content

Commit

Permalink
moving check inside getCloudMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Nov 18, 2020
1 parent eafc72b commit 97a885f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
13 changes: 0 additions & 13 deletions x-pack/plugins/infra/server/routes/inventory_metadata/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export const getCloudMetadata = async (
currentTime: number
): Promise<CloudMetaData> => {
const model = findInventoryModel(nodeType);
// Only run this for AWS modules, eventually we might have more.
if (model.requiredModule !== 'aws') {
return {
accounts: [],
projects: [],
regions: [],
};
}

const metricQuery = {
allowNoIndices: true,
Expand Down

0 comments on commit 97a885f

Please sign in to comment.