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

Remove es _xpack endpoint usage #29465

Merged
merged 16 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/kbn-test/src/functional_tests/lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function insertUser(port, auth, username, password, roles = [], retries =
auth,
hostname: 'localhost',
port,
pathname: `/_xpack/security/user/${username}`,
pathname: `/_security/user/${username}`,
}),
json: true,
body: { password, roles },
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/elasticsearch/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ interface ElasticsearchClientLogging {
}

interface AssistantAPIClientParams extends GenericParams {
path: '/_xpack/migration/assistance';
path: '/_migration/assistance';
method: 'GET';
}

Expand All @@ -191,7 +191,7 @@ export interface AssistanceAPIResponse {
}

interface DeprecationAPIClientParams extends GenericParams {
path: '/_xpack/migration/deprecations';
path: '/_migration/deprecations';
method: 'GET';
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/server/lib/query_es_sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { normalizeType } from './normalize_type';

export const queryEsSQL = (elasticsearchClient, { count, query, filter }) =>
elasticsearchClient('transport.request', {
path: '/_xpack/sql?format=json',
path: '/_sql?format=json',
method: 'POST',
body: {
fetch_size: count,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/license_management/server/lib/license.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

const getLicensePath = (acknowledge) => `/_xpack/license${ acknowledge ? '?acknowledge=true' : ''}`;
const getLicensePath = (acknowledge) => `/_license${ acknowledge ? '?acknowledge=true' : ''}`;

export async function putLicense(req, xpackInfo) {
const { acknowledge } = req.query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

const getStartBasicPath = (acknowledge) => `/_xpack/license/start_basic${ acknowledge ? '?acknowledge=true' : ''}`;
const getStartBasicPath = (acknowledge) => `/_license/start_basic${ acknowledge ? '?acknowledge=true' : ''}`;


export async function startBasic(req, xpackInfo) {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/license_management/server/lib/start_trial.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function canStartTrial(req) {
const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('admin');
const options = {
method: 'GET',
path: '/_xpack/license/trial_status'
path: '/_license/trial_status'
};
try {
const response = await callWithRequest(req, 'transport.request', options);
Expand All @@ -22,7 +22,7 @@ export async function startTrial(req, xpackInfo) {
const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('admin');
const options = {
method: 'POST',
path: '/_xpack/license/start_trial?acknowledge=true'
path: '/_license/start_trial?acknowledge=true'
};
try {
/*eslint camelcase: 0*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const LicenseUpdateInfoForRemote = ({ isPrimaryCluster }) => {
</p>
<EuiSpacer />
<EuiCodeBlock>
{`curl -XPUT -u <user> 'https://<host>:<port>/_xpack/license' -H 'Content-Type: application/json' -d @license.json`}
{`curl -XPUT -u <user> 'https://<host>:<port>/_license' -H 'Content-Type: application/json' -d @license.json`}
</EuiCodeBlock>
</EuiPanel>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export function monitoringBulk(Client, _config, components) {
}
},
urls: [{
fmt: '/_xpack/monitoring/<%=type%>/_bulk',
fmt: '/_monitoring/<%=type%>/bulk',
req: {
type: {
type: 'string'
}
}
}, {
fmt: '/_xpack/monitoring/_bulk'
fmt: '/_monitoring/bulk'
}],
needBody: true,
bulkBody: true,
Expand Down
14 changes: 7 additions & 7 deletions x-pack/plugins/rollup/server/client/elasticsearch_rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.rollupIndexCapabilities = ca({
urls: [
{
fmt: '/<%=indexPattern%>/_xpack/rollup/data',
fmt: '/<%=indexPattern%>/_rollup/data',
req: {
indexPattern: {
type: 'string'
Expand Down Expand Up @@ -56,7 +56,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.jobs = ca({
urls: [
{
fmt: '/_xpack/rollup/job/_all',
fmt: '/_rollup/job/_all',
}
],
method: 'GET'
Expand All @@ -65,7 +65,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.job = ca({
urls: [
{
fmt: '/_xpack/rollup/job/<%=id%>',
fmt: '/_rollup/job/<%=id%>',
req: {
id: {
type: 'string'
Expand All @@ -79,7 +79,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.startJob = ca({
urls: [
{
fmt: '/_xpack/rollup/job/<%=id%>/_start',
fmt: '/_rollup/job/<%=id%>/_start',
req: {
id: {
type: 'string'
Expand All @@ -93,7 +93,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.stopJob = ca({
urls: [
{
fmt: '/_xpack/rollup/job/<%=id%>/_stop',
fmt: '/_rollup/job/<%=id%>/_stop',
req: {
id: {
type: 'string'
Expand All @@ -107,7 +107,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.deleteJob = ca({
urls: [
{
fmt: '/_xpack/rollup/job/<%=id%>',
fmt: '/_rollup/job/<%=id%>',
req: {
id: {
type: 'string'
Expand All @@ -121,7 +121,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.createJob = ca({
urls: [
{
fmt: '/_xpack/rollup/job/<%=id%>',
fmt: '/_rollup/job/<%=id%>',
req: {
id: {
type: 'string'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('getUpgradeAssistantStatus', () => {
let deprecationsResponse: DeprecationAPIResponse;

const callWithRequest = jest.fn().mockImplementation(async (req, api, { path }) => {
if (path === '/_xpack/migration/deprecations') {
if (path === '/_migration/deprecations') {
return deprecationsResponse;
} else {
throw new Error(`Unexpected API call: ${path}`);
Expand All @@ -25,10 +25,10 @@ describe('getUpgradeAssistantStatus', () => {
deprecationsResponse = _.cloneDeep(fakeDeprecations);
});

it('calls /_xpack/migration/deprecations', async () => {
it('calls /_migration/deprecations', async () => {
await getUpgradeAssistantStatus(callWithRequest, {} as any, '/');
expect(callWithRequest).toHaveBeenCalledWith({}, 'transport.request', {
path: '/_xpack/migration/deprecations',
path: '/_migration/deprecations',
method: 'GET',
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function getUpgradeAssistantStatus(
basePath: string
): Promise<UpgradeAssistantStatus> {
const deprecations = (await callWithRequest(req, 'transport.request', {
path: '/_xpack/migration/deprecations',
path: '/_migration/deprecations',
method: 'GET',
})) as DeprecationAPIResponse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
fmt: '/_xpack/watcher/watch/<%=id%>/_deactivate',
fmt: '/_watcher/watch/<%=id%>/_deactivate',
req: {
id: {
type: 'string',
Expand All @@ -51,7 +51,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
fmt: '/_xpack/watcher/watch/<%=id%>/_activate',
fmt: '/_watcher/watch/<%=id%>/_activate',
req: {
id: {
type: 'string',
Expand All @@ -78,7 +78,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
fmt: '/_xpack/watcher/watch/<%=id%>/_ack/<%=action%>',
fmt: '/_watcher/watch/<%=id%>/_ack/<%=action%>',
req: {
id: {
type: 'string',
Expand Down Expand Up @@ -112,7 +112,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
fmt: '/_xpack/watcher/watch/<%=id%>',
fmt: '/_watcher/watch/<%=id%>',
req: {
id: {
type: 'string',
Expand All @@ -136,7 +136,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
fmt: '/_xpack/watcher/watch/_execute'
fmt: '/_watcher/watch/_execute'
},
needBody: true,
method: 'POST'
Expand All @@ -151,7 +151,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.getWatch = ca({
params: {},
url: {
fmt: '/_xpack/watcher/watch/<%=id%>',
fmt: '/_watcher/watch/<%=id%>',
req: {
id: {
type: 'string',
Expand All @@ -176,7 +176,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
fmt: '/_xpack/watcher/watch/<%=id%>',
fmt: '/_watcher/watch/<%=id%>',
req: {
id: {
type: 'string',
Expand All @@ -196,7 +196,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.restart = ca({
params: {},
url: {
fmt: '/_xpack/watcher/_restart'
fmt: '/_watcher/_restart'
},
method: 'PUT'
});
Expand All @@ -209,7 +209,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.start = ca({
params: {},
url: {
fmt: '/_xpack/watcher/_start'
fmt: '/_watcher/_start'
},
method: 'PUT'
});
Expand All @@ -222,7 +222,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.stats = ca({
params: {},
url: {
fmt: '/_xpack/watcher/stats'
fmt: '/_watcher/stats'
}
});

Expand All @@ -234,7 +234,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.stop = ca({
params: {},
url: {
fmt: '/_xpack/watcher/_stop'
fmt: '/_watcher/_stop'
},
method: 'PUT'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
function mockGetXPackLicense(callCluster, license) {
callCluster.withArgs('transport.request', {
method: 'GET',
path: '/_xpack/license',
path: '/_license',
query: {
local: 'true'
}
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('get_xpack', () => {

describe('getXPackLicense', () => {

it('uses callCluster to get /_xpack/license API', async () => {
it('uses callCluster to get /_license API', async () => {
const response = { type: 'basic' };
const callCluster = sinon.stub();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TIMEOUT } from './constants';
/**
* Get the cluster stats from the connected cluster.
*
* This is the equivalent of GET /_xpack/license?local=true .
* This is the equivalent of GET /_license?local=true .
*
* Like any X-Pack related API, X-Pack must installed for this to work.
*
Expand All @@ -19,7 +19,7 @@ import { TIMEOUT } from './constants';
export function getXPackLicense(callCluster) {
return callCluster('transport.request', {
method: 'GET',
path: '/_xpack/license',
path: '/_license',
query: {
// Fetching the local license is cheaper than getting it from the master and good enough
local: 'true'
Expand Down Expand Up @@ -51,7 +51,7 @@ export function getXPackUsage(callCluster) {
/**
* Combine the X-Pack responses into a single response as Monitoring does already.
*
* @param {Object} license The license returned from /_xpack/license
* @param {Object} license The license returned from /_license
* @param {Object} usage The usage details returned from /_xpack/usage
* @return {Object} An object containing both the license and usage.
*/
Expand Down