Skip to content

Commit

Permalink
Fix #38623 remove xpack namespace REST API (#38625) (#39037)
Browse files Browse the repository at this point in the history
* Fix #38623 remove xpack namespace REST API

Except for xpack.usage and xpack.info API's, this moves the last remaining API's out of the xpack namespace

* rename xpack api's inside inside the files as well

* updated yaml tests references to xpack namespaces api's

* update callsApi calls in the IT subclasses

* make sure docs testing does not use xpack namespaced api's

* fix leftover xpack namespaced method names in docs/build.gradle

* found another leftover reference

(cherry picked from commit ccb5d93)
  • Loading branch information
Mpdreamz authored Feb 18, 2019
1 parent 8f7cc9e commit 8a716ac
Show file tree
Hide file tree
Showing 110 changed files with 447 additions and 447 deletions.
24 changes: 12 additions & 12 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ buildRestTests.setups['sensor_prefab_data'] = '''
'''
buildRestTests.setups['sample_job'] = '''
- do:
xpack.ml.put_job:
ml.put_job:
job_id: "sample_job"
body: >
{
Expand Down Expand Up @@ -894,7 +894,7 @@ buildRestTests.setups['farequote_data'] = buildRestTests.setups['farequote_index
'''
buildRestTests.setups['farequote_job'] = buildRestTests.setups['farequote_data'] + '''
- do:
xpack.ml.put_job:
ml.put_job:
job_id: "farequote"
body: >
{
Expand All @@ -914,7 +914,7 @@ buildRestTests.setups['farequote_job'] = buildRestTests.setups['farequote_data']
'''
buildRestTests.setups['farequote_datafeed'] = buildRestTests.setups['farequote_job'] + '''
- do:
xpack.ml.put_datafeed:
ml.put_datafeed:
datafeed_id: "datafeed-farequote"
body: >
{
Expand Down Expand Up @@ -978,7 +978,7 @@ buildRestTests.setups['server_metrics_data'] = buildRestTests.setups['server_met
'''
buildRestTests.setups['server_metrics_job'] = buildRestTests.setups['server_metrics_data'] + '''
- do:
xpack.ml.put_job:
ml.put_job:
job_id: "total-requests"
body: >
{
Expand All @@ -1000,7 +1000,7 @@ buildRestTests.setups['server_metrics_job'] = buildRestTests.setups['server_metr
'''
buildRestTests.setups['server_metrics_datafeed'] = buildRestTests.setups['server_metrics_job'] + '''
- do:
xpack.ml.put_datafeed:
ml.put_datafeed:
datafeed_id: "datafeed-total-requests"
body: >
{
Expand All @@ -1010,22 +1010,22 @@ buildRestTests.setups['server_metrics_datafeed'] = buildRestTests.setups['server
'''
buildRestTests.setups['server_metrics_openjob'] = buildRestTests.setups['server_metrics_datafeed'] + '''
- do:
xpack.ml.open_job:
ml.open_job:
job_id: "total-requests"
'''
buildRestTests.setups['server_metrics_startdf'] = buildRestTests.setups['server_metrics_openjob'] + '''
- do:
xpack.ml.start_datafeed:
ml.start_datafeed:
datafeed_id: "datafeed-total-requests"
'''
buildRestTests.setups['calendar_outages'] = '''
- do:
xpack.ml.put_calendar:
ml.put_calendar:
calendar_id: "planned-outages"
'''
buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['calendar_outages'] + '''
- do:
xpack.ml.post_calendar_events:
ml.post_calendar_events:
calendar_id: "planned-outages"
body: >
{ "description": "event 1", "start_time": "2017-12-01T00:00:00Z", "end_time": "2017-12-02T00:00:00Z", "calendar_id": "planned-outages" }
Expand All @@ -1034,12 +1034,12 @@ buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['cale
'''
buildRestTests.setups['calendar_outages_openjob'] = buildRestTests.setups['server_metrics_openjob'] + '''
- do:
xpack.ml.put_calendar:
ml.put_calendar:
calendar_id: "planned-outages"
'''
buildRestTests.setups['calendar_outages_addjob'] = buildRestTests.setups['server_metrics_openjob'] + '''
- do:
xpack.ml.put_calendar:
ml.put_calendar:
calendar_id: "planned-outages"
body: >
{
Expand All @@ -1048,7 +1048,7 @@ buildRestTests.setups['calendar_outages_addjob'] = buildRestTests.setups['server
'''
buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['calendar_outages_addjob'] + '''
- do:
xpack.ml.post_calendar_events:
ml.post_calendar_events:
calendar_id: "planned-outages"
body: >
{ "events" : [
Expand Down
34 changes: 17 additions & 17 deletions x-pack/docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ buildRestTests.docs = fileTree(projectDir) {
Map<String, String> setups = buildRestTests.setups
setups['my_inactive_watch'] = '''
- do:
xpack.watcher.put_watch:
watcher.put_watch:
id: "my_watch"
active: false
body: >
Expand Down Expand Up @@ -216,7 +216,7 @@ setups['library'] = '''
'''
setups['sample_job'] = '''
- do:
xpack.ml.put_job:
ml.put_job:
job_id: "sample_job"
body: >
{
Expand Down Expand Up @@ -270,7 +270,7 @@ setups['farequote_data'] = setups['farequote_index'] + '''
'''
setups['farequote_job'] = setups['farequote_data'] + '''
- do:
xpack.ml.put_job:
ml.put_job:
job_id: "farequote"
body: >
{
Expand All @@ -290,7 +290,7 @@ setups['farequote_job'] = setups['farequote_data'] + '''
'''
setups['farequote_datafeed'] = setups['farequote_job'] + '''
- do:
xpack.ml.put_datafeed:
ml.put_datafeed:
datafeed_id: "datafeed-farequote"
body: >
{
Expand All @@ -300,7 +300,7 @@ setups['farequote_datafeed'] = setups['farequote_job'] + '''
'''
setups['ml_filter_safe_domains'] = '''
- do:
xpack.ml.put_filter:
ml.put_filter:
filter_id: "safe_domains"
body: >
{
Expand Down Expand Up @@ -364,7 +364,7 @@ setups['server_metrics_data'] = setups['server_metrics_index'] + '''
'''
setups['server_metrics_job'] = setups['server_metrics_data'] + '''
- do:
xpack.ml.put_job:
ml.put_job:
job_id: "total-requests"
body: >
{
Expand All @@ -386,7 +386,7 @@ setups['server_metrics_job'] = setups['server_metrics_data'] + '''
'''
setups['server_metrics_datafeed'] = setups['server_metrics_job'] + '''
- do:
xpack.ml.put_datafeed:
ml.put_datafeed:
datafeed_id: "datafeed-total-requests"
body: >
{
Expand All @@ -396,22 +396,22 @@ setups['server_metrics_datafeed'] = setups['server_metrics_job'] + '''
'''
setups['server_metrics_openjob'] = setups['server_metrics_datafeed'] + '''
- do:
xpack.ml.open_job:
ml.open_job:
job_id: "total-requests"
'''
setups['server_metrics_startdf'] = setups['server_metrics_openjob'] + '''
- do:
xpack.ml.start_datafeed:
ml.start_datafeed:
datafeed_id: "datafeed-total-requests"
'''
setups['calendar_outages'] = '''
- do:
xpack.ml.put_calendar:
ml.put_calendar:
calendar_id: "planned-outages"
'''
setups['calendar_outages_addevent'] = setups['calendar_outages'] + '''
- do:
xpack.ml.post_calendar_events:
ml.post_calendar_events:
calendar_id: "planned-outages"
body: >
{ "description": "event 1", "start_time": "2017-12-01T00:00:00Z", "end_time": "2017-12-02T00:00:00Z", "calendar_id": "planned-outages" }
Expand All @@ -420,12 +420,12 @@ setups['calendar_outages_addevent'] = setups['calendar_outages'] + '''
'''
setups['calendar_outages_openjob'] = setups['server_metrics_openjob'] + '''
- do:
xpack.ml.put_calendar:
ml.put_calendar:
calendar_id: "planned-outages"
'''
setups['calendar_outages_addjob'] = setups['server_metrics_openjob'] + '''
- do:
xpack.ml.put_calendar:
ml.put_calendar:
calendar_id: "planned-outages"
body: >
{
Expand All @@ -434,7 +434,7 @@ setups['calendar_outages_addjob'] = setups['server_metrics_openjob'] + '''
'''
setups['calendar_outages_addevent'] = setups['calendar_outages_addjob'] + '''
- do:
xpack.ml.post_calendar_events:
ml.post_calendar_events:
calendar_id: "planned-outages"
body: >
{ "events" : [
Expand Down Expand Up @@ -473,7 +473,7 @@ setups['sensor_rollup_job'] = '''
node:
type: keyword
- do:
xpack.rollup.put_job:
rollup.put_job:
id: "sensor"
body: >
{
Expand Down Expand Up @@ -541,7 +541,7 @@ setups['sensor_started_rollup_job'] = '''
{"timestamp": 1516297294000, "temperature": 202, "voltage": 4.0, "node": "c"}
- do:
xpack.rollup.put_job:
rollup.put_job:
id: "sensor"
body: >
{
Expand Down Expand Up @@ -571,7 +571,7 @@ setups['sensor_started_rollup_job'] = '''
]
}
- do:
xpack.rollup.start_job:
rollup.start_job:
id: "sensor"
'''

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public void reenableWatcher() throws Exception {
if (isWatcherTest()) {
assertBusy(() -> {
ClientYamlTestResponse response =
getAdminExecutionContext().callApi("xpack.watcher.stats", emptyMap(), emptyList(), emptyMap());
getAdminExecutionContext().callApi("watcher.stats", emptyMap(), emptyList(), emptyMap());
String state = (String) response.evaluate("stats.0.watcher_state");

switch (state) {
case "stopped":
ClientYamlTestResponse startResponse =
getAdminExecutionContext().callApi("xpack.watcher.start", emptyMap(), emptyList(), emptyMap());
getAdminExecutionContext().callApi("watcher.start", emptyMap(), emptyList(), emptyMap());
boolean isAcknowledged = (boolean) startResponse.evaluate("acknowledged");
assertThat(isAcknowledged, is(true));
throw new AssertionError("waiting until stopped state reached started state");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public void test() throws IOException {
// role
for (ExecutableSection section : testCandidate.getTestSection().getExecutableSections()) {
if (section instanceof DoSection) {
if (((DoSection) section).getApiCallSection().getApi().startsWith("xpack.ml.") &&
((DoSection) section).getApiCallSection().getApi().startsWith("xpack.ml.get_") == false &&
((DoSection) section).getApiCallSection().getApi().equals("xpack.ml.find_file_structure") == false) {
if (((DoSection) section).getApiCallSection().getApi().startsWith("ml.") &&
((DoSection) section).getApiCallSection().getApi().startsWith("ml.get_") == false &&
((DoSection) section).getApiCallSection().getApi().equals("ml.find_file_structure") == false) {
fail("should have failed because of missing role");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ private void waitForWatcher() throws Exception {
if (isWatcherTest()) {
assertBusy(() -> {
ClientYamlTestResponse response =
getAdminExecutionContext().callApi("xpack.watcher.stats", emptyMap(), emptyList(), emptyMap());
getAdminExecutionContext().callApi("watcher.stats", emptyMap(), emptyList(), emptyMap());
String state = (String) response.evaluate("stats.0.watcher_state");

switch (state) {
case "stopped":
ClientYamlTestResponse startResponse =
getAdminExecutionContext().callApi("xpack.watcher.start", emptyMap(), emptyList(), emptyMap());
getAdminExecutionContext().callApi("watcher.start", emptyMap(), emptyList(), emptyMap());
boolean isAcknowledged = (boolean) startResponse.evaluate("acknowledged");
assertThat(isAcknowledged, is(true));
throw new AssertionError("waiting until stopped state reached started state");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.graph.explore": {
"graph.explore": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html",
"methods": ["GET", "POST"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.license.delete": {
"license.delete": {
"documentation": "https://www.elastic.co/guide/en/x-pack/current/license-management.html",
"methods": ["DELETE"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.license.get": {
"license.get": {
"documentation": "https://www.elastic.co/guide/en/x-pack/current/license-management.html",
"methods": ["GET"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.license.get_basic_status": {
"license.get_basic_status": {
"documentation": "https://www.elastic.co/guide/en/x-pack/current/license-management.html",
"methods": ["GET"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.license.get_trial_status": {
"license.get_trial_status": {
"documentation": "https://www.elastic.co/guide/en/x-pack/current/license-management.html",
"methods": ["GET"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.license.post": {
"license.post": {
"documentation": "https://www.elastic.co/guide/en/x-pack/current/license-management.html",
"methods": ["PUT", "POST"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.license.post_start_basic": {
"license.post_start_basic": {
"documentation": "https://www.elastic.co/guide/en/x-pack/current/license-management.html",
"methods": ["POST"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.license.post_start_trial": {
"license.post_start_trial": {
"documentation": "https://www.elastic.co/guide/en/x-pack/current/license-management.html",
"methods": ["POST"],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.migration.deprecations": {
"migration.deprecations": {
"documentation": "http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html",
"methods": [ "GET" ],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.migration.get_assistance": {
"migration.get_assistance": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html",
"methods": [ "GET" ],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.migration.upgrade": {
"migration.upgrade": {
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html",
"methods": [ "POST" ],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.rollup.delete_job": {
"rollup.delete_job": {
"documentation": "",
"methods": [ "DELETE" ],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.rollup.get_jobs": {
"rollup.get_jobs": {
"documentation": "",
"methods": [ "GET" ],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.rollup.get_rollup_caps": {
"rollup.get_rollup_caps": {
"documentation": "",
"methods": [ "GET" ],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.rollup.get_rollup_index_caps": {
"rollup.get_rollup_index_caps": {
"documentation": "",
"methods": [ "GET" ],
"url": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"xpack.rollup.put_job": {
"rollup.put_job": {
"documentation": "",
"methods": [ "PUT" ],
"url": {
Expand Down
Loading

0 comments on commit 8a716ac

Please sign in to comment.