Skip to content
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

Expose Saved Object API to Server #12182

Merged
merged 3 commits into from
Jun 9, 2017
Merged

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Jun 5, 2017

This PR decorates request objects with a method getSavedObjectsClient that provides convenient access to the Saved Object API.

@nreese nreese requested review from spalger and tylersmalley June 5, 2017 20:36
@spalger
Copy link
Contributor

spalger commented Jun 5, 2017

@nreese would you mind updating the routes above this change to use the new method? Updating the pre function to use the new method on request would prevent multiple implementations from existing in the same file, would reuse the cache, and would keep the changed lines pretty low. But if you're up for changing the routes to use the new method too I wouldn't complain 😄

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

const { callWithRequest } = server.plugins.elasticsearch.getCluster('admin');
const callAdminCluster = (...args) => callWithRequest(request, ...args);
const savedObjectsClient = new SavedObjectsClient(
server.config().get('kibana.index'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation here should be two spaces

Copy link
Contributor

@tylersmalley tylersmalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nreese nreese merged commit 5f44854 into elastic:master Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants