-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Component templates] Add APIs #66684
[Component templates] Add APIs #66684
Conversation
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great job @alisonelizabeth
x-pack/plugins/index_management/server/routes/api/component_templates/get.ts
Show resolved
Hide resolved
import { RouteDependencies } from '../../../types'; | ||
import { addBasePath } from '../index'; | ||
|
||
const bodySchema = schema.object({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to have a validate_schemas.ts
like in index templates and import a common schema in both places (create and update).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
expect(testComponentTemplate).to.eql({ | ||
name: COMPONENT_NAME, | ||
component_template: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or simply
component_template: COMPONENT
😊
|
||
expect(body).to.eql({ | ||
itemsDeleted: [COMPONENT_ONE_NAME], | ||
errors: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I would have gone in so much details to match the ES error in our tests. ES could change it anytime.
WDYT of testing just this
expect(body.itemsDeleted).to.eql([COMPONENT_ONE_NAME]);
expect(body.errors[0].name).to.eql(COMPONENT_DOES_NOT_EXIST);
expect(body.errors[0].error.msg).to.include('index_template_missing_exception');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point! I updated the test.
…na into component_templates/apis
…na into component_templates/apis
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
This PR adds the server routes for the components templates UI.
Endpoints
GET /api/index_management/component_templates
Fetch all component templates
GET /api/index_management/component_templates/<name>
Fetch single component template
DELETE /api/index_management/component_templates/<names>
Delete one or multiple component templates
POST /api/index_management/component_templates
Create a new component template
Body args:
PUT /api/index_management/component_templates/<component_name>
Update an existing component template
Body args: