kibana/test/api_integration/apis/data_views/index.ts
Matthew Kime c843c97193
[data views] REST endpoint for swapping saved object references (#157665)
## Summary

Managing large number of saved objects can be cumbersome. This api
endpoint allows the management of references without clicking through a
lot of different UIs.

For example - 

This swaps all data view id `abcd-efg` references to `xyz-123`

```
POST /api/data_views/swap_references
{
     "from_id" : "abcd-efg",
     "to_id" : "xyz-123",
     "preview" : false, // optional, necessary to save changes
     "delete" : true // optional, removes data view which is no longer referenced
}

returns 
{
  preview: false,
  result: [{ id: "123", type: "visualization" }],
  deleteSuccess: true
}
```

Additional params - 
```
from_type: string - specify the saved object type. Default is `index-pattern` for data view
for_id: string | string[] - limit the affected saved objects to one or more by id
for_type: string - limit the affected saved objects by type
```



Closes https://github.com/elastic/kibana/issues/153806
2023-07-06 08:29:01 -05:00

25 lines
1.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('index_patterns', () => {
loadTestFile(require.resolve('./es_errors'));
loadTestFile(require.resolve('./fields_for_wildcard_route'));
loadTestFile(require.resolve('./data_views_crud'));
loadTestFile(require.resolve('./scripted_fields_crud'));
loadTestFile(require.resolve('./fields_api'));
loadTestFile(require.resolve('./default_index_pattern'));
loadTestFile(require.resolve('./runtime_fields_crud'));
loadTestFile(require.resolve('./integration'));
loadTestFile(require.resolve('./deprecations'));
loadTestFile(require.resolve('./has_user_index_pattern'));
loadTestFile(require.resolve('./swap_references'));
});
}