kibana/x-pack/plugins/siem/public/common/hooks/api/api.tsx
Xavier Mouligneau bcfc02987f
[SIEMDPOINT] Move endpoint to siem (#66907)
* adds the stuff

* keeps moving stuff

* finishes moving the stuff

* moves tests

* fix type

* try moving it all at once. BROKEN

* move endpoint to siem

* fix package coming from endpoint

* missing scripts + change url

* fix eslint

* temporary disable functional testing for endpoint

* fix api integration types

* allow api integration test + comment functional test

* fix internationalization

* fix internationalization II

* fix jest test

* fix x-pack test

* fix i18n

* fix api integration

* fix circular dependency

* add new dependency to cypress test

Co-authored-by: Davis Plumlee <davis.plumlee@elastic.co>
Co-authored-by: oatkiller <robert.austin@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-05-19 11:24:53 -04:00

25 lines
876 B
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { StartServices } from '../../../types';
import { IndexPatternSavedObject, IndexPatternSavedObjectAttributes } from '../types';
/**
* Fetches Configured Index Patterns from the Kibana saved objects API
*
* TODO: Refactor to context provider: https://github.com/elastic/siem-team/issues/448
*/
export const getIndexPatterns = async (
savedObjects: StartServices['savedObjects']
): Promise<IndexPatternSavedObject[]> => {
const response = await savedObjects.client.find<IndexPatternSavedObjectAttributes>({
type: 'index-pattern',
fields: ['title'],
perPage: 10000,
});
return response.savedObjects;
};