From 51ef62b4f12374823a5f0a82be7102eade19ab89 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 13 Mar 2019 16:09:29 +0100 Subject: [PATCH] API generation --- api/api/bulk.js | 11 + api/api/cat.aliases.js | 9 + api/api/cat.allocation.js | 9 + api/api/cat.count.js | 9 + api/api/cat.fielddata.js | 9 + api/api/cat.health.js | 9 + api/api/cat.help.js | 9 + api/api/cat.indices.js | 9 + api/api/cat.master.js | 9 + api/api/cat.nodeattrs.js | 9 + api/api/cat.nodes.js | 9 + api/api/cat.pending_tasks.js | 9 + api/api/cat.plugins.js | 9 + api/api/cat.recovery.js | 9 + api/api/cat.repositories.js | 9 + api/api/cat.segments.js | 9 + api/api/cat.shards.js | 9 + api/api/cat.snapshots.js | 9 + api/api/cat.tasks.js | 9 + api/api/cat.templates.js | 9 + api/api/cat.thread_pool.js | 9 + api/api/ccr.delete_auto_follow_pattern.js | 9 + api/api/ccr.follow.js | 14 +- api/api/ccr.follow_info.js | 117 --- api/api/ccr.follow_stats.js | 9 + api/api/ccr.get_auto_follow_pattern.js | 9 + api/api/ccr.pause_follow.js | 9 + api/api/ccr.put_auto_follow_pattern.js | 9 + api/api/ccr.resume_follow.js | 9 + api/api/ccr.stats.js | 9 + api/api/ccr.unfollow.js | 9 + api/api/clear_scroll.js | 9 + api/api/cluster.allocation_explain.js | 9 + api/api/cluster.get_settings.js | 9 + api/api/cluster.health.js | 9 + api/api/cluster.pending_tasks.js | 9 + api/api/cluster.put_settings.js | 9 + api/api/cluster.remote_info.js | 9 + api/api/cluster.reroute.js | 9 + api/api/cluster.state.js | 9 + api/api/cluster.stats.js | 9 + api/api/count.js | 9 + api/api/create.js | 21 +- api/api/delete.js | 28 +- api/api/delete_by_query.js | 9 + api/api/delete_by_query_rethrottle.js | 9 + api/api/delete_script.js | 9 + api/api/exists.js | 21 +- api/api/exists_source.js | 23 +- api/api/explain.js | 21 +- api/api/field_caps.js | 16 +- api/api/get.js | 21 +- api/api/get_script.js | 9 + api/api/get_source.js | 23 +- api/api/ilm.delete_lifecycle.js | 9 + api/api/ilm.explain_lifecycle.js | 9 + api/api/ilm.get_lifecycle.js | 9 + api/api/ilm.get_status.js | 9 + api/api/ilm.move_to_step.js | 9 + api/api/ilm.put_lifecycle.js | 9 + api/api/ilm.remove_policy.js | 9 + api/api/ilm.retry.js | 9 + api/api/ilm.start.js | 9 + api/api/ilm.stop.js | 9 + api/api/index.js | 28 +- api/api/indices.analyze.js | 9 + api/api/indices.clear_cache.js | 17 +- api/api/indices.close.js | 9 + api/api/indices.create.js | 15 +- api/api/indices.delete.js | 9 + api/api/indices.delete_alias.js | 9 + api/api/indices.delete_template.js | 9 + api/api/indices.exists.js | 9 + api/api/indices.exists_alias.js | 9 + api/api/indices.exists_template.js | 9 + api/api/indices.exists_type.js | 9 + api/api/indices.flush.js | 9 + api/api/indices.flush_synced.js | 9 + api/api/indices.forcemerge.js | 9 + api/api/indices.freeze.js | 9 + api/api/indices.get.js | 12 +- api/api/indices.get_alias.js | 9 + api/api/indices.get_field_mapping.js | 12 +- api/api/indices.get_mapping.js | 12 +- api/api/indices.get_settings.js | 9 + api/api/indices.get_template.js | 12 +- api/api/indices.get_upgrade.js | 9 + api/api/indices.open.js | 9 + api/api/indices.put_alias.js | 9 + api/api/indices.put_mapping.js | 27 +- api/api/indices.put_settings.js | 9 + api/api/indices.put_template.js | 12 +- api/api/indices.recovery.js | 9 + api/api/indices.refresh.js | 9 + api/api/indices.rollover.js | 12 +- api/api/indices.segments.js | 9 + api/api/indices.shard_stores.js | 9 + api/api/indices.shrink.js | 9 + api/api/indices.split.js | 9 + api/api/indices.stats.js | 9 + api/api/indices.unfreeze.js | 9 + api/api/indices.update_aliases.js | 9 + api/api/indices.upgrade.js | 9 + api/api/indices.validate_query.js | 9 + api/api/info.js | 9 + api/api/ingest.delete_pipeline.js | 9 + api/api/ingest.get_pipeline.js | 9 + api/api/ingest.processor_grok.js | 9 + api/api/ingest.put_pipeline.js | 9 + api/api/ingest.simulate.js | 9 + api/api/mget.js | 9 + api/api/msearch.js | 14 +- api/api/msearch_template.js | 14 +- api/api/mtermvectors.js | 9 + api/api/nodes.hot_threads.js | 9 + api/api/nodes.info.js | 9 + api/api/nodes.reload_secure_settings.js | 11 +- api/api/nodes.stats.js | 9 + api/api/nodes.usage.js | 9 + api/api/ping.js | 9 + api/api/put_script.js | 9 + api/api/rank_eval.js | 9 + api/api/reindex.js | 9 + api/api/reindex_rethrottle.js | 9 + api/api/render_search_template.js | 9 + api/api/scripts_painless_execute.js | 9 + api/api/scroll.js | 11 +- api/api/search.js | 19 +- api/api/search_shards.js | 9 + api/api/search_template.js | 14 +- api/api/security.create_api_key.js | 126 --- api/api/security.get_api_key.js | 131 --- api/api/security.invalidate_api_key.js | 125 --- api/api/snapshot.create.js | 9 + api/api/snapshot.create_repository.js | 9 + api/api/snapshot.delete.js | 9 + api/api/snapshot.delete_repository.js | 9 + api/api/snapshot.get.js | 9 + api/api/snapshot.get_repository.js | 9 + api/api/snapshot.restore.js | 9 + api/api/snapshot.status.js | 9 + api/api/snapshot.verify_repository.js | 9 + api/api/tasks.cancel.js | 9 + api/api/tasks.get.js | 9 + api/api/tasks.list.js | 9 + api/api/termvectors.js | 21 +- api/api/update.js | 34 +- api/api/update_by_query.js | 9 + api/api/update_by_query_rethrottle.js | 9 + api/api/xpack.graph.explore.js | 13 +- api/api/xpack.info.js | 9 + api/api/xpack.license.delete.js | 11 +- api/api/xpack.license.get.js | 11 +- api/api/xpack.license.get_basic_status.js | 11 +- api/api/xpack.license.get_trial_status.js | 11 +- api/api/xpack.license.post.js | 11 +- api/api/xpack.license.post_start_basic.js | 11 +- api/api/xpack.license.post_start_trial.js | 11 +- api/api/xpack.migration.deprecations.js | 13 +- api/api/xpack.migration.get_assistance.js | 13 +- api/api/xpack.migration.upgrade.js | 11 +- ...{ml.close_job.js => xpack.ml.close_job.js} | 20 +- ...alendar.js => xpack.ml.delete_calendar.js} | 19 +- ...t.js => xpack.ml.delete_calendar_event.js} | 19 +- ...job.js => xpack.ml.delete_calendar_job.js} | 19 +- ...atafeed.js => xpack.ml.delete_datafeed.js} | 19 +- ...ata.js => xpack.ml.delete_expired_data.js} | 19 +- ...te_filter.js => xpack.ml.delete_filter.js} | 19 +- ...orecast.js => xpack.ml.delete_forecast.js} | 21 +- ...l.delete_job.js => xpack.ml.delete_job.js} | 19 +- ...t.js => xpack.ml.delete_model_snapshot.js} | 19 +- ...ure.js => xpack.ml.find_file_structure.js} | 19 +- ...{ml.flush_job.js => xpack.ml.flush_job.js} | 19 +- .../{ml.forecast.js => xpack.ml.forecast.js} | 19 +- ...get_buckets.js => xpack.ml.get_buckets.js} | 21 +- ...nts.js => xpack.ml.get_calendar_events.js} | 19 +- ...calendars.js => xpack.ml.get_calendars.js} | 21 +- ...tegories.js => xpack.ml.get_categories.js} | 21 +- ...tats.js => xpack.ml.get_datafeed_stats.js} | 21 +- ...datafeeds.js => xpack.ml.get_datafeeds.js} | 21 +- ...get_filters.js => xpack.ml.get_filters.js} | 21 +- ...uencers.js => xpack.ml.get_influencers.js} | 19 +- ...job_stats.js => xpack.ml.get_job_stats.js} | 21 +- .../{ml.get_jobs.js => xpack.ml.get_jobs.js} | 21 +- ...ots.js => xpack.ml.get_model_snapshots.js} | 21 +- ...ets.js => xpack.ml.get_overall_buckets.js} | 19 +- ...get_records.js => xpack.ml.get_records.js} | 19 +- api/api/{ml.info.js => xpack.ml.info.js} | 19 +- .../{ml.open_job.js => xpack.ml.open_job.js} | 19 +- ...ts.js => xpack.ml.post_calendar_events.js} | 19 +- ...{ml.post_data.js => xpack.ml.post_data.js} | 19 +- ...tafeed.js => xpack.ml.preview_datafeed.js} | 19 +- ...t_calendar.js => xpack.ml.put_calendar.js} | 19 +- ...ar_job.js => xpack.ml.put_calendar_job.js} | 19 +- ...t_datafeed.js => xpack.ml.put_datafeed.js} | 19 +- ...l.put_filter.js => xpack.ml.put_filter.js} | 19 +- .../{ml.put_job.js => xpack.ml.put_job.js} | 19 +- ...t.js => xpack.ml.revert_model_snapshot.js} | 19 +- ...datafeed.js => xpack.ml.start_datafeed.js} | 19 +- ..._datafeed.js => xpack.ml.stop_datafeed.js} | 19 +- ...atafeed.js => xpack.ml.update_datafeed.js} | 19 +- ...te_filter.js => xpack.ml.update_filter.js} | 19 +- ...l.update_job.js => xpack.ml.update_job.js} | 19 +- ...t.js => xpack.ml.update_model_snapshot.js} | 19 +- .../{ml.validate.js => xpack.ml.validate.js} | 19 +- ...ector.js => xpack.ml.validate_detector.js} | 19 +- ...oring.bulk.js => xpack.monitoring.bulk.js} | 21 +- api/api/xpack.rollup.delete_job.js | 11 +- api/api/xpack.rollup.get_jobs.js | 13 +- api/api/xpack.rollup.get_rollup_caps.js | 13 +- api/api/xpack.rollup.get_rollup_index_caps.js | 11 +- api/api/xpack.rollup.put_job.js | 11 +- api/api/xpack.rollup.rollup_search.js | 16 +- api/api/xpack.rollup.start_job.js | 11 +- api/api/xpack.rollup.stop_job.js | 11 +- ...eges.js => xpack.security.authenticate.js} | 19 +- ...d.js => xpack.security.change_password.js} | 21 +- ... => xpack.security.clear_cached_realms.js} | 19 +- ...s => xpack.security.clear_cached_roles.js} | 19 +- ...js => xpack.security.delete_privileges.js} | 19 +- ..._role.js => xpack.security.delete_role.js} | 19 +- ... => xpack.security.delete_role_mapping.js} | 19 +- ..._user.js => xpack.security.delete_user.js} | 19 +- ...user.js => xpack.security.disable_user.js} | 19 +- ..._user.js => xpack.security.enable_user.js} | 19 +- ...es.js => xpack.security.get_privileges.js} | 23 +- ...get_role.js => xpack.security.get_role.js} | 21 +- ....js => xpack.security.get_role_mapping.js} | 21 +- ...t_token.js => xpack.security.get_token.js} | 19 +- ...get_user.js => xpack.security.get_user.js} | 21 +- ... => xpack.security.get_user_privileges.js} | 19 +- ...es.js => xpack.security.has_privileges.js} | 21 +- ....js => xpack.security.invalidate_token.js} | 19 +- ...es.js => xpack.security.put_privileges.js} | 19 +- ...put_role.js => xpack.security.put_role.js} | 19 +- ....js => xpack.security.put_role_mapping.js} | 19 +- ...put_user.js => xpack.security.put_user.js} | 19 +- api/api/xpack.sql.clear_cursor.js | 11 +- api/api/xpack.sql.query.js | 11 +- api/api/xpack.sql.translate.js | 11 +- ...henticate.js => xpack.ssl.certificates.js} | 19 +- api/api/xpack.usage.js | 9 + api/api/xpack.watcher.ack_watch.js | 18 +- api/api/xpack.watcher.activate_watch.js | 16 +- api/api/xpack.watcher.deactivate_watch.js | 16 +- api/api/xpack.watcher.delete_watch.js | 16 +- api/api/xpack.watcher.execute_watch.js | 13 +- api/api/xpack.watcher.get_watch.js | 11 +- api/api/xpack.watcher.put_watch.js | 23 +- ...grade_mode.js => xpack.watcher.restart.js} | 24 +- api/api/xpack.watcher.start.js | 11 +- api/api/xpack.watcher.stats.js | 13 +- api/api/xpack.watcher.stop.js | 11 +- api/index.js | 291 +++--- api/requestParams.d.ts | 914 +++++++++--------- 255 files changed, 3374 insertions(+), 1674 deletions(-) delete mode 100644 api/api/ccr.follow_info.js delete mode 100644 api/api/security.create_api_key.js delete mode 100644 api/api/security.get_api_key.js delete mode 100644 api/api/security.invalidate_api_key.js rename api/api/{ml.close_job.js => xpack.ml.close_job.js} (85%) rename api/api/{ml.delete_calendar.js => xpack.ml.delete_calendar.js} (85%) rename api/api/{ml.delete_calendar_event.js => xpack.ml.delete_calendar_event.js} (86%) rename api/api/{ml.delete_calendar_job.js => xpack.ml.delete_calendar_job.js} (86%) rename api/api/{ml.delete_datafeed.js => xpack.ml.delete_datafeed.js} (84%) rename api/api/{ml.delete_expired_data.js => xpack.ml.delete_expired_data.js} (85%) rename api/api/{ml.delete_filter.js => xpack.ml.delete_filter.js} (86%) rename api/api/{ml.delete_forecast.js => xpack.ml.delete_forecast.js} (83%) rename api/api/{ml.delete_job.js => xpack.ml.delete_job.js} (85%) rename api/api/{ml.delete_model_snapshot.js => xpack.ml.delete_model_snapshot.js} (84%) rename api/api/{ml.find_file_structure.js => xpack.ml.find_file_structure.js} (89%) rename api/api/{ml.flush_job.js => xpack.ml.flush_job.js} (86%) rename api/api/{ml.forecast.js => xpack.ml.forecast.js} (86%) rename api/api/{ml.get_buckets.js => xpack.ml.get_buckets.js} (84%) rename api/api/{ml.get_calendar_events.js => xpack.ml.get_calendar_events.js} (86%) rename api/api/{ml.get_calendars.js => xpack.ml.get_calendars.js} (84%) rename api/api/{ml.get_categories.js => xpack.ml.get_categories.js} (80%) rename api/api/{ml.get_datafeed_stats.js => xpack.ml.get_datafeed_stats.js} (82%) rename api/api/{ml.get_datafeeds.js => xpack.ml.get_datafeeds.js} (83%) rename api/api/{ml.get_filters.js => xpack.ml.get_filters.js} (84%) rename api/api/{ml.get_influencers.js => xpack.ml.get_influencers.js} (85%) rename api/api/{ml.get_job_stats.js => xpack.ml.get_job_stats.js} (82%) rename api/api/{ml.get_jobs.js => xpack.ml.get_jobs.js} (83%) rename api/api/{ml.get_model_snapshots.js => xpack.ml.get_model_snapshots.js} (83%) rename api/api/{ml.get_overall_buckets.js => xpack.ml.get_overall_buckets.js} (86%) rename api/api/{ml.get_records.js => xpack.ml.get_records.js} (85%) rename api/api/{ml.info.js => xpack.ml.info.js} (86%) rename api/api/{ml.open_job.js => xpack.ml.open_job.js} (85%) rename api/api/{ml.post_calendar_events.js => xpack.ml.post_calendar_events.js} (85%) rename api/api/{ml.post_data.js => xpack.ml.post_data.js} (85%) rename api/api/{ml.preview_datafeed.js => xpack.ml.preview_datafeed.js} (83%) rename api/api/{ml.put_calendar.js => xpack.ml.put_calendar.js} (85%) rename api/api/{ml.put_calendar_job.js => xpack.ml.put_calendar_job.js} (86%) rename api/api/{ml.put_datafeed.js => xpack.ml.put_datafeed.js} (84%) rename api/api/{ml.put_filter.js => xpack.ml.put_filter.js} (86%) rename api/api/{ml.put_job.js => xpack.ml.put_job.js} (85%) rename api/api/{ml.revert_model_snapshot.js => xpack.ml.revert_model_snapshot.js} (84%) rename api/api/{ml.start_datafeed.js => xpack.ml.start_datafeed.js} (84%) rename api/api/{ml.stop_datafeed.js => xpack.ml.stop_datafeed.js} (85%) rename api/api/{ml.update_datafeed.js => xpack.ml.update_datafeed.js} (84%) rename api/api/{ml.update_filter.js => xpack.ml.update_filter.js} (85%) rename api/api/{ml.update_job.js => xpack.ml.update_job.js} (84%) rename api/api/{ml.update_model_snapshot.js => xpack.ml.update_model_snapshot.js} (84%) rename api/api/{ml.validate.js => xpack.ml.validate.js} (85%) rename api/api/{ml.validate_detector.js => xpack.ml.validate_detector.js} (84%) rename api/api/{monitoring.bulk.js => xpack.monitoring.bulk.js} (84%) rename api/api/{security.get_user_privileges.js => xpack.security.authenticate.js} (83%) rename api/api/{security.change_password.js => xpack.security.change_password.js} (82%) rename api/api/{security.clear_cached_realms.js => xpack.security.clear_cached_realms.js} (82%) rename api/api/{security.clear_cached_roles.js => xpack.security.clear_cached_roles.js} (82%) rename api/api/{security.delete_privileges.js => xpack.security.delete_privileges.js} (86%) rename api/api/{security.delete_role.js => xpack.security.delete_role.js} (84%) rename api/api/{security.delete_role_mapping.js => xpack.security.delete_role_mapping.js} (83%) rename api/api/{security.delete_user.js => xpack.security.delete_user.js} (84%) rename api/api/{security.disable_user.js => xpack.security.disable_user.js} (83%) rename api/api/{security.enable_user.js => xpack.security.enable_user.js} (83%) rename api/api/{security.get_privileges.js => xpack.security.get_privileges.js} (81%) rename api/api/{security.get_role.js => xpack.security.get_role.js} (82%) rename api/api/{security.get_role_mapping.js => xpack.security.get_role_mapping.js} (80%) rename api/api/{security.get_token.js => xpack.security.get_token.js} (83%) rename api/api/{security.get_user.js => xpack.security.get_user.js} (82%) rename api/api/{ssl.certificates.js => xpack.security.get_user_privileges.js} (82%) rename api/api/{security.has_privileges.js => xpack.security.has_privileges.js} (80%) rename api/api/{security.invalidate_token.js => xpack.security.invalidate_token.js} (82%) rename api/api/{security.put_privileges.js => xpack.security.put_privileges.js} (86%) rename api/api/{security.put_role.js => xpack.security.put_role.js} (85%) rename api/api/{security.put_role_mapping.js => xpack.security.put_role_mapping.js} (84%) rename api/api/{security.put_user.js => xpack.security.put_user.js} (85%) rename api/api/{security.authenticate.js => xpack.ssl.certificates.js} (84%) rename api/api/{ml.set_upgrade_mode.js => xpack.watcher.restart.js} (84%) diff --git a/api/api/bulk.js b/api/api/bulk.js index 957f215e0..b147db0cf 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -35,6 +35,7 @@ function buildBulk (opts) { * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout * @param {string} type - Default document type for items which don't provide one + * @param {list} fields - Default comma-separated list of fields to return in the response for updates, can be overridden on each sub-request * @param {list} _source - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request * @param {list} _source_excludes - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request * @param {list} _source_includes - Default list of fields to extract and return from the _source field, can be overridden on each sub-request @@ -48,6 +49,7 @@ function buildBulk (opts) { 'routing', 'timeout', 'type', + 'fields', '_source', '_source_excludes', '_source_includes', @@ -79,6 +81,15 @@ function buildBulk (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + bulk(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/cat.aliases.js b/api/api/cat.aliases.js index 8627157db..9b28f6edd 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -71,6 +71,15 @@ function buildCatAliases (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catAliases(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.allocation.js b/api/api/cat.allocation.js index 767854188..98f257d96 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -73,6 +73,15 @@ function buildCatAllocation (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catAllocation(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.count.js b/api/api/cat.count.js index 6fa162c4a..c57074c9f 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -71,6 +71,15 @@ function buildCatCount (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catCount(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.fielddata.js b/api/api/cat.fielddata.js index 22c9377a5..6fb432d58 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -75,6 +75,15 @@ function buildCatFielddata (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catFielddata(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.health.js b/api/api/cat.health.js index eb255cc9a..0db6c289b 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -72,6 +72,15 @@ function buildCatHealth (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catHealth(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.help.js b/api/api/cat.help.js index ebea416e1..f85171721 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -59,6 +59,15 @@ function buildCatHelp (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catHelp(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.indices.js b/api/api/cat.indices.js index 2ff28920d..62f365588 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -77,6 +77,15 @@ function buildCatIndices (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catIndices(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.master.js b/api/api/cat.master.js index 432dbd775..31adac93f 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -70,6 +70,15 @@ function buildCatMaster (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catMaster(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.nodeattrs.js b/api/api/cat.nodeattrs.js index 2cebea1d7..9e97e6a24 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -70,6 +70,15 @@ function buildCatNodeattrs (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catNodeattrs(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.nodes.js b/api/api/cat.nodes.js index dfa320a08..bcd3c0662 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -73,6 +73,15 @@ function buildCatNodes (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catNodes(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.pending_tasks.js b/api/api/cat.pending_tasks.js index 4205042ae..f24bff525 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -70,6 +70,15 @@ function buildCatPendingTasks (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catPendingTasks(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.plugins.js b/api/api/cat.plugins.js index 6fa73552c..c55fcdd29 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -70,6 +70,15 @@ function buildCatPlugins (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catPlugins(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.recovery.js b/api/api/cat.recovery.js index 985ed4902..42e0c1e0c 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -71,6 +71,15 @@ function buildCatRecovery (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catRecovery(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.repositories.js b/api/api/cat.repositories.js index 742a2ce56..8e8b6f6c9 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -70,6 +70,15 @@ function buildCatRepositories (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catRepositories(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.segments.js b/api/api/cat.segments.js index 2e4e5f184..c10af3b23 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -68,6 +68,15 @@ function buildCatSegments (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catSegments(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.shards.js b/api/api/cat.shards.js index 482dd015f..5ae0d1b18 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -73,6 +73,15 @@ function buildCatShards (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catShards(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.snapshots.js b/api/api/cat.snapshots.js index eaded0a18..af82bc574 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -72,6 +72,15 @@ function buildCatSnapshots (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catSnapshots(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index 720459a6f..c8005d5e7 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -75,6 +75,15 @@ function buildCatTasks (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catTasks(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.templates.js b/api/api/cat.templates.js index f3a4f11f7..ff89cb284 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -71,6 +71,15 @@ function buildCatTemplates (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catTemplates(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cat.thread_pool.js b/api/api/cat.thread_pool.js index 44756ab39..0b07b0e0a 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -73,6 +73,15 @@ function buildCatThreadPool (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + catThreadPool(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ccr.delete_auto_follow_pattern.js b/api/api/ccr.delete_auto_follow_pattern.js index 04cfe48b5..d5ebd1cfd 100644 --- a/api/api/ccr.delete_auto_follow_pattern.js +++ b/api/api/ccr.delete_auto_follow_pattern.js @@ -51,6 +51,15 @@ function buildCcrDeleteAutoFollowPattern (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrDeleteAutoFollowPattern(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js index 6983bfea0..f351a71ac 100644 --- a/api/api/ccr.follow.js +++ b/api/api/ccr.follow.js @@ -29,16 +29,15 @@ function buildCcrFollow (opts) { * Perform a [ccr.follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html) request * * @param {string} index - The name of the follower index - * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) * @param {object} body - The name of the leader index and other optional ccr related parameters */ const acceptedQuerystring = [ - 'wait_for_active_shards' + ] const snakeCase = { - waitForActiveShards: 'wait_for_active_shards' + } return function ccrFollow (params, options, callback) { @@ -53,6 +52,15 @@ function buildCcrFollow (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrFollow(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js deleted file mode 100644 index 0a27de878..000000000 --- a/api/api/ccr.follow_info.js +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -'use strict' - -/* eslint camelcase: 0 */ -/* eslint no-unused-vars: 0 */ - -function buildCcrFollowInfo (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.follow_info](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html) request - * - * @param {list} index - A comma-separated list of index patterns; use `_all` to perform the operation on all indices - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrFollowInfo (params, options, callback) { - options = options || {} - if (typeof options === 'function') { - callback = options - options = {} - } - if (typeof params === 'function' || params == null) { - callback = params - params = {} - options = {} - } - - // validate headers object - if (options.headers != null && typeof options.headers !== 'object') { - return callback( - new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`), - result - ) - } - - var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'info' - - // build request object - const request = { - method, - path, - body: null, - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - compression: options.compression || false, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } - } -} - -module.exports = buildCcrFollowInfo diff --git a/api/api/ccr.follow_stats.js b/api/api/ccr.follow_stats.js index c4f53e66c..62ee7f266 100644 --- a/api/api/ccr.follow_stats.js +++ b/api/api/ccr.follow_stats.js @@ -51,6 +51,15 @@ function buildCcrFollowStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrFollowStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js index 6e59191e1..261bce9ac 100644 --- a/api/api/ccr.get_auto_follow_pattern.js +++ b/api/api/ccr.get_auto_follow_pattern.js @@ -51,6 +51,15 @@ function buildCcrGetAutoFollowPattern (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrGetAutoFollowPattern(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js index 2e15a0430..81b0cde7b 100644 --- a/api/api/ccr.pause_follow.js +++ b/api/api/ccr.pause_follow.js @@ -51,6 +51,15 @@ function buildCcrPauseFollow (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrPauseFollow(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js index d660fafc1..846a29445 100644 --- a/api/api/ccr.put_auto_follow_pattern.js +++ b/api/api/ccr.put_auto_follow_pattern.js @@ -52,6 +52,15 @@ function buildCcrPutAutoFollowPattern (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrPutAutoFollowPattern(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js index e4fec5dc5..ac47bfac5 100644 --- a/api/api/ccr.resume_follow.js +++ b/api/api/ccr.resume_follow.js @@ -52,6 +52,15 @@ function buildCcrResumeFollow (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrResumeFollow(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js index e127ae0ca..4de395d30 100644 --- a/api/api/ccr.stats.js +++ b/api/api/ccr.stats.js @@ -50,6 +50,15 @@ function buildCcrStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js index 44af6a3a8..5886296b2 100644 --- a/api/api/ccr.unfollow.js +++ b/api/api/ccr.unfollow.js @@ -51,6 +51,15 @@ function buildCcrUnfollow (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ccrUnfollow(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index bcf7a5afc..d3e0ec0ac 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -57,6 +57,15 @@ function buildClearScroll (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clearScroll(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/cluster.allocation_explain.js b/api/api/cluster.allocation_explain.js index 9463e1e90..2392e61c7 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -62,6 +62,15 @@ function buildClusterAllocationExplain (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterAllocationExplain(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/cluster.get_settings.js b/api/api/cluster.get_settings.js index 8f7f13c41..d024742cb 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -66,6 +66,15 @@ function buildClusterGetSettings (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterGetSettings(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cluster.health.js b/api/api/cluster.health.js index 6ff729d8a..f8a75c1f4 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -83,6 +83,15 @@ function buildClusterHealth (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterHealth(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cluster.pending_tasks.js b/api/api/cluster.pending_tasks.js index 86023cb45..43ddbf53c 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -60,6 +60,15 @@ function buildClusterPendingTasks (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterPendingTasks(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cluster.put_settings.js b/api/api/cluster.put_settings.js index 110a5bf21..54ec859ed 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -64,6 +64,15 @@ function buildClusterPutSettings (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterPutSettings(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 93ba95308..95f965c44 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -55,6 +55,15 @@ function buildClusterRemoteInfo (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterRemoteInfo(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cluster.reroute.js b/api/api/cluster.reroute.js index 160b6b5b4..d106cd13c 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -71,6 +71,15 @@ function buildClusterReroute (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterReroute(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/cluster.state.js b/api/api/cluster.state.js index 91f68781c..a8b350120 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -80,6 +80,15 @@ function buildClusterState (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterState(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/cluster.stats.js b/api/api/cluster.stats.js index a07b2a324..b313c7827 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -61,6 +61,15 @@ function buildClusterStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/count.js b/api/api/count.js index 9dd09c294..536c07f62 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -94,6 +94,15 @@ function buildCount (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + count(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required url components if (params['type'] != null && (params['index'] == null)) { return callback( diff --git a/api/api/create.js b/api/api/create.js index eb18d517b..196eb9e99 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -77,6 +77,15 @@ function buildCreate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + create(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -90,6 +99,12 @@ function buildCreate (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params['body'] == null) { return callback( new ConfigurationError('Missing required parameter: body'), @@ -120,11 +135,7 @@ function buildCreate (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create' // build request object const request = { diff --git a/api/api/delete.js b/api/api/delete.js index db3e90b35..58d95c8dc 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -80,6 +80,15 @@ function buildDelete (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + _delete(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -93,6 +102,12 @@ function buildDelete (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), @@ -101,7 +116,12 @@ function buildDelete (opts) { } // check required url components - if (params['id'] != null && (params['index'] == null)) { + if (params['id'] != null && (params['type'] == null || params['index'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: type, index'), + result + ) + } else if (params['type'] != null && (params['index'] == null)) { return callback( new ConfigurationError('Missing required parameter of the url: index'), result @@ -131,11 +151,7 @@ function buildDelete (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index 559bcd201..cd0a34e9a 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -137,6 +137,15 @@ function buildDeleteByQuery (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + deleteByQuery(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index 3d9cb752f..089ccf67c 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -59,6 +59,15 @@ function buildDeleteByQueryRethrottle (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + deleteByQueryRethrottle(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['task_id'] == null && params['taskId'] == null) { return callback( diff --git a/api/api/delete_script.js b/api/api/delete_script.js index fed63e09d..804c4bd3e 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -61,6 +61,15 @@ function buildDeleteScript (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + deleteScript(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( diff --git a/api/api/exists.js b/api/api/exists.js index 58dba35b1..4f1091f49 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -84,6 +84,15 @@ function buildExists (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + exists(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -97,6 +106,12 @@ function buildExists (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), @@ -127,11 +142,7 @@ function buildExists (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/exists_source.js b/api/api/exists_source.js index a4280b7eb..30cc60762 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -30,7 +30,7 @@ function buildExistsSource (opts) { * * @param {string} id - The document ID * @param {string} index - The name of the index - * @param {string} type - The type of the document; deprecated and optional starting with 7.0 + * @param {string} type - The type of the document; use `_all` to fetch the first document matching the ID across all types * @param {string} parent - The ID of the parent document * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode @@ -81,6 +81,15 @@ function buildExistsSource (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + existsSource(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -94,6 +103,12 @@ function buildExistsSource (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), @@ -137,11 +152,7 @@ function buildExistsSource (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' // build request object const request = { diff --git a/api/api/explain.js b/api/api/explain.js index cdba2dc5c..f01bb9ab1 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -90,6 +90,15 @@ function buildExplain (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + explain(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -103,6 +112,12 @@ function buildExplain (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { @@ -127,11 +142,7 @@ function buildExplain (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain' // build request object const request = { diff --git a/api/api/field_caps.js b/api/api/field_caps.js index 79f2ad7be..c665d9c35 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -33,6 +33,7 @@ function buildFieldCaps (opts) { * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {object} body - Field json objects containing an array of field names */ const acceptedQuerystring = [ @@ -67,12 +68,13 @@ function buildFieldCaps (opts) { options = {} } - // check required parameters - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + fieldCaps(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) } // validate headers object @@ -108,7 +110,7 @@ function buildFieldCaps (opts) { const request = { method, path, - body: '', + body: body || '', querystring } diff --git a/api/api/get.js b/api/api/get.js index af04e37c5..de1e4092f 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -90,6 +90,15 @@ function buildGet (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + get(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -103,6 +112,12 @@ function buildGet (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), @@ -133,11 +148,7 @@ function buildGet (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/get_script.js b/api/api/get_script.js index ef873a5ee..e0c42cfab 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -59,6 +59,15 @@ function buildGetScript (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + getScript(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( diff --git a/api/api/get_source.js b/api/api/get_source.js index 18ad2e4e6..ab6bdd818 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -30,7 +30,7 @@ function buildGetSource (opts) { * * @param {string} id - The document ID * @param {string} index - The name of the index - * @param {string} type - The type of the document; deprecated and optional starting with 7.0 + * @param {string} type - The type of the document; use `_all` to fetch the first document matching the ID across all types * @param {string} parent - The ID of the parent document * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode @@ -81,6 +81,15 @@ function buildGetSource (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + getSource(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -94,6 +103,12 @@ function buildGetSource (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), @@ -124,11 +139,7 @@ function buildGetSource (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source' // build request object const request = { diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js index 8d2c2b6b5..fcab49377 100644 --- a/api/api/ilm.delete_lifecycle.js +++ b/api/api/ilm.delete_lifecycle.js @@ -51,6 +51,15 @@ function buildIlmDeleteLifecycle (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmDeleteLifecycle(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js index 377959873..0e25f2fa0 100644 --- a/api/api/ilm.explain_lifecycle.js +++ b/api/api/ilm.explain_lifecycle.js @@ -52,6 +52,15 @@ function buildIlmExplainLifecycle (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmExplainLifecycle(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js index d4aea2190..5b3a25a17 100644 --- a/api/api/ilm.get_lifecycle.js +++ b/api/api/ilm.get_lifecycle.js @@ -51,6 +51,15 @@ function buildIlmGetLifecycle (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmGetLifecycle(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js index 38df25c38..801ff5275 100644 --- a/api/api/ilm.get_status.js +++ b/api/api/ilm.get_status.js @@ -50,6 +50,15 @@ function buildIlmGetStatus (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmGetStatus(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js index 0f6b9274f..392421dbb 100644 --- a/api/api/ilm.move_to_step.js +++ b/api/api/ilm.move_to_step.js @@ -52,6 +52,15 @@ function buildIlmMoveToStep (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmMoveToStep(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js index de148ad62..dfbc27f82 100644 --- a/api/api/ilm.put_lifecycle.js +++ b/api/api/ilm.put_lifecycle.js @@ -52,6 +52,15 @@ function buildIlmPutLifecycle (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmPutLifecycle(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js index f0258c29c..c0d45128b 100644 --- a/api/api/ilm.remove_policy.js +++ b/api/api/ilm.remove_policy.js @@ -51,6 +51,15 @@ function buildIlmRemovePolicy (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmRemovePolicy(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js index 6568a0a40..337f19ecf 100644 --- a/api/api/ilm.retry.js +++ b/api/api/ilm.retry.js @@ -51,6 +51,15 @@ function buildIlmRetry (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmRetry(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js index 840700141..1b692b3c0 100644 --- a/api/api/ilm.start.js +++ b/api/api/ilm.start.js @@ -50,6 +50,15 @@ function buildIlmStart (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmStart(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js index 166ed28b1..be9dfdaef 100644 --- a/api/api/ilm.stop.js +++ b/api/api/ilm.stop.js @@ -50,6 +50,15 @@ function buildIlmStop (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ilmStop(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/index.js b/api/api/index.js index 213b41ac5..341ae6a00 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -86,6 +86,15 @@ function buildIndex (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + _index(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( @@ -93,6 +102,12 @@ function buildIndex (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params['body'] == null) { return callback( new ConfigurationError('Missing required parameter: body'), @@ -101,7 +116,12 @@ function buildIndex (opts) { } // check required url components - if (params['id'] != null && (params['index'] == null)) { + if (params['id'] != null && (params['type'] == null || params['index'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: type, index'), + result + ) + } else if (params['type'] != null && (params['index'] == null)) { return callback( new ConfigurationError('Missing required parameter of the url: index'), result @@ -133,12 +153,8 @@ function buildIndex (opts) { if ((index) != null && (type) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) - } else if ((index) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id) - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) } else { - path = '/' + encodeURIComponent(index) + '/' + '_doc' + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) } // build request object diff --git a/api/api/indices.analyze.js b/api/api/indices.analyze.js index b4d697bc8..c4ae2ea1f 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -59,6 +59,15 @@ function buildIndicesAnalyze (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesAnalyze(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/indices.clear_cache.js b/api/api/indices.clear_cache.js index 2d6b3be6b..aff8749dd 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -29,6 +29,7 @@ function buildIndicesClearCache (opts) { * Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request * * @param {list} index - A comma-separated list of index name to limit the operation + * @param {boolean} field_data - Clear field data. This is deprecated. Prefer `fielddata`. * @param {boolean} fielddata - Clear field data * @param {list} fields - A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) * @param {boolean} query - Clear query caches @@ -36,10 +37,12 @@ function buildIndicesClearCache (opts) { * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {list} index - A comma-separated list of index name to limit the operation + * @param {boolean} request_cache - Clear request cache * @param {boolean} request - Clear request cache */ const acceptedQuerystring = [ + 'field_data', 'fielddata', 'fields', 'query', @@ -47,6 +50,7 @@ function buildIndicesClearCache (opts) { 'allow_no_indices', 'expand_wildcards', 'index', + 'request_cache', 'request', 'pretty', 'human', @@ -56,9 +60,11 @@ function buildIndicesClearCache (opts) { ] const snakeCase = { + fieldData: 'field_data', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + requestCache: 'request_cache', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -75,6 +81,15 @@ function buildIndicesClearCache (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesClearCache(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -96,7 +111,7 @@ function buildIndicesClearCache (opts) { var querystring = semicopy(params, ['method', 'body', 'index']) if (method == null) { - method = 'POST' + method = body == null ? 'GET' : 'POST' } var ignore = options.ignore || null diff --git a/api/api/indices.close.js b/api/api/indices.close.js index 46a92f3a9..c021ed985 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -70,6 +70,15 @@ function buildIndicesClose (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesClose(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.create.js b/api/api/indices.create.js index fadcb4981..f2ead4f1b 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -29,18 +29,18 @@ function buildIndicesCreate (opts) { * Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request * * @param {string} index - The name of the index - * @param {boolean} include_type_name - Whether a type should be expected in the body of the mappings. * @param {string} wait_for_active_shards - Set the number of active shards to wait for before the operation returns. * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master + * @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not * @param {object} body - The configuration for the index (`settings` and `mappings`) */ const acceptedQuerystring = [ - 'include_type_name', 'wait_for_active_shards', 'timeout', 'master_timeout', + 'update_all_types', 'pretty', 'human', 'error_trace', @@ -49,9 +49,9 @@ function buildIndicesCreate (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', waitForActiveShards: 'wait_for_active_shards', masterTimeout: 'master_timeout', + updateAllTypes: 'update_all_types', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -68,6 +68,15 @@ function buildIndicesCreate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesCreate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.delete.js b/api/api/indices.delete.js index 5a48c7794..8f7521a27 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -70,6 +70,15 @@ function buildIndicesDelete (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesDelete(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.delete_alias.js b/api/api/indices.delete_alias.js index 5b57fbb63..73cdac0f8 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -62,6 +62,15 @@ function buildIndicesDeleteAlias (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesDeleteAlias(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.delete_template.js b/api/api/indices.delete_template.js index a7fb0aca5..149b731bd 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -61,6 +61,15 @@ function buildIndicesDeleteTemplate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesDeleteTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( diff --git a/api/api/indices.exists.js b/api/api/indices.exists.js index a25cea993..106fe6ecd 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -73,6 +73,15 @@ function buildIndicesExists (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesExists(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.exists_alias.js b/api/api/indices.exists_alias.js index 9a5de4520..9549b8d45 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -68,6 +68,15 @@ function buildIndicesExistsAlias (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesExistsAlias(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index 52f0ab596..a8c7b5818 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -64,6 +64,15 @@ function buildIndicesExistsTemplate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesExistsTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( diff --git a/api/api/indices.exists_type.js b/api/api/indices.exists_type.js index 120f27f14..7c405dd56 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -68,6 +68,15 @@ function buildIndicesExistsType (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesExistsType(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.flush.js b/api/api/indices.flush.js index 854665f33..d949c3eb6 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -70,6 +70,15 @@ function buildIndicesFlush (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesFlush(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.flush_synced.js b/api/api/indices.flush_synced.js index ca4fa36f6..a1dae252d 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -65,6 +65,15 @@ function buildIndicesFlushSynced (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesFlushSynced(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.forcemerge.js b/api/api/indices.forcemerge.js index e4616ab7e..455718fcb 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -73,6 +73,15 @@ function buildIndicesForcemerge (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesForcemerge(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.freeze.js b/api/api/indices.freeze.js index bc2745c56..4e2d6e6c2 100644 --- a/api/api/indices.freeze.js +++ b/api/api/indices.freeze.js @@ -66,6 +66,15 @@ function buildIndicesFreeze (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesFreeze(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.get.js b/api/api/indices.get.js index bfcefdf9b..1afc69c28 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -29,7 +29,6 @@ function buildIndicesGet (opts) { * Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request * * @param {list} index - A comma-separated list of index names - * @param {boolean} include_type_name - Whether to add the type name to the response (default: false) * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) * @param {boolean} ignore_unavailable - Ignore unavailable indexes (default: false) * @param {boolean} allow_no_indices - Ignore if a wildcard expression resolves to no concrete indices (default: false) @@ -40,7 +39,6 @@ function buildIndicesGet (opts) { */ const acceptedQuerystring = [ - 'include_type_name', 'local', 'ignore_unavailable', 'allow_no_indices', @@ -56,7 +54,6 @@ function buildIndicesGet (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', @@ -79,6 +76,15 @@ function buildIndicesGet (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesGet(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index e0e06505d..454d60580 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -68,6 +68,15 @@ function buildIndicesGetAlias (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesGetAlias(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.get_field_mapping.js b/api/api/indices.get_field_mapping.js index f4b3e968c..15e1102d8 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -31,7 +31,6 @@ function buildIndicesGetFieldMapping (opts) { * @param {list} index - A comma-separated list of index names * @param {list} type - A comma-separated list of document types * @param {list} fields - A comma-separated list of fields - * @param {boolean} include_type_name - Whether a type should be returned in the body of the mappings. * @param {boolean} include_defaults - Whether the default mapping values should be returned as well * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) @@ -40,7 +39,6 @@ function buildIndicesGetFieldMapping (opts) { */ const acceptedQuerystring = [ - 'include_type_name', 'include_defaults', 'ignore_unavailable', 'allow_no_indices', @@ -54,7 +52,6 @@ function buildIndicesGetFieldMapping (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', includeDefaults: 'include_defaults', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', @@ -75,6 +72,15 @@ function buildIndicesGetFieldMapping (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesGetFieldMapping(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['fields'] == null) { return callback( diff --git a/api/api/indices.get_mapping.js b/api/api/indices.get_mapping.js index 1f2f2b5d9..25fd3ebf6 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -30,7 +30,6 @@ function buildIndicesGetMapping (opts) { * * @param {list} index - A comma-separated list of index names * @param {list} type - A comma-separated list of document types - * @param {boolean} include_type_name - Whether to add the type name to the response (default: false) * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. @@ -39,7 +38,6 @@ function buildIndicesGetMapping (opts) { */ const acceptedQuerystring = [ - 'include_type_name', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', @@ -53,7 +51,6 @@ function buildIndicesGetMapping (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', @@ -74,6 +71,15 @@ function buildIndicesGetMapping (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesGetMapping(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.get_settings.js b/api/api/indices.get_settings.js index 6e444f08e..08f5f7bc7 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -77,6 +77,15 @@ function buildIndicesGetSettings (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesGetSettings(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.get_template.js b/api/api/indices.get_template.js index 58fb3d83a..70aa7a154 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -29,14 +29,12 @@ function buildIndicesGetTemplate (opts) { * Perform a [indices.get_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * * @param {list} name - The comma separated names of the index templates - * @param {boolean} include_type_name - Whether a type should be returned in the body of the mappings. * @param {boolean} flat_settings - Return settings in flat format (default: false) * @param {time} master_timeout - Explicit operation timeout for connection to master node * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) */ const acceptedQuerystring = [ - 'include_type_name', 'flat_settings', 'master_timeout', 'local', @@ -48,7 +46,6 @@ function buildIndicesGetTemplate (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', flatSettings: 'flat_settings', masterTimeout: 'master_timeout', errorTrace: 'error_trace', @@ -67,6 +64,15 @@ function buildIndicesGetTemplate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesGetTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.get_upgrade.js b/api/api/indices.get_upgrade.js index a2b34458b..6ddbc646d 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -65,6 +65,15 @@ function buildIndicesGetUpgrade (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesGetUpgrade(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.open.js b/api/api/indices.open.js index b71427566..87e7b1417 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -73,6 +73,15 @@ function buildIndicesOpen (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesOpen(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.put_alias.js b/api/api/indices.put_alias.js index 7e5566d44..c6c5a2ee5 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -63,6 +63,15 @@ function buildIndicesPutAlias (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesPutAlias(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.put_mapping.js b/api/api/indices.put_mapping.js index da3c84df6..1cd8bffcc 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -30,22 +30,22 @@ function buildIndicesPutMapping (opts) { * * @param {list} index - A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. * @param {string} type - The name of the document type - * @param {boolean} include_type_name - Whether a type should be expected in the body of the mappings. * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {boolean} update_all_types - Whether to update the mapping for all fields with the same name across all types or not * @param {object} body - The mapping definition */ const acceptedQuerystring = [ - 'include_type_name', 'timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'update_all_types', 'pretty', 'human', 'error_trace', @@ -54,11 +54,11 @@ function buildIndicesPutMapping (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + updateAllTypes: 'update_all_types', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -75,7 +75,22 @@ function buildIndicesPutMapping (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesPutMapping(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params['body'] == null) { return callback( new ConfigurationError('Missing required parameter: body'), @@ -116,12 +131,8 @@ function buildIndicesPutMapping (opts) { path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type) } else if ((type) != null) { path = '/' + '_mapping' + '/' + encodeURIComponent(type) - } else if ((type) != null) { - path = '/' + '_mappings' + '/' + encodeURIComponent(type) - } else if ((index) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_mappings' } else { - path = '/' + encodeURIComponent(index) + '/' + '_mapping' + path = '/' + '_mappings' + '/' + encodeURIComponent(type) } // build request object diff --git a/api/api/indices.put_settings.js b/api/api/indices.put_settings.js index 6fa62c36e..8cf46293f 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -77,6 +77,15 @@ function buildIndicesPutSettings (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesPutSettings(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/indices.put_template.js b/api/api/indices.put_template.js index 55157756a..90a5a0971 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -29,7 +29,6 @@ function buildIndicesPutTemplate (opts) { * Perform a [indices.put_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request * * @param {string} name - The name of the template - * @param {boolean} include_type_name - Whether a type should be returned in the body of the mappings. * @param {number} order - The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) * @param {boolean} create - Whether the index template should only be added if new or can also replace an existing one * @param {time} timeout - Explicit operation timeout @@ -39,7 +38,6 @@ function buildIndicesPutTemplate (opts) { */ const acceptedQuerystring = [ - 'include_type_name', 'order', 'create', 'timeout', @@ -53,7 +51,6 @@ function buildIndicesPutTemplate (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', masterTimeout: 'master_timeout', flatSettings: 'flat_settings', errorTrace: 'error_trace', @@ -72,6 +69,15 @@ function buildIndicesPutTemplate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesPutTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( diff --git a/api/api/indices.recovery.js b/api/api/indices.recovery.js index 9fbb6c4ed..9556b44ee 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -61,6 +61,15 @@ function buildIndicesRecovery (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesRecovery(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.refresh.js b/api/api/indices.refresh.js index 87cbb843d..72298aca3 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -65,6 +65,15 @@ function buildIndicesRefresh (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesRefresh(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.rollover.js b/api/api/indices.rollover.js index a2ad11201..916bef287 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -30,7 +30,6 @@ function buildIndicesRollover (opts) { * * @param {string} alias - The name of the alias to rollover * @param {string} new_index - The name of the rollover index - * @param {boolean} include_type_name - Whether a type should be included in the body of the mappings. * @param {time} timeout - Explicit operation timeout * @param {boolean} dry_run - If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false * @param {time} master_timeout - Specify timeout for connection to master @@ -39,7 +38,6 @@ function buildIndicesRollover (opts) { */ const acceptedQuerystring = [ - 'include_type_name', 'timeout', 'dry_run', 'master_timeout', @@ -52,7 +50,6 @@ function buildIndicesRollover (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', dryRun: 'dry_run', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', @@ -72,6 +69,15 @@ function buildIndicesRollover (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesRollover(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['alias'] == null) { return callback( diff --git a/api/api/indices.segments.js b/api/api/indices.segments.js index cc1be5728..f0058cc6d 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -67,6 +67,15 @@ function buildIndicesSegments (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesSegments(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.shard_stores.js b/api/api/indices.shard_stores.js index 8add1c770..ff22da906 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -67,6 +67,15 @@ function buildIndicesShardStores (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesShardStores(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.shrink.js b/api/api/indices.shrink.js index 3693be4d1..8f3eb332a 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -69,6 +69,15 @@ function buildIndicesShrink (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesShrink(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.split.js b/api/api/indices.split.js index 26b6cefd6..51e22c94f 100644 --- a/api/api/indices.split.js +++ b/api/api/indices.split.js @@ -69,6 +69,15 @@ function buildIndicesSplit (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesSplit(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index 3c0b0906f..879ff40ad 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -74,6 +74,15 @@ function buildIndicesStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.unfreeze.js b/api/api/indices.unfreeze.js index 7c40fb726..58ac257ac 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/indices.unfreeze.js @@ -66,6 +66,15 @@ function buildIndicesUnfreeze (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesUnfreeze(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/indices.update_aliases.js b/api/api/indices.update_aliases.js index 2d9dd6f15..7188e5112 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -61,6 +61,15 @@ function buildIndicesUpdateAliases (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesUpdateAliases(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/indices.upgrade.js b/api/api/indices.upgrade.js index 6a16b1691..a1614f0ff 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -71,6 +71,15 @@ function buildIndicesUpgrade (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesUpgrade(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/indices.validate_query.js b/api/api/indices.validate_query.js index 813358340..6088e7d7e 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -88,6 +88,15 @@ function buildIndicesValidateQuery (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + indicesValidateQuery(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required url components if (params['type'] != null && (params['index'] == null)) { return callback( diff --git a/api/api/info.js b/api/api/info.js index 95e6c55f7..611a7382c 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -55,6 +55,15 @@ function buildInfo (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + info(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ingest.delete_pipeline.js b/api/api/ingest.delete_pipeline.js index 303c02ae1..8a567cde5 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -61,6 +61,15 @@ function buildIngestDeletePipeline (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ingestDeletePipeline(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( diff --git a/api/api/ingest.get_pipeline.js b/api/api/ingest.get_pipeline.js index 2a6aa3938..9c6a1f39f 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -59,6 +59,15 @@ function buildIngestGetPipeline (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ingestGetPipeline(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ingest.processor_grok.js b/api/api/ingest.processor_grok.js index d5b47b3d6..0d040e3e0 100644 --- a/api/api/ingest.processor_grok.js +++ b/api/api/ingest.processor_grok.js @@ -55,6 +55,15 @@ function buildIngestProcessorGrok (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ingestProcessorGrok(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ingest.put_pipeline.js b/api/api/ingest.put_pipeline.js index 13dc50ff3..2030a6be0 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -62,6 +62,15 @@ function buildIngestPutPipeline (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ingestPutPipeline(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( diff --git a/api/api/ingest.simulate.js b/api/api/ingest.simulate.js index 4d8c299f3..00caaa44b 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -59,6 +59,15 @@ function buildIngestSimulate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ingestSimulate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/mget.js b/api/api/mget.js index 5857ca38c..5844be7e5 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -77,6 +77,15 @@ function buildMget (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + mget(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/msearch.js b/api/api/msearch.js index a10558174..91ffea323 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -35,8 +35,7 @@ function buildMsearch (opts) { * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {number} pre_filter_shard_size - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. * @param {number} max_concurrent_shard_requests - The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests - * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * @param {boolean} rest_total_hits_as_int - This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number * @param {object} body - The request definitions (metadata-search request definition pairs), separated by newlines */ @@ -47,7 +46,6 @@ function buildMsearch (opts) { 'pre_filter_shard_size', 'max_concurrent_shard_requests', 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', @@ -62,7 +60,6 @@ function buildMsearch (opts) { preFilterShardSize: 'pre_filter_shard_size', maxConcurrentShardRequests: 'max_concurrent_shard_requests', restTotalHitsAsInt: 'rest_total_hits_as_int', - ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -79,6 +76,15 @@ function buildMsearch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + msearch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 5fd848d92..bcb438d26 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -33,8 +33,7 @@ function buildMsearchTemplate (opts) { * @param {enum} search_type - Search operation type * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute - * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * @param {boolean} rest_total_hits_as_int - This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number * @param {object} body - The request definitions (metadata-search request definition pairs), separated by newlines */ @@ -43,7 +42,6 @@ function buildMsearchTemplate (opts) { 'typed_keys', 'max_concurrent_searches', 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', @@ -56,7 +54,6 @@ function buildMsearchTemplate (opts) { typedKeys: 'typed_keys', maxConcurrentSearches: 'max_concurrent_searches', restTotalHitsAsInt: 'rest_total_hits_as_int', - ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -73,6 +70,15 @@ function buildMsearchTemplate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + msearchTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/mtermvectors.js b/api/api/mtermvectors.js index ceb3a089c..c06dafd2c 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -87,6 +87,15 @@ function buildMtermvectors (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + mtermvectors(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required url components if (params['type'] != null && (params['index'] == null)) { return callback( diff --git a/api/api/nodes.hot_threads.js b/api/api/nodes.hot_threads.js index e78ea5213..a4f70ff12 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -69,6 +69,15 @@ function buildNodesHotThreads (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + nodesHotThreads(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/nodes.info.js b/api/api/nodes.info.js index 41cbd98ce..c5a8648aa 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -62,6 +62,15 @@ function buildNodesInfo (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + nodesInfo(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/nodes.reload_secure_settings.js b/api/api/nodes.reload_secure_settings.js index a9fee39e7..489c5a759 100644 --- a/api/api/nodes.reload_secure_settings.js +++ b/api/api/nodes.reload_secure_settings.js @@ -26,7 +26,7 @@ function buildNodesReloadSecureSettings (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [nodes.reload_secure_settings](https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings) request + * Perform a [nodes.reload_secure_settings](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/secure-settings.html#reloadable-secure-settings) request * * @param {list} node_id - A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. * @param {time} timeout - Explicit operation timeout @@ -58,6 +58,15 @@ function buildNodesReloadSecureSettings (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + nodesReloadSecureSettings(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index f84e583de..25f02f5a4 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -77,6 +77,15 @@ function buildNodesStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + nodesStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/nodes.usage.js b/api/api/nodes.usage.js index 783066665..9400db998 100644 --- a/api/api/nodes.usage.js +++ b/api/api/nodes.usage.js @@ -59,6 +59,15 @@ function buildNodesUsage (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + nodesUsage(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/ping.js b/api/api/ping.js index e696c1568..fe6acf9af 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -55,6 +55,15 @@ function buildPing (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + ping(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/put_script.js b/api/api/put_script.js index 993e2130e..ae5cdce30 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -65,6 +65,15 @@ function buildPutScript (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + putScript(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index e3c3f39dc..2d97a62d2 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -66,6 +66,15 @@ function buildRankEval (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + rankEval(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/reindex.js b/api/api/reindex.js index 535fc265e..ced743919 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -71,6 +71,15 @@ function buildReindex (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + reindex(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 4bdf99863..eebcc7f1e 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -59,6 +59,15 @@ function buildReindexRethrottle (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + reindexRethrottle(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['task_id'] == null && params['taskId'] == null) { return callback( diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index 8936dc4f9..f9b53e3ba 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -57,6 +57,15 @@ function buildRenderSearchTemplate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + renderSearchTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index 0a0a8ae25..0bf6379a6 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -56,6 +56,15 @@ function buildScriptsPainlessExecute (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + scriptsPainlessExecute(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/scroll.js b/api/api/scroll.js index beff548d2..a146d8be7 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -31,7 +31,7 @@ function buildScroll (opts) { * @param {string} scroll_id - The scroll ID * @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {string} scroll_id - The scroll ID for scrolled search - * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * @param {boolean} rest_total_hits_as_int - This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number * @param {object} body - The scroll ID if not passed by URL or query parameter. */ @@ -65,6 +65,15 @@ function buildScroll (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + scroll(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( diff --git a/api/api/search.js b/api/api/search.js index e5b3cdfa9..3fed1a853 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -32,7 +32,6 @@ function buildSearch (opts) { * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} analyzer - The analyzer to use for the query string * @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false) - * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution * @param {enum} default_operator - The default operator for query string query (AND or OR) * @param {string} df - The field to use as default where no field prefix is given in the query string * @param {boolean} explain - Specify whether to return detailed information about score computation as part of a hit @@ -66,19 +65,17 @@ function buildSearch (opts) { * @param {boolean} allow_partial_search_results - Indicate if an error should be returned if there is a partial search failure or timeout * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response * @param {boolean} version - Specify whether to return document version as part of a hit - * @param {boolean} seq_no_primary_term - Specify whether to return sequence number and primary term of the last modification of each hit * @param {boolean} request_cache - Specify if request cache should be used for this request or not, defaults to index level setting * @param {number} batched_reduce_size - The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. - * @param {number} max_concurrent_shard_requests - The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + * @param {number} max_concurrent_shard_requests - The number of concurrent shard requests this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests * @param {number} pre_filter_shard_size - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. - * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * @param {boolean} rest_total_hits_as_int - This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number * @param {object} body - The search definition using the Query DSL */ const acceptedQuerystring = [ 'analyzer', 'analyze_wildcard', - 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', @@ -112,7 +109,6 @@ function buildSearch (opts) { 'allow_partial_search_results', 'typed_keys', 'version', - 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', @@ -127,7 +123,6 @@ function buildSearch (opts) { const snakeCase = { analyzeWildcard: 'analyze_wildcard', - ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', @@ -147,7 +142,6 @@ function buildSearch (opts) { trackTotalHits: 'track_total_hits', allowPartialSearchResults: 'allow_partial_search_results', typedKeys: 'typed_keys', - seqNoPrimaryTerm: 'seq_no_primary_term', requestCache: 'request_cache', batchedReduceSize: 'batched_reduce_size', maxConcurrentShardRequests: 'max_concurrent_shard_requests', @@ -169,6 +163,15 @@ function buildSearch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + search(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required url components if (params['type'] != null && (params['index'] == null)) { return callback( diff --git a/api/api/search_shards.js b/api/api/search_shards.js index 4ae9034ad..a142145a9 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -71,6 +71,15 @@ function buildSearchShards (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + searchShards(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/search_template.js b/api/api/search_template.js index 466d669c1..7210a4039 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -41,8 +41,7 @@ function buildSearchTemplate (opts) { * @param {boolean} explain - Specify whether to return detailed information about score computation as part of a hit * @param {boolean} profile - Specify whether to profile the query execution * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response - * @param {boolean} ccs_minimize_roundtrips - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * @param {boolean} rest_total_hits_as_int - This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number * @param {object} body - The search definition template and its params */ @@ -59,7 +58,6 @@ function buildSearchTemplate (opts) { 'profile', 'typed_keys', 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', @@ -75,7 +73,6 @@ function buildSearchTemplate (opts) { searchType: 'search_type', typedKeys: 'typed_keys', restTotalHitsAsInt: 'rest_total_hits_as_int', - ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -92,6 +89,15 @@ function buildSearchTemplate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + searchTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js deleted file mode 100644 index b5dd7e597..000000000 --- a/api/api/security.create_api_key.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -'use strict' - -/* eslint camelcase: 0 */ -/* eslint no-unused-vars: 0 */ - -function buildSecurityCreateApiKey (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [security.create_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html) request - * - * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. - * @param {object} body - The api key request to create an API key - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityCreateApiKey (params, options, callback) { - options = options || {} - if (typeof options === 'function') { - callback = options - options = {} - } - if (typeof params === 'function' || params == null) { - callback = params - params = {} - options = {} - } - - // check required parameters - if (params['body'] == null) { - return callback( - new ConfigurationError('Missing required parameter: body'), - result - ) - } - - // validate headers object - if (options.headers != null && typeof options.headers !== 'object') { - return callback( - new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`), - result - ) - } - - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'api_key' - - // build request object - const request = { - method, - path, - body: body || '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - compression: options.compression || false, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } - } -} - -module.exports = buildSecurityCreateApiKey diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js deleted file mode 100644 index 4d3d97769..000000000 --- a/api/api/security.get_api_key.js +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -'use strict' - -/* eslint camelcase: 0 */ -/* eslint no-unused-vars: 0 */ - -function buildSecurityGetApiKey (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [security.get_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html) request - * - * @param {string} id - API key id of the API key to be retrieved - * @param {string} name - API key name of the API key to be retrieved - * @param {string} username - user name of the user who created this API key to be retrieved - * @param {string} realm_name - realm name of the user who created this API key to be retrieved - */ - - const acceptedQuerystring = [ - 'id', - 'name', - 'username', - 'realm_name' - ] - - const snakeCase = { - realmName: 'realm_name' - } - - return function securityGetApiKey (params, options, callback) { - options = options || {} - if (typeof options === 'function') { - callback = options - options = {} - } - if (typeof params === 'function' || params == null) { - callback = params - params = {} - options = {} - } - - // check required parameters - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // validate headers object - if (options.headers != null && typeof options.headers !== 'object') { - return callback( - new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`), - result - ) - } - - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'api_key' - - // build request object - const request = { - method, - path, - body: null, - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - compression: options.compression || false, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } - } -} - -module.exports = buildSecurityGetApiKey diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js deleted file mode 100644 index 1d4a7f877..000000000 --- a/api/api/security.invalidate_api_key.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -'use strict' - -/* eslint camelcase: 0 */ -/* eslint no-unused-vars: 0 */ - -function buildSecurityInvalidateApiKey (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [security.invalidate_api_key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html) request - * - * @param {object} body - The api key request to invalidate API key(s) - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityInvalidateApiKey (params, options, callback) { - options = options || {} - if (typeof options === 'function') { - callback = options - options = {} - } - if (typeof params === 'function' || params == null) { - callback = params - params = {} - options = {} - } - - // check required parameters - if (params['body'] == null) { - return callback( - new ConfigurationError('Missing required parameter: body'), - result - ) - } - - // validate headers object - if (options.headers != null && typeof options.headers !== 'object') { - return callback( - new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`), - result - ) - } - - var warnings = null - var { method, body } = params - var querystring = semicopy(params, ['method', 'body']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'api_key' - - // build request object - const request = { - method, - path, - body: body || '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - compression: options.compression || false, - warnings - } - - return makeRequest(request, requestOptions, callback) - - function semicopy (obj, exclude) { - var target = {} - var keys = Object.keys(obj) - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i] - if (exclude.indexOf(key) === -1) { - target[snakeCase[key] || key] = obj[key] - if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) { - warnings = warnings || [] - warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter') - } - } - } - return target - } - } -} - -module.exports = buildSecurityInvalidateApiKey diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index 016a9fee6..fb74315c5 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -64,6 +64,15 @@ function buildSnapshotCreate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotCreate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['repository'] == null) { return callback( diff --git a/api/api/snapshot.create_repository.js b/api/api/snapshot.create_repository.js index 284f1e821..010a3b2b1 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -64,6 +64,15 @@ function buildSnapshotCreateRepository (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotCreateRepository(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['repository'] == null) { return callback( diff --git a/api/api/snapshot.delete.js b/api/api/snapshot.delete.js index 036535eb7..ab0e48383 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -60,6 +60,15 @@ function buildSnapshotDelete (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotDelete(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['repository'] == null) { return callback( diff --git a/api/api/snapshot.delete_repository.js b/api/api/snapshot.delete_repository.js index b552268c8..18c4ae4bb 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -61,6 +61,15 @@ function buildSnapshotDeleteRepository (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotDeleteRepository(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['repository'] == null) { return callback( diff --git a/api/api/snapshot.get.js b/api/api/snapshot.get.js index f05948fea..fd03f0260 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -65,6 +65,15 @@ function buildSnapshotGet (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotGet(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['repository'] == null) { return callback( diff --git a/api/api/snapshot.get_repository.js b/api/api/snapshot.get_repository.js index 1b0b32129..a71c5f723 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -61,6 +61,15 @@ function buildSnapshotGetRepository (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotGetRepository(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/snapshot.restore.js b/api/api/snapshot.restore.js index 13865283f..5feeaf569 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -64,6 +64,15 @@ function buildSnapshotRestore (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotRestore(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['repository'] == null) { return callback( diff --git a/api/api/snapshot.status.js b/api/api/snapshot.status.js index cb3536c40..6c376244f 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -63,6 +63,15 @@ function buildSnapshotStatus (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotStatus(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/snapshot.verify_repository.js b/api/api/snapshot.verify_repository.js index 12db7c034..27e1df088 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -61,6 +61,15 @@ function buildSnapshotVerifyRepository (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + snapshotVerifyRepository(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['repository'] == null) { return callback( diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 2d226efd9..98e123fcd 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -63,6 +63,15 @@ function buildTasksCancel (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + tasksCancel(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/tasks.get.js b/api/api/tasks.get.js index 032ca29a8..0b690a8a9 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -61,6 +61,15 @@ function buildTasksGet (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + tasksGet(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['task_id'] == null && params['taskId'] == null) { return callback( diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index 2d9362434..f54d77417 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -72,6 +72,15 @@ function buildTasksList (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + tasksList(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/termvectors.js b/api/api/termvectors.js index cb8a10d3e..2c14ad840 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -86,6 +86,15 @@ function buildTermvectors (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + termvectors(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( @@ -93,6 +102,12 @@ function buildTermvectors (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } // validate headers object if (options.headers != null && typeof options.headers !== 'object') { @@ -119,12 +134,8 @@ function buildTermvectors (opts) { if ((index) != null && (type) != null && (id) != null) { path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors' - } else if ((index) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id) - } else if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors' } else { - path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors' } // build request object diff --git a/api/api/update.js b/api/api/update.js index a1bbe0b54..bba1c8395 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -32,6 +32,7 @@ function buildUpdate (opts) { * @param {string} index - The name of the index * @param {string} type - The type of the document * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * @param {list} fields - A comma-separated list of fields to return in the response * @param {list} _source - True or false to return the _source field or not, or a list of fields to return * @param {list} _source_excludes - A list of fields to exclude from the returned _source field * @param {list} _source_includes - A list of fields to extract and return from the _source field @@ -41,13 +42,14 @@ function buildUpdate (opts) { * @param {number} retry_on_conflict - Specify how many times should the operation be retried when a conflict occurs (default: 0) * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout - * @param {number} if_seq_no - only perform the update operation if the last operation that has changed the document has the specified sequence number - * @param {number} if_primary_term - only perform the update operation if the last operation that has changed the document has the specified primary term + * @param {number} version - Explicit version number for concurrency control + * @param {enum} version_type - Specific version type * @param {object} body - The request definition requires either `script` or partial `doc` */ const acceptedQuerystring = [ 'wait_for_active_shards', + 'fields', '_source', '_source_excludes', '_source_includes', @@ -57,8 +59,8 @@ function buildUpdate (opts) { 'retry_on_conflict', 'routing', 'timeout', - 'if_seq_no', - 'if_primary_term', + 'version', + 'version_type', 'pretty', 'human', 'error_trace', @@ -71,8 +73,7 @@ function buildUpdate (opts) { _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', retryOnConflict: 'retry_on_conflict', - ifSeqNo: 'if_seq_no', - ifPrimaryTerm: 'if_primary_term', + versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -89,6 +90,15 @@ function buildUpdate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + update(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -102,6 +112,12 @@ function buildUpdate (opts) { result ) } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } if (params['body'] == null) { return callback( new ConfigurationError('Missing required parameter: body'), @@ -132,11 +148,7 @@ function buildUpdate (opts) { var path = '' - if ((index) != null && (type) != null && (id) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_update' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id) - } + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_update' // build request object const request = { diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index a6455a813..1e506f600 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -142,6 +142,15 @@ function buildUpdateByQuery (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + updateByQuery(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index b57d94b40..654ad8cfd 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -59,6 +59,15 @@ function buildUpdateByQueryRethrottle (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + updateByQueryRethrottle(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['task_id'] == null && params['taskId'] == null) { return callback( diff --git a/api/api/xpack.graph.explore.js b/api/api/xpack.graph.explore.js index c991bc53e..6bae26871 100644 --- a/api/api/xpack.graph.explore.js +++ b/api/api/xpack.graph.explore.js @@ -56,6 +56,15 @@ function buildXpackGraphExplore (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackGraphExplore(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required url components if (params['type'] != null && (params['index'] == null)) { return callback( @@ -88,9 +97,9 @@ function buildXpackGraphExplore (opts) { var path = '' if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore' + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_xpack' + '/' + 'graph' + '/' + '_explore' } else { - path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore' + path = '/' + encodeURIComponent(index) + '/' + '_xpack' + '/' + 'graph' + '/' + '_explore' } // build request object diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js index 6881278e2..a5bdbf823 100644 --- a/api/api/xpack.info.js +++ b/api/api/xpack.info.js @@ -51,6 +51,15 @@ function buildXpackInfo (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackInfo(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/xpack.license.delete.js b/api/api/xpack.license.delete.js index 0ba866644..2ad968056 100644 --- a/api/api/xpack.license.delete.js +++ b/api/api/xpack.license.delete.js @@ -50,6 +50,15 @@ function buildXpackLicenseDelete (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseDelete(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildXpackLicenseDelete (opts) { var path = '' - path = '/' + '_license' + path = '/' + '_xpack' + '/' + 'license' // build request object const request = { diff --git a/api/api/xpack.license.get.js b/api/api/xpack.license.get.js index fe2c0a32c..7edbb58e9 100644 --- a/api/api/xpack.license.get.js +++ b/api/api/xpack.license.get.js @@ -51,6 +51,15 @@ function buildXpackLicenseGet (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseGet(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -82,7 +91,7 @@ function buildXpackLicenseGet (opts) { var path = '' - path = '/' + '_license' + path = '/' + '_xpack' + '/' + 'license' // build request object const request = { diff --git a/api/api/xpack.license.get_basic_status.js b/api/api/xpack.license.get_basic_status.js index 0ec25ff6d..88d0da0ab 100644 --- a/api/api/xpack.license.get_basic_status.js +++ b/api/api/xpack.license.get_basic_status.js @@ -50,6 +50,15 @@ function buildXpackLicenseGetBasicStatus (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseGetBasicStatus(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildXpackLicenseGetBasicStatus (opts) { var path = '' - path = '/' + '_license' + '/' + 'basic_status' + path = '/' + '_xpack' + '/' + 'license' + '/' + 'basic_status' // build request object const request = { diff --git a/api/api/xpack.license.get_trial_status.js b/api/api/xpack.license.get_trial_status.js index 09660966b..fb5ccbc9d 100644 --- a/api/api/xpack.license.get_trial_status.js +++ b/api/api/xpack.license.get_trial_status.js @@ -50,6 +50,15 @@ function buildXpackLicenseGetTrialStatus (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseGetTrialStatus(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildXpackLicenseGetTrialStatus (opts) { var path = '' - path = '/' + '_license' + '/' + 'trial_status' + path = '/' + '_xpack' + '/' + 'license' + '/' + 'trial_status' // build request object const request = { diff --git a/api/api/xpack.license.post.js b/api/api/xpack.license.post.js index ebbd77e2d..667808390 100644 --- a/api/api/xpack.license.post.js +++ b/api/api/xpack.license.post.js @@ -52,6 +52,15 @@ function buildXpackLicensePost (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicensePost(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -75,7 +84,7 @@ function buildXpackLicensePost (opts) { var path = '' - path = '/' + '_license' + path = '/' + '_xpack' + '/' + 'license' // build request object const request = { diff --git a/api/api/xpack.license.post_start_basic.js b/api/api/xpack.license.post_start_basic.js index 9e9a6faae..69d8768e5 100644 --- a/api/api/xpack.license.post_start_basic.js +++ b/api/api/xpack.license.post_start_basic.js @@ -51,6 +51,15 @@ function buildXpackLicensePostStartBasic (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicensePostStartBasic(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -82,7 +91,7 @@ function buildXpackLicensePostStartBasic (opts) { var path = '' - path = '/' + '_license' + '/' + 'start_basic' + path = '/' + '_xpack' + '/' + 'license' + '/' + 'start_basic' // build request object const request = { diff --git a/api/api/xpack.license.post_start_trial.js b/api/api/xpack.license.post_start_trial.js index ac2c11f3a..74e4e155b 100644 --- a/api/api/xpack.license.post_start_trial.js +++ b/api/api/xpack.license.post_start_trial.js @@ -53,6 +53,15 @@ function buildXpackLicensePostStartTrial (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicensePostStartTrial(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -84,7 +93,7 @@ function buildXpackLicensePostStartTrial (opts) { var path = '' - path = '/' + '_license' + '/' + 'start_trial' + path = '/' + '_xpack' + '/' + 'license' + '/' + 'start_trial' // build request object const request = { diff --git a/api/api/xpack.migration.deprecations.js b/api/api/xpack.migration.deprecations.js index e5fbad087..d75116b7e 100644 --- a/api/api/xpack.migration.deprecations.js +++ b/api/api/xpack.migration.deprecations.js @@ -51,6 +51,15 @@ function buildXpackMigrationDeprecations (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMigrationDeprecations(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -83,9 +92,9 @@ function buildXpackMigrationDeprecations (opts) { var path = '' if ((index) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_migration' + '/' + 'deprecations' + path = '/' + encodeURIComponent(index) + '/' + '_xpack' + '/' + 'migration' + '/' + 'deprecations' } else { - path = '/' + '_migration' + '/' + 'deprecations' + path = '/' + '_xpack' + '/' + 'migration' + '/' + 'deprecations' } // build request object diff --git a/api/api/xpack.migration.get_assistance.js b/api/api/xpack.migration.get_assistance.js index 1840cdd9b..afca41755 100644 --- a/api/api/xpack.migration.get_assistance.js +++ b/api/api/xpack.migration.get_assistance.js @@ -58,6 +58,15 @@ function buildXpackMigrationGetAssistance (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMigrationGetAssistance(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -82,9 +91,9 @@ function buildXpackMigrationGetAssistance (opts) { var path = '' if ((index) != null) { - path = '/' + '_migration' + '/' + 'assistance' + '/' + encodeURIComponent(index) + path = '/' + '_xpack' + '/' + 'migration' + '/' + 'assistance' + '/' + encodeURIComponent(index) } else { - path = '/' + '_migration' + '/' + 'assistance' + path = '/' + '_xpack' + '/' + 'migration' + '/' + 'assistance' } // build request object diff --git a/api/api/xpack.migration.upgrade.js b/api/api/xpack.migration.upgrade.js index 305428a6c..5f40c1eb0 100644 --- a/api/api/xpack.migration.upgrade.js +++ b/api/api/xpack.migration.upgrade.js @@ -52,6 +52,15 @@ function buildXpackMigrationUpgrade (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMigrationUpgrade(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( @@ -83,7 +92,7 @@ function buildXpackMigrationUpgrade (opts) { var path = '' - path = '/' + '_migration' + '/' + 'upgrade' + '/' + encodeURIComponent(index) + path = '/' + '_xpack' + '/' + 'migration' + '/' + 'upgrade' + '/' + encodeURIComponent(index) // build request object const request = { diff --git a/api/api/ml.close_job.js b/api/api/xpack.ml.close_job.js similarity index 85% rename from api/api/ml.close_job.js rename to api/api/xpack.ml.close_job.js index 1b923f530..829b2519b 100644 --- a/api/api/ml.close_job.js +++ b/api/api/xpack.ml.close_job.js @@ -22,17 +22,16 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlCloseJob (opts) { +function buildXpackMlCloseJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.close_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html) request + * Perform a [xpack.ml.close_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html) request * * @param {string} job_id - The name of the job to close * @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) * @param {boolean} force - True if the job should be forcefully closed * @param {time} timeout - Controls the time to wait until a job has closed. Default to 30 minutes - * @param {object} body - The URL params optionally sent in the body */ const acceptedQuerystring = [ @@ -46,7 +45,7 @@ function buildMlCloseJob (opts) { } - return function mlCloseJob (params, options, callback) { + return function xpackMlCloseJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -58,6 +57,15 @@ function buildMlCloseJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlCloseJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -89,7 +97,7 @@ function buildMlCloseJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_close' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_close' // build request object const request = { @@ -129,4 +137,4 @@ function buildMlCloseJob (opts) { } } -module.exports = buildMlCloseJob +module.exports = buildXpackMlCloseJob diff --git a/api/api/ml.delete_calendar.js b/api/api/xpack.ml.delete_calendar.js similarity index 85% rename from api/api/ml.delete_calendar.js rename to api/api/xpack.ml.delete_calendar.js index 2e270a081..520180c28 100644 --- a/api/api/ml.delete_calendar.js +++ b/api/api/xpack.ml.delete_calendar.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteCalendar (opts) { +function buildXpackMlDeleteCalendar (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_calendar](undefined) request + * Perform a [xpack.ml.delete_calendar](undefined) request * * @param {string} calendar_id - The ID of the calendar to delete */ @@ -39,7 +39,7 @@ function buildMlDeleteCalendar (opts) { } - return function mlDeleteCalendar (params, options, callback) { + return function xpackMlDeleteCalendar (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildMlDeleteCalendar (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteCalendar(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['calendar_id'] == null && params['calendarId'] == null) { return callback( @@ -88,7 +97,7 @@ function buildMlDeleteCalendar (opts) { var path = '' - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) // build request object const request = { @@ -128,4 +137,4 @@ function buildMlDeleteCalendar (opts) { } } -module.exports = buildMlDeleteCalendar +module.exports = buildXpackMlDeleteCalendar diff --git a/api/api/ml.delete_calendar_event.js b/api/api/xpack.ml.delete_calendar_event.js similarity index 86% rename from api/api/ml.delete_calendar_event.js rename to api/api/xpack.ml.delete_calendar_event.js index b08e2b8ff..582a04adb 100644 --- a/api/api/ml.delete_calendar_event.js +++ b/api/api/xpack.ml.delete_calendar_event.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteCalendarEvent (opts) { +function buildXpackMlDeleteCalendarEvent (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_calendar_event](undefined) request + * Perform a [xpack.ml.delete_calendar_event](undefined) request * * @param {string} calendar_id - The ID of the calendar to modify * @param {string} event_id - The ID of the event to remove from the calendar @@ -40,7 +40,7 @@ function buildMlDeleteCalendarEvent (opts) { } - return function mlDeleteCalendarEvent (params, options, callback) { + return function xpackMlDeleteCalendarEvent (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlDeleteCalendarEvent (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteCalendarEvent(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['calendar_id'] == null && params['calendarId'] == null) { return callback( @@ -103,7 +112,7 @@ function buildMlDeleteCalendarEvent (opts) { var path = '' - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + '/' + encodeURIComponent(event_id || eventId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + '/' + encodeURIComponent(event_id || eventId) // build request object const request = { @@ -143,4 +152,4 @@ function buildMlDeleteCalendarEvent (opts) { } } -module.exports = buildMlDeleteCalendarEvent +module.exports = buildXpackMlDeleteCalendarEvent diff --git a/api/api/ml.delete_calendar_job.js b/api/api/xpack.ml.delete_calendar_job.js similarity index 86% rename from api/api/ml.delete_calendar_job.js rename to api/api/xpack.ml.delete_calendar_job.js index 4db8a932a..f766704a1 100644 --- a/api/api/ml.delete_calendar_job.js +++ b/api/api/xpack.ml.delete_calendar_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteCalendarJob (opts) { +function buildXpackMlDeleteCalendarJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_calendar_job](undefined) request + * Perform a [xpack.ml.delete_calendar_job](undefined) request * * @param {string} calendar_id - The ID of the calendar to modify * @param {string} job_id - The ID of the job to remove from the calendar @@ -40,7 +40,7 @@ function buildMlDeleteCalendarJob (opts) { } - return function mlDeleteCalendarJob (params, options, callback) { + return function xpackMlDeleteCalendarJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlDeleteCalendarJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteCalendarJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['calendar_id'] == null && params['calendarId'] == null) { return callback( @@ -103,7 +112,7 @@ function buildMlDeleteCalendarJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId) // build request object const request = { @@ -143,4 +152,4 @@ function buildMlDeleteCalendarJob (opts) { } } -module.exports = buildMlDeleteCalendarJob +module.exports = buildXpackMlDeleteCalendarJob diff --git a/api/api/ml.delete_datafeed.js b/api/api/xpack.ml.delete_datafeed.js similarity index 84% rename from api/api/ml.delete_datafeed.js rename to api/api/xpack.ml.delete_datafeed.js index 4e51efca3..b3ca3e5c8 100644 --- a/api/api/ml.delete_datafeed.js +++ b/api/api/xpack.ml.delete_datafeed.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteDatafeed (opts) { +function buildXpackMlDeleteDatafeed (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html) request + * Perform a [xpack.ml.delete_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html) request * * @param {string} datafeed_id - The ID of the datafeed to delete * @param {boolean} force - True if the datafeed should be forcefully deleted @@ -40,7 +40,7 @@ function buildMlDeleteDatafeed (opts) { } - return function mlDeleteDatafeed (params, options, callback) { + return function xpackMlDeleteDatafeed (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlDeleteDatafeed (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteDatafeed(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['datafeed_id'] == null && params['datafeedId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlDeleteDatafeed (opts) { var path = '' - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) // build request object const request = { @@ -129,4 +138,4 @@ function buildMlDeleteDatafeed (opts) { } } -module.exports = buildMlDeleteDatafeed +module.exports = buildXpackMlDeleteDatafeed diff --git a/api/api/ml.delete_expired_data.js b/api/api/xpack.ml.delete_expired_data.js similarity index 85% rename from api/api/ml.delete_expired_data.js rename to api/api/xpack.ml.delete_expired_data.js index 30ca5cadd..8958f9d33 100644 --- a/api/api/ml.delete_expired_data.js +++ b/api/api/xpack.ml.delete_expired_data.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteExpiredData (opts) { +function buildXpackMlDeleteExpiredData (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_expired_data](undefined) request + * Perform a [xpack.ml.delete_expired_data](undefined) request * */ @@ -38,7 +38,7 @@ function buildMlDeleteExpiredData (opts) { } - return function mlDeleteExpiredData (params, options, callback) { + return function xpackMlDeleteExpiredData (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -50,6 +50,15 @@ function buildMlDeleteExpiredData (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteExpiredData(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildMlDeleteExpiredData (opts) { var path = '' - path = '/' + '_ml' + '/' + '_delete_expired_data' + path = '/' + '_xpack' + '/' + 'ml' + '/' + '_delete_expired_data' // build request object const request = { @@ -121,4 +130,4 @@ function buildMlDeleteExpiredData (opts) { } } -module.exports = buildMlDeleteExpiredData +module.exports = buildXpackMlDeleteExpiredData diff --git a/api/api/ml.delete_filter.js b/api/api/xpack.ml.delete_filter.js similarity index 86% rename from api/api/ml.delete_filter.js rename to api/api/xpack.ml.delete_filter.js index 8a3218408..6260d5dc8 100644 --- a/api/api/ml.delete_filter.js +++ b/api/api/xpack.ml.delete_filter.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteFilter (opts) { +function buildXpackMlDeleteFilter (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_filter](undefined) request + * Perform a [xpack.ml.delete_filter](undefined) request * * @param {string} filter_id - The ID of the filter to delete */ @@ -39,7 +39,7 @@ function buildMlDeleteFilter (opts) { } - return function mlDeleteFilter (params, options, callback) { + return function xpackMlDeleteFilter (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildMlDeleteFilter (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteFilter(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['filter_id'] == null && params['filterId'] == null) { return callback( @@ -88,7 +97,7 @@ function buildMlDeleteFilter (opts) { var path = '' - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) // build request object const request = { @@ -128,4 +137,4 @@ function buildMlDeleteFilter (opts) { } } -module.exports = buildMlDeleteFilter +module.exports = buildXpackMlDeleteFilter diff --git a/api/api/ml.delete_forecast.js b/api/api/xpack.ml.delete_forecast.js similarity index 83% rename from api/api/ml.delete_forecast.js rename to api/api/xpack.ml.delete_forecast.js index 85c5d9d80..1e8fdaeb5 100644 --- a/api/api/ml.delete_forecast.js +++ b/api/api/xpack.ml.delete_forecast.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteForecast (opts) { +function buildXpackMlDeleteForecast (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_forecast](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html) request + * Perform a [xpack.ml.delete_forecast](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html) request * * @param {string} job_id - The ID of the job from which to delete forecasts * @param {string} forecast_id - The ID of the forecast to delete, can be comma delimited list. Leaving blank implies `_all` @@ -44,7 +44,7 @@ function buildMlDeleteForecast (opts) { } - return function mlDeleteForecast (params, options, callback) { + return function xpackMlDeleteForecast (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -56,6 +56,15 @@ function buildMlDeleteForecast (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteForecast(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -102,9 +111,9 @@ function buildMlDeleteForecast (opts) { var path = '' if ((job_id || jobId) != null && (forecast_id || forecastId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + '/' + encodeURIComponent(forecast_id || forecastId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + '/' + encodeURIComponent(forecast_id || forecastId) } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' } // build request object @@ -145,4 +154,4 @@ function buildMlDeleteForecast (opts) { } } -module.exports = buildMlDeleteForecast +module.exports = buildXpackMlDeleteForecast diff --git a/api/api/ml.delete_job.js b/api/api/xpack.ml.delete_job.js similarity index 85% rename from api/api/ml.delete_job.js rename to api/api/xpack.ml.delete_job.js index 5b692d36b..4565ee395 100644 --- a/api/api/ml.delete_job.js +++ b/api/api/xpack.ml.delete_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteJob (opts) { +function buildXpackMlDeleteJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html) request + * Perform a [xpack.ml.delete_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html) request * * @param {string} job_id - The ID of the job to delete * @param {boolean} force - True if the job should be forcefully deleted @@ -42,7 +42,7 @@ function buildMlDeleteJob (opts) { waitForCompletion: 'wait_for_completion' } - return function mlDeleteJob (params, options, callback) { + return function xpackMlDeleteJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -54,6 +54,15 @@ function buildMlDeleteJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -91,7 +100,7 @@ function buildMlDeleteJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) // build request object const request = { @@ -131,4 +140,4 @@ function buildMlDeleteJob (opts) { } } -module.exports = buildMlDeleteJob +module.exports = buildXpackMlDeleteJob diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/xpack.ml.delete_model_snapshot.js similarity index 84% rename from api/api/ml.delete_model_snapshot.js rename to api/api/xpack.ml.delete_model_snapshot.js index 3a13c967c..86f91f047 100644 --- a/api/api/ml.delete_model_snapshot.js +++ b/api/api/xpack.ml.delete_model_snapshot.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlDeleteModelSnapshot (opts) { +function buildXpackMlDeleteModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.delete_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html) request + * Perform a [xpack.ml.delete_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html) request * * @param {string} job_id - The ID of the job to fetch * @param {string} snapshot_id - The ID of the snapshot to delete @@ -40,7 +40,7 @@ function buildMlDeleteModelSnapshot (opts) { } - return function mlDeleteModelSnapshot (params, options, callback) { + return function xpackMlDeleteModelSnapshot (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlDeleteModelSnapshot (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteModelSnapshot(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -103,7 +112,7 @@ function buildMlDeleteModelSnapshot (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) // build request object const request = { @@ -143,4 +152,4 @@ function buildMlDeleteModelSnapshot (opts) { } } -module.exports = buildMlDeleteModelSnapshot +module.exports = buildXpackMlDeleteModelSnapshot diff --git a/api/api/ml.find_file_structure.js b/api/api/xpack.ml.find_file_structure.js similarity index 89% rename from api/api/ml.find_file_structure.js rename to api/api/xpack.ml.find_file_structure.js index c3cb5179f..a16af65ab 100644 --- a/api/api/ml.find_file_structure.js +++ b/api/api/xpack.ml.find_file_structure.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlFindFileStructure (opts) { +function buildXpackMlFindFileStructure (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure.html) request + * Perform a [xpack.ml.find_file_structure](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure.html) request * * @param {int} lines_to_sample - How many lines of the file should be included in the analysis * @param {time} timeout - Timeout after which the analysis will be aborted @@ -71,7 +71,7 @@ function buildMlFindFileStructure (opts) { } - return function mlFindFileStructure (params, options, callback) { + return function xpackMlFindFileStructure (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -83,6 +83,15 @@ function buildMlFindFileStructure (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlFindFileStructure(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -114,7 +123,7 @@ function buildMlFindFileStructure (opts) { var path = '' - path = '/' + '_ml' + '/' + 'find_file_structure' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'find_file_structure' // build request object const request = { @@ -154,4 +163,4 @@ function buildMlFindFileStructure (opts) { } } -module.exports = buildMlFindFileStructure +module.exports = buildXpackMlFindFileStructure diff --git a/api/api/ml.flush_job.js b/api/api/xpack.ml.flush_job.js similarity index 86% rename from api/api/ml.flush_job.js rename to api/api/xpack.ml.flush_job.js index b72f9395c..49b440efb 100644 --- a/api/api/ml.flush_job.js +++ b/api/api/xpack.ml.flush_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlFlushJob (opts) { +function buildXpackMlFlushJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.flush_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html) request + * Perform a [xpack.ml.flush_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html) request * * @param {string} job_id - The name of the job to flush * @param {boolean} calc_interim - Calculates interim results for the most recent bucket or all buckets within the latency period @@ -51,7 +51,7 @@ function buildMlFlushJob (opts) { skipTime: 'skip_time' } - return function mlFlushJob (params, options, callback) { + return function xpackMlFlushJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -63,6 +63,15 @@ function buildMlFlushJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlFlushJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -94,7 +103,7 @@ function buildMlFlushJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_flush' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_flush' // build request object const request = { @@ -134,4 +143,4 @@ function buildMlFlushJob (opts) { } } -module.exports = buildMlFlushJob +module.exports = buildXpackMlFlushJob diff --git a/api/api/ml.forecast.js b/api/api/xpack.ml.forecast.js similarity index 86% rename from api/api/ml.forecast.js rename to api/api/xpack.ml.forecast.js index 65d03b5f8..d003f9e2b 100644 --- a/api/api/ml.forecast.js +++ b/api/api/xpack.ml.forecast.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlForecast (opts) { +function buildXpackMlForecast (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.forecast](undefined) request + * Perform a [xpack.ml.forecast](undefined) request * * @param {string} job_id - The ID of the job to forecast for * @param {time} duration - The duration of the forecast @@ -42,7 +42,7 @@ function buildMlForecast (opts) { expiresIn: 'expires_in' } - return function mlForecast (params, options, callback) { + return function xpackMlForecast (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -54,6 +54,15 @@ function buildMlForecast (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlForecast(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -91,7 +100,7 @@ function buildMlForecast (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' // build request object const request = { @@ -131,4 +140,4 @@ function buildMlForecast (opts) { } } -module.exports = buildMlForecast +module.exports = buildXpackMlForecast diff --git a/api/api/ml.get_buckets.js b/api/api/xpack.ml.get_buckets.js similarity index 84% rename from api/api/ml.get_buckets.js rename to api/api/xpack.ml.get_buckets.js index 4d70ccb5f..b6136424e 100644 --- a/api/api/ml.get_buckets.js +++ b/api/api/xpack.ml.get_buckets.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetBuckets (opts) { +function buildXpackMlGetBuckets (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html) request + * Perform a [xpack.ml.get_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html) request * * @param {string} job_id - ID of the job to get bucket results from * @param {string} timestamp - The timestamp of the desired single bucket result @@ -60,7 +60,7 @@ function buildMlGetBuckets (opts) { } - return function mlGetBuckets (params, options, callback) { + return function xpackMlGetBuckets (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -72,6 +72,15 @@ function buildMlGetBuckets (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetBuckets(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -112,9 +121,9 @@ function buildMlGetBuckets (opts) { var path = '' if ((job_id || jobId) != null && (timestamp) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' + '/' + encodeURIComponent(timestamp) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' + '/' + encodeURIComponent(timestamp) } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' } // build request object @@ -155,4 +164,4 @@ function buildMlGetBuckets (opts) { } } -module.exports = buildMlGetBuckets +module.exports = buildXpackMlGetBuckets diff --git a/api/api/ml.get_calendar_events.js b/api/api/xpack.ml.get_calendar_events.js similarity index 86% rename from api/api/ml.get_calendar_events.js rename to api/api/xpack.ml.get_calendar_events.js index bdc373d30..2f7f8153c 100644 --- a/api/api/ml.get_calendar_events.js +++ b/api/api/xpack.ml.get_calendar_events.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetCalendarEvents (opts) { +function buildXpackMlGetCalendarEvents (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_calendar_events](undefined) request + * Perform a [xpack.ml.get_calendar_events](undefined) request * * @param {string} calendar_id - The ID of the calendar containing the events * @param {string} job_id - Get events for the job. When this option is used calendar_id must be '_all' @@ -49,7 +49,7 @@ function buildMlGetCalendarEvents (opts) { } - return function mlGetCalendarEvents (params, options, callback) { + return function xpackMlGetCalendarEvents (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -61,6 +61,15 @@ function buildMlGetCalendarEvents (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetCalendarEvents(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['calendar_id'] == null && params['calendarId'] == null) { return callback( @@ -98,7 +107,7 @@ function buildMlGetCalendarEvents (opts) { var path = '' - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' // build request object const request = { @@ -138,4 +147,4 @@ function buildMlGetCalendarEvents (opts) { } } -module.exports = buildMlGetCalendarEvents +module.exports = buildXpackMlGetCalendarEvents diff --git a/api/api/ml.get_calendars.js b/api/api/xpack.ml.get_calendars.js similarity index 84% rename from api/api/ml.get_calendars.js rename to api/api/xpack.ml.get_calendars.js index 810145c7f..7ee2b43ff 100644 --- a/api/api/ml.get_calendars.js +++ b/api/api/xpack.ml.get_calendars.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetCalendars (opts) { +function buildXpackMlGetCalendars (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_calendars](undefined) request + * Perform a [xpack.ml.get_calendars](undefined) request * * @param {string} calendar_id - The ID of the calendar to fetch * @param {int} from - skips a number of calendars @@ -42,7 +42,7 @@ function buildMlGetCalendars (opts) { } - return function mlGetCalendars (params, options, callback) { + return function xpackMlGetCalendars (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -54,6 +54,15 @@ function buildMlGetCalendars (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetCalendars(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -86,9 +95,9 @@ function buildMlGetCalendars (opts) { var path = '' if ((calendar_id || calendarId) != null) { - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) } else { - path = '/' + '_ml' + '/' + 'calendars' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' } // build request object @@ -129,4 +138,4 @@ function buildMlGetCalendars (opts) { } } -module.exports = buildMlGetCalendars +module.exports = buildXpackMlGetCalendars diff --git a/api/api/ml.get_categories.js b/api/api/xpack.ml.get_categories.js similarity index 80% rename from api/api/ml.get_categories.js rename to api/api/xpack.ml.get_categories.js index 47c203b3e..0ff6a2bd3 100644 --- a/api/api/ml.get_categories.js +++ b/api/api/xpack.ml.get_categories.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetCategories (opts) { +function buildXpackMlGetCategories (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request + * Perform a [xpack.ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request * * @param {string} job_id - The name of the job * @param {long} category_id - The identifier of the category definition of interest @@ -44,7 +44,7 @@ function buildMlGetCategories (opts) { } - return function mlGetCategories (params, options, callback) { + return function xpackMlGetCategories (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -56,6 +56,15 @@ function buildMlGetCategories (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetCategories(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -88,9 +97,9 @@ function buildMlGetCategories (opts) { var path = '' if ((job_id || jobId) != null && (category_id || categoryId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' + '/' + encodeURIComponent(category_id || categoryId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' + '/' + encodeURIComponent(category_id || categoryId) } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' } // build request object @@ -131,4 +140,4 @@ function buildMlGetCategories (opts) { } } -module.exports = buildMlGetCategories +module.exports = buildXpackMlGetCategories diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/xpack.ml.get_datafeed_stats.js similarity index 82% rename from api/api/ml.get_datafeed_stats.js rename to api/api/xpack.ml.get_datafeed_stats.js index 97c8ea3c0..ee2c7cad2 100644 --- a/api/api/ml.get_datafeed_stats.js +++ b/api/api/xpack.ml.get_datafeed_stats.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetDatafeedStats (opts) { +function buildXpackMlGetDatafeedStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_datafeed_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html) request + * Perform a [xpack.ml.get_datafeed_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html) request * * @param {string} datafeed_id - The ID of the datafeeds stats to fetch * @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) @@ -40,7 +40,7 @@ function buildMlGetDatafeedStats (opts) { allowNoDatafeeds: 'allow_no_datafeeds' } - return function mlGetDatafeedStats (params, options, callback) { + return function xpackMlGetDatafeedStats (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlGetDatafeedStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetDatafeedStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -84,9 +93,9 @@ function buildMlGetDatafeedStats (opts) { var path = '' if ((datafeed_id || datafeedId) != null) { - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stats' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stats' } else { - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + '_stats' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + '_stats' } // build request object @@ -127,4 +136,4 @@ function buildMlGetDatafeedStats (opts) { } } -module.exports = buildMlGetDatafeedStats +module.exports = buildXpackMlGetDatafeedStats diff --git a/api/api/ml.get_datafeeds.js b/api/api/xpack.ml.get_datafeeds.js similarity index 83% rename from api/api/ml.get_datafeeds.js rename to api/api/xpack.ml.get_datafeeds.js index ae88fb528..ab16252fb 100644 --- a/api/api/ml.get_datafeeds.js +++ b/api/api/xpack.ml.get_datafeeds.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetDatafeeds (opts) { +function buildXpackMlGetDatafeeds (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_datafeeds](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html) request + * Perform a [xpack.ml.get_datafeeds](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html) request * * @param {string} datafeed_id - The ID of the datafeeds to fetch * @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) @@ -40,7 +40,7 @@ function buildMlGetDatafeeds (opts) { allowNoDatafeeds: 'allow_no_datafeeds' } - return function mlGetDatafeeds (params, options, callback) { + return function xpackMlGetDatafeeds (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlGetDatafeeds (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetDatafeeds(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -84,9 +93,9 @@ function buildMlGetDatafeeds (opts) { var path = '' if ((datafeed_id || datafeedId) != null) { - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) } else { - path = '/' + '_ml' + '/' + 'datafeeds' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' } // build request object @@ -127,4 +136,4 @@ function buildMlGetDatafeeds (opts) { } } -module.exports = buildMlGetDatafeeds +module.exports = buildXpackMlGetDatafeeds diff --git a/api/api/ml.get_filters.js b/api/api/xpack.ml.get_filters.js similarity index 84% rename from api/api/ml.get_filters.js rename to api/api/xpack.ml.get_filters.js index 5666cf902..869145372 100644 --- a/api/api/ml.get_filters.js +++ b/api/api/xpack.ml.get_filters.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetFilters (opts) { +function buildXpackMlGetFilters (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_filters](undefined) request + * Perform a [xpack.ml.get_filters](undefined) request * * @param {string} filter_id - The ID of the filter to fetch * @param {int} from - skips a number of filters @@ -42,7 +42,7 @@ function buildMlGetFilters (opts) { } - return function mlGetFilters (params, options, callback) { + return function xpackMlGetFilters (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -54,6 +54,15 @@ function buildMlGetFilters (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetFilters(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -86,9 +95,9 @@ function buildMlGetFilters (opts) { var path = '' if ((filter_id || filterId) != null) { - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) } else { - path = '/' + '_ml' + '/' + 'filters' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' } // build request object @@ -129,4 +138,4 @@ function buildMlGetFilters (opts) { } } -module.exports = buildMlGetFilters +module.exports = buildXpackMlGetFilters diff --git a/api/api/ml.get_influencers.js b/api/api/xpack.ml.get_influencers.js similarity index 85% rename from api/api/ml.get_influencers.js rename to api/api/xpack.ml.get_influencers.js index 498f13d20..931ff9bc9 100644 --- a/api/api/ml.get_influencers.js +++ b/api/api/xpack.ml.get_influencers.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetInfluencers (opts) { +function buildXpackMlGetInfluencers (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_influencers](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html) request + * Perform a [xpack.ml.get_influencers](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html) request * * @param {string} job_id - * @param {boolean} exclude_interim - Exclude interim results @@ -57,7 +57,7 @@ function buildMlGetInfluencers (opts) { } - return function mlGetInfluencers (params, options, callback) { + return function xpackMlGetInfluencers (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -69,6 +69,15 @@ function buildMlGetInfluencers (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetInfluencers(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -100,7 +109,7 @@ function buildMlGetInfluencers (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'influencers' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'influencers' // build request object const request = { @@ -140,4 +149,4 @@ function buildMlGetInfluencers (opts) { } } -module.exports = buildMlGetInfluencers +module.exports = buildXpackMlGetInfluencers diff --git a/api/api/ml.get_job_stats.js b/api/api/xpack.ml.get_job_stats.js similarity index 82% rename from api/api/ml.get_job_stats.js rename to api/api/xpack.ml.get_job_stats.js index 7c8e8b653..72d822de6 100644 --- a/api/api/ml.get_job_stats.js +++ b/api/api/xpack.ml.get_job_stats.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetJobStats (opts) { +function buildXpackMlGetJobStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_job_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html) request + * Perform a [xpack.ml.get_job_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html) request * * @param {string} job_id - The ID of the jobs stats to fetch * @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) @@ -40,7 +40,7 @@ function buildMlGetJobStats (opts) { allowNoJobs: 'allow_no_jobs' } - return function mlGetJobStats (params, options, callback) { + return function xpackMlGetJobStats (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlGetJobStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetJobStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -84,9 +93,9 @@ function buildMlGetJobStats (opts) { var path = '' if ((job_id || jobId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_stats' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_stats' } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_stats' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + '_stats' } // build request object @@ -127,4 +136,4 @@ function buildMlGetJobStats (opts) { } } -module.exports = buildMlGetJobStats +module.exports = buildXpackMlGetJobStats diff --git a/api/api/ml.get_jobs.js b/api/api/xpack.ml.get_jobs.js similarity index 83% rename from api/api/ml.get_jobs.js rename to api/api/xpack.ml.get_jobs.js index fcb8734c7..a4c081b87 100644 --- a/api/api/ml.get_jobs.js +++ b/api/api/xpack.ml.get_jobs.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetJobs (opts) { +function buildXpackMlGetJobs (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_jobs](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html) request + * Perform a [xpack.ml.get_jobs](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html) request * * @param {string} job_id - The ID of the jobs to fetch * @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) @@ -40,7 +40,7 @@ function buildMlGetJobs (opts) { allowNoJobs: 'allow_no_jobs' } - return function mlGetJobs (params, options, callback) { + return function xpackMlGetJobs (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlGetJobs (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetJobs(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -84,9 +93,9 @@ function buildMlGetJobs (opts) { var path = '' if ((job_id || jobId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' } // build request object @@ -127,4 +136,4 @@ function buildMlGetJobs (opts) { } } -module.exports = buildMlGetJobs +module.exports = buildXpackMlGetJobs diff --git a/api/api/ml.get_model_snapshots.js b/api/api/xpack.ml.get_model_snapshots.js similarity index 83% rename from api/api/ml.get_model_snapshots.js rename to api/api/xpack.ml.get_model_snapshots.js index f9b2aae7d..88827c191 100644 --- a/api/api/ml.get_model_snapshots.js +++ b/api/api/xpack.ml.get_model_snapshots.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetModelSnapshots (opts) { +function buildXpackMlGetModelSnapshots (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_model_snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html) request + * Perform a [xpack.ml.get_model_snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html) request * * @param {string} job_id - The ID of the job to fetch * @param {string} snapshot_id - The ID of the snapshot to fetch @@ -52,7 +52,7 @@ function buildMlGetModelSnapshots (opts) { } - return function mlGetModelSnapshots (params, options, callback) { + return function xpackMlGetModelSnapshots (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -64,6 +64,15 @@ function buildMlGetModelSnapshots (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetModelSnapshots(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -104,9 +113,9 @@ function buildMlGetModelSnapshots (opts) { var path = '' if ((job_id || jobId) != null && (snapshot_id || snapshotId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' } // build request object @@ -147,4 +156,4 @@ function buildMlGetModelSnapshots (opts) { } } -module.exports = buildMlGetModelSnapshots +module.exports = buildXpackMlGetModelSnapshots diff --git a/api/api/ml.get_overall_buckets.js b/api/api/xpack.ml.get_overall_buckets.js similarity index 86% rename from api/api/ml.get_overall_buckets.js rename to api/api/xpack.ml.get_overall_buckets.js index d5e647590..7c79b6aad 100644 --- a/api/api/ml.get_overall_buckets.js +++ b/api/api/xpack.ml.get_overall_buckets.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetOverallBuckets (opts) { +function buildXpackMlGetOverallBuckets (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request + * Perform a [xpack.ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request * * @param {string} job_id - The job IDs for which to calculate overall bucket results * @param {int} top_n - The number of top job bucket scores to be used in the overall_score calculation @@ -57,7 +57,7 @@ function buildMlGetOverallBuckets (opts) { allowNoJobs: 'allow_no_jobs' } - return function mlGetOverallBuckets (params, options, callback) { + return function xpackMlGetOverallBuckets (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -69,6 +69,15 @@ function buildMlGetOverallBuckets (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetOverallBuckets(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -100,7 +109,7 @@ function buildMlGetOverallBuckets (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets' // build request object const request = { @@ -140,4 +149,4 @@ function buildMlGetOverallBuckets (opts) { } } -module.exports = buildMlGetOverallBuckets +module.exports = buildXpackMlGetOverallBuckets diff --git a/api/api/ml.get_records.js b/api/api/xpack.ml.get_records.js similarity index 85% rename from api/api/ml.get_records.js rename to api/api/xpack.ml.get_records.js index e38213f0f..0a87f27c1 100644 --- a/api/api/ml.get_records.js +++ b/api/api/xpack.ml.get_records.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlGetRecords (opts) { +function buildXpackMlGetRecords (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.get_records](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html) request + * Perform a [xpack.ml.get_records](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html) request * * @param {string} job_id - * @param {boolean} exclude_interim - Exclude interim results @@ -57,7 +57,7 @@ function buildMlGetRecords (opts) { } - return function mlGetRecords (params, options, callback) { + return function xpackMlGetRecords (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -69,6 +69,15 @@ function buildMlGetRecords (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetRecords(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -100,7 +109,7 @@ function buildMlGetRecords (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'records' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'records' // build request object const request = { @@ -140,4 +149,4 @@ function buildMlGetRecords (opts) { } } -module.exports = buildMlGetRecords +module.exports = buildXpackMlGetRecords diff --git a/api/api/ml.info.js b/api/api/xpack.ml.info.js similarity index 86% rename from api/api/ml.info.js rename to api/api/xpack.ml.info.js index 55c7c9e0e..67fae91eb 100644 --- a/api/api/ml.info.js +++ b/api/api/xpack.ml.info.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlInfo (opts) { +function buildXpackMlInfo (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.info](undefined) request + * Perform a [xpack.ml.info](undefined) request * */ @@ -38,7 +38,7 @@ function buildMlInfo (opts) { } - return function mlInfo (params, options, callback) { + return function xpackMlInfo (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -50,6 +50,15 @@ function buildMlInfo (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlInfo(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -73,7 +82,7 @@ function buildMlInfo (opts) { var path = '' - path = '/' + '_ml' + '/' + 'info' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'info' // build request object const request = { @@ -113,4 +122,4 @@ function buildMlInfo (opts) { } } -module.exports = buildMlInfo +module.exports = buildXpackMlInfo diff --git a/api/api/ml.open_job.js b/api/api/xpack.ml.open_job.js similarity index 85% rename from api/api/ml.open_job.js rename to api/api/xpack.ml.open_job.js index 81f92ae12..172763464 100644 --- a/api/api/ml.open_job.js +++ b/api/api/xpack.ml.open_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlOpenJob (opts) { +function buildXpackMlOpenJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.open_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html) request + * Perform a [xpack.ml.open_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html) request * * @param {string} job_id - The ID of the job to open * @param {boolean} ignore_downtime - Controls if gaps in data are treated as anomalous or as a maintenance window after a job re-start @@ -41,7 +41,7 @@ function buildMlOpenJob (opts) { } - return function mlOpenJob (params, options, callback) { + return function xpackMlOpenJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +53,15 @@ function buildMlOpenJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlOpenJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -90,7 +99,7 @@ function buildMlOpenJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_open' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_open' // build request object const request = { @@ -130,4 +139,4 @@ function buildMlOpenJob (opts) { } } -module.exports = buildMlOpenJob +module.exports = buildXpackMlOpenJob diff --git a/api/api/ml.post_calendar_events.js b/api/api/xpack.ml.post_calendar_events.js similarity index 85% rename from api/api/ml.post_calendar_events.js rename to api/api/xpack.ml.post_calendar_events.js index a99b009da..fb0845040 100644 --- a/api/api/ml.post_calendar_events.js +++ b/api/api/xpack.ml.post_calendar_events.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPostCalendarEvents (opts) { +function buildXpackMlPostCalendarEvents (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.post_calendar_events](undefined) request + * Perform a [xpack.ml.post_calendar_events](undefined) request * * @param {string} calendar_id - The ID of the calendar to modify * @param {object} body - A list of events @@ -40,7 +40,7 @@ function buildMlPostCalendarEvents (opts) { } - return function mlPostCalendarEvents (params, options, callback) { + return function xpackMlPostCalendarEvents (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlPostCalendarEvents (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPostCalendarEvents(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['calendar_id'] == null && params['calendarId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlPostCalendarEvents (opts) { var path = '' - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' // build request object const request = { @@ -129,4 +138,4 @@ function buildMlPostCalendarEvents (opts) { } } -module.exports = buildMlPostCalendarEvents +module.exports = buildXpackMlPostCalendarEvents diff --git a/api/api/ml.post_data.js b/api/api/xpack.ml.post_data.js similarity index 85% rename from api/api/ml.post_data.js rename to api/api/xpack.ml.post_data.js index 702ad50a2..d059880b0 100644 --- a/api/api/ml.post_data.js +++ b/api/api/xpack.ml.post_data.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPostData (opts) { +function buildXpackMlPostData (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.post_data](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html) request + * Perform a [xpack.ml.post_data](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html) request * * @param {string} job_id - The name of the job receiving the data * @param {string} reset_start - Optional parameter to specify the start of the bucket resetting range @@ -44,7 +44,7 @@ function buildMlPostData (opts) { resetEnd: 'reset_end' } - return function mlPostData (params, options, callback) { + return function xpackMlPostData (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -56,6 +56,15 @@ function buildMlPostData (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPostData(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -93,7 +102,7 @@ function buildMlPostData (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_data' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_data' // build request object const request = { @@ -133,4 +142,4 @@ function buildMlPostData (opts) { } } -module.exports = buildMlPostData +module.exports = buildXpackMlPostData diff --git a/api/api/ml.preview_datafeed.js b/api/api/xpack.ml.preview_datafeed.js similarity index 83% rename from api/api/ml.preview_datafeed.js rename to api/api/xpack.ml.preview_datafeed.js index c7b68045c..3610ff5fc 100644 --- a/api/api/ml.preview_datafeed.js +++ b/api/api/xpack.ml.preview_datafeed.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPreviewDatafeed (opts) { +function buildXpackMlPreviewDatafeed (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.preview_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html) request + * Perform a [xpack.ml.preview_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html) request * * @param {string} datafeed_id - The ID of the datafeed to preview */ @@ -39,7 +39,7 @@ function buildMlPreviewDatafeed (opts) { } - return function mlPreviewDatafeed (params, options, callback) { + return function xpackMlPreviewDatafeed (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildMlPreviewDatafeed (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPreviewDatafeed(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['datafeed_id'] == null && params['datafeedId'] == null) { return callback( @@ -88,7 +97,7 @@ function buildMlPreviewDatafeed (opts) { var path = '' - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview' // build request object const request = { @@ -128,4 +137,4 @@ function buildMlPreviewDatafeed (opts) { } } -module.exports = buildMlPreviewDatafeed +module.exports = buildXpackMlPreviewDatafeed diff --git a/api/api/ml.put_calendar.js b/api/api/xpack.ml.put_calendar.js similarity index 85% rename from api/api/ml.put_calendar.js rename to api/api/xpack.ml.put_calendar.js index a47f770ce..dad586bf2 100644 --- a/api/api/ml.put_calendar.js +++ b/api/api/xpack.ml.put_calendar.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPutCalendar (opts) { +function buildXpackMlPutCalendar (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.put_calendar](undefined) request + * Perform a [xpack.ml.put_calendar](undefined) request * * @param {string} calendar_id - The ID of the calendar to create * @param {object} body - The calendar details @@ -40,7 +40,7 @@ function buildMlPutCalendar (opts) { } - return function mlPutCalendar (params, options, callback) { + return function xpackMlPutCalendar (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlPutCalendar (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutCalendar(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['calendar_id'] == null && params['calendarId'] == null) { return callback( @@ -83,7 +92,7 @@ function buildMlPutCalendar (opts) { var path = '' - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) // build request object const request = { @@ -123,4 +132,4 @@ function buildMlPutCalendar (opts) { } } -module.exports = buildMlPutCalendar +module.exports = buildXpackMlPutCalendar diff --git a/api/api/ml.put_calendar_job.js b/api/api/xpack.ml.put_calendar_job.js similarity index 86% rename from api/api/ml.put_calendar_job.js rename to api/api/xpack.ml.put_calendar_job.js index 7c23f126f..562281292 100644 --- a/api/api/ml.put_calendar_job.js +++ b/api/api/xpack.ml.put_calendar_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPutCalendarJob (opts) { +function buildXpackMlPutCalendarJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.put_calendar_job](undefined) request + * Perform a [xpack.ml.put_calendar_job](undefined) request * * @param {string} calendar_id - The ID of the calendar to modify * @param {string} job_id - The ID of the job to add to the calendar @@ -40,7 +40,7 @@ function buildMlPutCalendarJob (opts) { } - return function mlPutCalendarJob (params, options, callback) { + return function xpackMlPutCalendarJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlPutCalendarJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutCalendarJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['calendar_id'] == null && params['calendarId'] == null) { return callback( @@ -103,7 +112,7 @@ function buildMlPutCalendarJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId) // build request object const request = { @@ -143,4 +152,4 @@ function buildMlPutCalendarJob (opts) { } } -module.exports = buildMlPutCalendarJob +module.exports = buildXpackMlPutCalendarJob diff --git a/api/api/ml.put_datafeed.js b/api/api/xpack.ml.put_datafeed.js similarity index 84% rename from api/api/ml.put_datafeed.js rename to api/api/xpack.ml.put_datafeed.js index 4a6856c83..5d6f1ab41 100644 --- a/api/api/ml.put_datafeed.js +++ b/api/api/xpack.ml.put_datafeed.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPutDatafeed (opts) { +function buildXpackMlPutDatafeed (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.put_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html) request + * Perform a [xpack.ml.put_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html) request * * @param {string} datafeed_id - The ID of the datafeed to create * @param {object} body - The datafeed config @@ -40,7 +40,7 @@ function buildMlPutDatafeed (opts) { } - return function mlPutDatafeed (params, options, callback) { + return function xpackMlPutDatafeed (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlPutDatafeed (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutDatafeed(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['datafeed_id'] == null && params['datafeedId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlPutDatafeed (opts) { var path = '' - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) // build request object const request = { @@ -129,4 +138,4 @@ function buildMlPutDatafeed (opts) { } } -module.exports = buildMlPutDatafeed +module.exports = buildXpackMlPutDatafeed diff --git a/api/api/ml.put_filter.js b/api/api/xpack.ml.put_filter.js similarity index 86% rename from api/api/ml.put_filter.js rename to api/api/xpack.ml.put_filter.js index 63d2b3ec9..a776ca638 100644 --- a/api/api/ml.put_filter.js +++ b/api/api/xpack.ml.put_filter.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPutFilter (opts) { +function buildXpackMlPutFilter (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.put_filter](undefined) request + * Perform a [xpack.ml.put_filter](undefined) request * * @param {string} filter_id - The ID of the filter to create * @param {object} body - The filter details @@ -40,7 +40,7 @@ function buildMlPutFilter (opts) { } - return function mlPutFilter (params, options, callback) { + return function xpackMlPutFilter (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlPutFilter (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutFilter(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['filter_id'] == null && params['filterId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlPutFilter (opts) { var path = '' - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) // build request object const request = { @@ -129,4 +138,4 @@ function buildMlPutFilter (opts) { } } -module.exports = buildMlPutFilter +module.exports = buildXpackMlPutFilter diff --git a/api/api/ml.put_job.js b/api/api/xpack.ml.put_job.js similarity index 85% rename from api/api/ml.put_job.js rename to api/api/xpack.ml.put_job.js index f5f363974..97496a619 100644 --- a/api/api/ml.put_job.js +++ b/api/api/xpack.ml.put_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlPutJob (opts) { +function buildXpackMlPutJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.put_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html) request + * Perform a [xpack.ml.put_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html) request * * @param {string} job_id - The ID of the job to create * @param {object} body - The job @@ -40,7 +40,7 @@ function buildMlPutJob (opts) { } - return function mlPutJob (params, options, callback) { + return function xpackMlPutJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlPutJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlPutJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) // build request object const request = { @@ -129,4 +138,4 @@ function buildMlPutJob (opts) { } } -module.exports = buildMlPutJob +module.exports = buildXpackMlPutJob diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/xpack.ml.revert_model_snapshot.js similarity index 84% rename from api/api/ml.revert_model_snapshot.js rename to api/api/xpack.ml.revert_model_snapshot.js index 81a70e0db..c23060a3a 100644 --- a/api/api/ml.revert_model_snapshot.js +++ b/api/api/xpack.ml.revert_model_snapshot.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlRevertModelSnapshot (opts) { +function buildXpackMlRevertModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.revert_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html) request + * Perform a [xpack.ml.revert_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html) request * * @param {string} job_id - The ID of the job to fetch * @param {string} snapshot_id - The ID of the snapshot to revert to @@ -42,7 +42,7 @@ function buildMlRevertModelSnapshot (opts) { deleteInterveningResults: 'delete_intervening_results' } - return function mlRevertModelSnapshot (params, options, callback) { + return function xpackMlRevertModelSnapshot (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -54,6 +54,15 @@ function buildMlRevertModelSnapshot (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlRevertModelSnapshot(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -99,7 +108,7 @@ function buildMlRevertModelSnapshot (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_revert' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_revert' // build request object const request = { @@ -139,4 +148,4 @@ function buildMlRevertModelSnapshot (opts) { } } -module.exports = buildMlRevertModelSnapshot +module.exports = buildXpackMlRevertModelSnapshot diff --git a/api/api/ml.start_datafeed.js b/api/api/xpack.ml.start_datafeed.js similarity index 84% rename from api/api/ml.start_datafeed.js rename to api/api/xpack.ml.start_datafeed.js index 1ca6a7362..d34332afc 100644 --- a/api/api/ml.start_datafeed.js +++ b/api/api/xpack.ml.start_datafeed.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlStartDatafeed (opts) { +function buildXpackMlStartDatafeed (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.start_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html) request + * Perform a [xpack.ml.start_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html) request * * @param {string} datafeed_id - The ID of the datafeed to start * @param {string} start - The start time from where the datafeed should begin @@ -45,7 +45,7 @@ function buildMlStartDatafeed (opts) { } - return function mlStartDatafeed (params, options, callback) { + return function xpackMlStartDatafeed (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -57,6 +57,15 @@ function buildMlStartDatafeed (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlStartDatafeed(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['datafeed_id'] == null && params['datafeedId'] == null) { return callback( @@ -88,7 +97,7 @@ function buildMlStartDatafeed (opts) { var path = '' - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_start' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_start' // build request object const request = { @@ -128,4 +137,4 @@ function buildMlStartDatafeed (opts) { } } -module.exports = buildMlStartDatafeed +module.exports = buildXpackMlStartDatafeed diff --git a/api/api/ml.stop_datafeed.js b/api/api/xpack.ml.stop_datafeed.js similarity index 85% rename from api/api/ml.stop_datafeed.js rename to api/api/xpack.ml.stop_datafeed.js index 13515e966..a57e408c2 100644 --- a/api/api/ml.stop_datafeed.js +++ b/api/api/xpack.ml.stop_datafeed.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlStopDatafeed (opts) { +function buildXpackMlStopDatafeed (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.stop_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html) request + * Perform a [xpack.ml.stop_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html) request * * @param {string} datafeed_id - The ID of the datafeed to stop * @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) @@ -45,7 +45,7 @@ function buildMlStopDatafeed (opts) { } - return function mlStopDatafeed (params, options, callback) { + return function xpackMlStopDatafeed (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -57,6 +57,15 @@ function buildMlStopDatafeed (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlStopDatafeed(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['datafeed_id'] == null && params['datafeedId'] == null) { return callback( @@ -88,7 +97,7 @@ function buildMlStopDatafeed (opts) { var path = '' - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stop' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stop' // build request object const request = { @@ -128,4 +137,4 @@ function buildMlStopDatafeed (opts) { } } -module.exports = buildMlStopDatafeed +module.exports = buildXpackMlStopDatafeed diff --git a/api/api/ml.update_datafeed.js b/api/api/xpack.ml.update_datafeed.js similarity index 84% rename from api/api/ml.update_datafeed.js rename to api/api/xpack.ml.update_datafeed.js index e2e800fa2..2992a9bc3 100644 --- a/api/api/ml.update_datafeed.js +++ b/api/api/xpack.ml.update_datafeed.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlUpdateDatafeed (opts) { +function buildXpackMlUpdateDatafeed (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.update_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html) request + * Perform a [xpack.ml.update_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html) request * * @param {string} datafeed_id - The ID of the datafeed to update * @param {object} body - The datafeed update settings @@ -40,7 +40,7 @@ function buildMlUpdateDatafeed (opts) { } - return function mlUpdateDatafeed (params, options, callback) { + return function xpackMlUpdateDatafeed (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlUpdateDatafeed (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateDatafeed(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['datafeed_id'] == null && params['datafeedId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlUpdateDatafeed (opts) { var path = '' - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_update' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_update' // build request object const request = { @@ -129,4 +138,4 @@ function buildMlUpdateDatafeed (opts) { } } -module.exports = buildMlUpdateDatafeed +module.exports = buildXpackMlUpdateDatafeed diff --git a/api/api/ml.update_filter.js b/api/api/xpack.ml.update_filter.js similarity index 85% rename from api/api/ml.update_filter.js rename to api/api/xpack.ml.update_filter.js index b50f1cc3a..e71f40ea8 100644 --- a/api/api/ml.update_filter.js +++ b/api/api/xpack.ml.update_filter.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlUpdateFilter (opts) { +function buildXpackMlUpdateFilter (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.update_filter](undefined) request + * Perform a [xpack.ml.update_filter](undefined) request * * @param {string} filter_id - The ID of the filter to update * @param {object} body - The filter update @@ -40,7 +40,7 @@ function buildMlUpdateFilter (opts) { } - return function mlUpdateFilter (params, options, callback) { + return function xpackMlUpdateFilter (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlUpdateFilter (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateFilter(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['filter_id'] == null && params['filterId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlUpdateFilter (opts) { var path = '' - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) + '/' + '_update' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) + '/' + '_update' // build request object const request = { @@ -129,4 +138,4 @@ function buildMlUpdateFilter (opts) { } } -module.exports = buildMlUpdateFilter +module.exports = buildXpackMlUpdateFilter diff --git a/api/api/ml.update_job.js b/api/api/xpack.ml.update_job.js similarity index 84% rename from api/api/ml.update_job.js rename to api/api/xpack.ml.update_job.js index f315e41af..2cafa2d9a 100644 --- a/api/api/ml.update_job.js +++ b/api/api/xpack.ml.update_job.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlUpdateJob (opts) { +function buildXpackMlUpdateJob (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.update_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html) request + * Perform a [xpack.ml.update_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html) request * * @param {string} job_id - The ID of the job to create * @param {object} body - The job update settings @@ -40,7 +40,7 @@ function buildMlUpdateJob (opts) { } - return function mlUpdateJob (params, options, callback) { + return function xpackMlUpdateJob (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildMlUpdateJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -89,7 +98,7 @@ function buildMlUpdateJob (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_update' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_update' // build request object const request = { @@ -129,4 +138,4 @@ function buildMlUpdateJob (opts) { } } -module.exports = buildMlUpdateJob +module.exports = buildXpackMlUpdateJob diff --git a/api/api/ml.update_model_snapshot.js b/api/api/xpack.ml.update_model_snapshot.js similarity index 84% rename from api/api/ml.update_model_snapshot.js rename to api/api/xpack.ml.update_model_snapshot.js index 7d44400e5..b243163b6 100644 --- a/api/api/ml.update_model_snapshot.js +++ b/api/api/xpack.ml.update_model_snapshot.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlUpdateModelSnapshot (opts) { +function buildXpackMlUpdateModelSnapshot (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.update_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html) request + * Perform a [xpack.ml.update_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html) request * * @param {string} job_id - The ID of the job to fetch * @param {string} snapshot_id - The ID of the snapshot to update @@ -41,7 +41,7 @@ function buildMlUpdateModelSnapshot (opts) { } - return function mlUpdateModelSnapshot (params, options, callback) { + return function xpackMlUpdateModelSnapshot (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +53,15 @@ function buildMlUpdateModelSnapshot (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateModelSnapshot(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['job_id'] == null && params['jobId'] == null) { return callback( @@ -104,7 +113,7 @@ function buildMlUpdateModelSnapshot (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_update' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_update' // build request object const request = { @@ -144,4 +153,4 @@ function buildMlUpdateModelSnapshot (opts) { } } -module.exports = buildMlUpdateModelSnapshot +module.exports = buildXpackMlUpdateModelSnapshot diff --git a/api/api/ml.validate.js b/api/api/xpack.ml.validate.js similarity index 85% rename from api/api/ml.validate.js rename to api/api/xpack.ml.validate.js index 2f1401f3e..747d75715 100644 --- a/api/api/ml.validate.js +++ b/api/api/xpack.ml.validate.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlValidate (opts) { +function buildXpackMlValidate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.validate](undefined) request + * Perform a [xpack.ml.validate](undefined) request * * @param {object} body - The job config */ @@ -39,7 +39,7 @@ function buildMlValidate (opts) { } - return function mlValidate (params, options, callback) { + return function xpackMlValidate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildMlValidate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlValidate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -82,7 +91,7 @@ function buildMlValidate (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_validate' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + '_validate' // build request object const request = { @@ -122,4 +131,4 @@ function buildMlValidate (opts) { } } -module.exports = buildMlValidate +module.exports = buildXpackMlValidate diff --git a/api/api/ml.validate_detector.js b/api/api/xpack.ml.validate_detector.js similarity index 84% rename from api/api/ml.validate_detector.js rename to api/api/xpack.ml.validate_detector.js index 07570ddc6..9fd6b659b 100644 --- a/api/api/ml.validate_detector.js +++ b/api/api/xpack.ml.validate_detector.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlValidateDetector (opts) { +function buildXpackMlValidateDetector (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.validate_detector](undefined) request + * Perform a [xpack.ml.validate_detector](undefined) request * * @param {object} body - The detector */ @@ -39,7 +39,7 @@ function buildMlValidateDetector (opts) { } - return function mlValidateDetector (params, options, callback) { + return function xpackMlValidateDetector (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildMlValidateDetector (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlValidateDetector(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -82,7 +91,7 @@ function buildMlValidateDetector (opts) { var path = '' - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_validate' + '/' + 'detector' + path = '/' + '_xpack' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + '_validate' + '/' + 'detector' // build request object const request = { @@ -122,4 +131,4 @@ function buildMlValidateDetector (opts) { } } -module.exports = buildMlValidateDetector +module.exports = buildXpackMlValidateDetector diff --git a/api/api/monitoring.bulk.js b/api/api/xpack.monitoring.bulk.js similarity index 84% rename from api/api/monitoring.bulk.js rename to api/api/xpack.monitoring.bulk.js index 082c26acb..fc9c90b0f 100644 --- a/api/api/monitoring.bulk.js +++ b/api/api/xpack.monitoring.bulk.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMonitoringBulk (opts) { +function buildXpackMonitoringBulk (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [monitoring.bulk](http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html) request + * Perform a [xpack.monitoring.bulk](http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html) request * * @param {string} type - Default document type for items which don't provide one * @param {string} system_id - Identifier of the monitored system @@ -47,7 +47,7 @@ function buildMonitoringBulk (opts) { } - return function monitoringBulk (params, options, callback) { + return function xpackMonitoringBulk (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -59,6 +59,15 @@ function buildMonitoringBulk (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMonitoringBulk(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -91,9 +100,9 @@ function buildMonitoringBulk (opts) { var path = '' if ((type) != null) { - path = '/' + '_monitoring' + '/' + encodeURIComponent(type) + '/' + 'bulk' + path = '/' + '_xpack' + '/' + 'monitoring' + '/' + encodeURIComponent(type) + '/' + '_bulk' } else { - path = '/' + '_monitoring' + '/' + 'bulk' + path = '/' + '_xpack' + '/' + 'monitoring' + '/' + '_bulk' } // build request object @@ -134,4 +143,4 @@ function buildMonitoringBulk (opts) { } } -module.exports = buildMonitoringBulk +module.exports = buildXpackMonitoringBulk diff --git a/api/api/xpack.rollup.delete_job.js b/api/api/xpack.rollup.delete_job.js index 7dc7a4903..3e64404ff 100644 --- a/api/api/xpack.rollup.delete_job.js +++ b/api/api/xpack.rollup.delete_job.js @@ -51,6 +51,15 @@ function buildXpackRollupDeleteJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupDeleteJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -82,7 +91,7 @@ function buildXpackRollupDeleteJob (opts) { var path = '' - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'job' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/xpack.rollup.get_jobs.js b/api/api/xpack.rollup.get_jobs.js index cdb7b666a..924382c60 100644 --- a/api/api/xpack.rollup.get_jobs.js +++ b/api/api/xpack.rollup.get_jobs.js @@ -51,6 +51,15 @@ function buildXpackRollupGetJobs (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupGetJobs(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -75,9 +84,9 @@ function buildXpackRollupGetJobs (opts) { var path = '' if ((id) != null) { - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'job' + '/' + encodeURIComponent(id) } else { - path = '/' + '_rollup' + '/' + 'job' + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'job' } // build request object diff --git a/api/api/xpack.rollup.get_rollup_caps.js b/api/api/xpack.rollup.get_rollup_caps.js index cb18eee62..b2ab3921f 100644 --- a/api/api/xpack.rollup.get_rollup_caps.js +++ b/api/api/xpack.rollup.get_rollup_caps.js @@ -51,6 +51,15 @@ function buildXpackRollupGetRollupCaps (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupGetRollupCaps(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -75,9 +84,9 @@ function buildXpackRollupGetRollupCaps (opts) { var path = '' if ((id) != null) { - path = '/' + '_rollup' + '/' + 'data' + '/' + encodeURIComponent(id) + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'data' + '/' + encodeURIComponent(id) } else { - path = '/' + '_rollup' + '/' + 'data' + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'data' } // build request object diff --git a/api/api/xpack.rollup.get_rollup_index_caps.js b/api/api/xpack.rollup.get_rollup_index_caps.js index de4191264..2d25eeedb 100644 --- a/api/api/xpack.rollup.get_rollup_index_caps.js +++ b/api/api/xpack.rollup.get_rollup_index_caps.js @@ -51,6 +51,15 @@ function buildXpackRollupGetRollupIndexCaps (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupGetRollupIndexCaps(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( @@ -82,7 +91,7 @@ function buildXpackRollupGetRollupIndexCaps (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_rollup' + '/' + 'data' + path = '/' + encodeURIComponent(index) + '/' + '_xpack' + '/' + 'rollup' + '/' + 'data' // build request object const request = { diff --git a/api/api/xpack.rollup.put_job.js b/api/api/xpack.rollup.put_job.js index 37de0684b..588e16f21 100644 --- a/api/api/xpack.rollup.put_job.js +++ b/api/api/xpack.rollup.put_job.js @@ -52,6 +52,15 @@ function buildXpackRollupPutJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupPutJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -89,7 +98,7 @@ function buildXpackRollupPutJob (opts) { var path = '' - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'job' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/xpack.rollup.rollup_search.js b/api/api/xpack.rollup.rollup_search.js index e8bc75395..c3514810f 100644 --- a/api/api/xpack.rollup.rollup_search.js +++ b/api/api/xpack.rollup.rollup_search.js @@ -31,18 +31,15 @@ function buildXpackRollupRollupSearch (opts) { * @param {string} index - The index or index-pattern (containing rollup or regular data) that should be searched * @param {string} type - The doc type inside the index * @param {boolean} typed_keys - Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * @param {boolean} rest_total_hits_as_int - Indicates whether hits.total should be rendered as an integer or an object in the rest search response * @param {object} body - The search request body */ const acceptedQuerystring = [ - 'typed_keys', - 'rest_total_hits_as_int' + 'typed_keys' ] const snakeCase = { - typedKeys: 'typed_keys', - restTotalHitsAsInt: 'rest_total_hits_as_int' + typedKeys: 'typed_keys' } return function xpackRollupRollupSearch (params, options, callback) { @@ -57,6 +54,15 @@ function buildXpackRollupRollupSearch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupRollupSearch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( diff --git a/api/api/xpack.rollup.start_job.js b/api/api/xpack.rollup.start_job.js index 33c3ac5fd..e8497c7d3 100644 --- a/api/api/xpack.rollup.start_job.js +++ b/api/api/xpack.rollup.start_job.js @@ -51,6 +51,15 @@ function buildXpackRollupStartJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupStartJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -82,7 +91,7 @@ function buildXpackRollupStartJob (opts) { var path = '' - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_start' + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_start' // build request object const request = { diff --git a/api/api/xpack.rollup.stop_job.js b/api/api/xpack.rollup.stop_job.js index 5bcf1373e..3f1167244 100644 --- a/api/api/xpack.rollup.stop_job.js +++ b/api/api/xpack.rollup.stop_job.js @@ -55,6 +55,15 @@ function buildXpackRollupStopJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupStopJob(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -86,7 +95,7 @@ function buildXpackRollupStopJob (opts) { var path = '' - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_stop' + path = '/' + '_xpack' + '/' + 'rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_stop' // build request object const request = { diff --git a/api/api/security.get_user_privileges.js b/api/api/xpack.security.authenticate.js similarity index 83% rename from api/api/security.get_user_privileges.js rename to api/api/xpack.security.authenticate.js index 7a79ef740..fb1c0dbfb 100644 --- a/api/api/security.get_user_privileges.js +++ b/api/api/xpack.security.authenticate.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityGetUserPrivileges (opts) { +function buildXpackSecurityAuthenticate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.get_user_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-privileges.html) request + * Perform a [xpack.security.authenticate](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html) request * */ @@ -38,7 +38,7 @@ function buildSecurityGetUserPrivileges (opts) { } - return function securityGetUserPrivileges (params, options, callback) { + return function xpackSecurityAuthenticate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -50,6 +50,15 @@ function buildSecurityGetUserPrivileges (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityAuthenticate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildSecurityGetUserPrivileges (opts) { var path = '' - path = '/' + '_security' + '/' + 'user' + '/' + '_privileges' + path = '/' + '_xpack' + '/' + 'security' + '/' + '_authenticate' // build request object const request = { @@ -121,4 +130,4 @@ function buildSecurityGetUserPrivileges (opts) { } } -module.exports = buildSecurityGetUserPrivileges +module.exports = buildXpackSecurityAuthenticate diff --git a/api/api/security.change_password.js b/api/api/xpack.security.change_password.js similarity index 82% rename from api/api/security.change_password.js rename to api/api/xpack.security.change_password.js index 569dbf449..84739fedd 100644 --- a/api/api/security.change_password.js +++ b/api/api/xpack.security.change_password.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityChangePassword (opts) { +function buildXpackSecurityChangePassword (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.change_password](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html) request + * Perform a [xpack.security.change_password](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html) request * * @param {string} username - The username of the user to change the password for * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -41,7 +41,7 @@ function buildSecurityChangePassword (opts) { } - return function securityChangePassword (params, options, callback) { + return function xpackSecurityChangePassword (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +53,15 @@ function buildSecurityChangePassword (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityChangePassword(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -85,9 +94,9 @@ function buildSecurityChangePassword (opts) { var path = '' if ((username) != null) { - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_password' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_password' } else { - path = '/' + '_security' + '/' + 'user' + '/' + '_password' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + '_password' } // build request object @@ -128,4 +137,4 @@ function buildSecurityChangePassword (opts) { } } -module.exports = buildSecurityChangePassword +module.exports = buildXpackSecurityChangePassword diff --git a/api/api/security.clear_cached_realms.js b/api/api/xpack.security.clear_cached_realms.js similarity index 82% rename from api/api/security.clear_cached_realms.js rename to api/api/xpack.security.clear_cached_realms.js index 97af5dcaf..5d055a2bc 100644 --- a/api/api/security.clear_cached_realms.js +++ b/api/api/xpack.security.clear_cached_realms.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityClearCachedRealms (opts) { +function buildXpackSecurityClearCachedRealms (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.clear_cached_realms](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html) request + * Perform a [xpack.security.clear_cached_realms](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html) request * * @param {list} realms - Comma-separated list of realms to clear * @param {list} usernames - Comma-separated list of usernames to clear from the cache @@ -40,7 +40,7 @@ function buildSecurityClearCachedRealms (opts) { } - return function securityClearCachedRealms (params, options, callback) { + return function xpackSecurityClearCachedRealms (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityClearCachedRealms (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityClearCachedRealms(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['realms'] == null) { return callback( @@ -89,7 +98,7 @@ function buildSecurityClearCachedRealms (opts) { var path = '' - path = '/' + '_security' + '/' + 'realm' + '/' + encodeURIComponent(realms) + '/' + '_clear_cache' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'realm' + '/' + encodeURIComponent(realms) + '/' + '_clear_cache' // build request object const request = { @@ -129,4 +138,4 @@ function buildSecurityClearCachedRealms (opts) { } } -module.exports = buildSecurityClearCachedRealms +module.exports = buildXpackSecurityClearCachedRealms diff --git a/api/api/security.clear_cached_roles.js b/api/api/xpack.security.clear_cached_roles.js similarity index 82% rename from api/api/security.clear_cached_roles.js rename to api/api/xpack.security.clear_cached_roles.js index 1741e5e1f..139dc33f7 100644 --- a/api/api/security.clear_cached_roles.js +++ b/api/api/xpack.security.clear_cached_roles.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityClearCachedRoles (opts) { +function buildXpackSecurityClearCachedRoles (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.clear_cached_roles](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html) request + * Perform a [xpack.security.clear_cached_roles](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html) request * * @param {list} name - Role name */ @@ -39,7 +39,7 @@ function buildSecurityClearCachedRoles (opts) { } - return function securityClearCachedRoles (params, options, callback) { + return function xpackSecurityClearCachedRoles (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildSecurityClearCachedRoles (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityClearCachedRoles(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( @@ -88,7 +97,7 @@ function buildSecurityClearCachedRoles (opts) { var path = '' - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) + '/' + '_clear_cache' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role' + '/' + encodeURIComponent(name) + '/' + '_clear_cache' // build request object const request = { @@ -128,4 +137,4 @@ function buildSecurityClearCachedRoles (opts) { } } -module.exports = buildSecurityClearCachedRoles +module.exports = buildXpackSecurityClearCachedRoles diff --git a/api/api/security.delete_privileges.js b/api/api/xpack.security.delete_privileges.js similarity index 86% rename from api/api/security.delete_privileges.js rename to api/api/xpack.security.delete_privileges.js index fa54275d3..ad3ce2bc8 100644 --- a/api/api/security.delete_privileges.js +++ b/api/api/xpack.security.delete_privileges.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityDeletePrivileges (opts) { +function buildXpackSecurityDeletePrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.delete_privileges](TODO) request + * Perform a [xpack.security.delete_privileges](TODO) request * * @param {string} application - Application name * @param {string} name - Privilege name @@ -41,7 +41,7 @@ function buildSecurityDeletePrivileges (opts) { } - return function securityDeletePrivileges (params, options, callback) { + return function xpackSecurityDeletePrivileges (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +53,15 @@ function buildSecurityDeletePrivileges (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeletePrivileges(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['application'] == null) { return callback( @@ -104,7 +113,7 @@ function buildSecurityDeletePrivileges (opts) { var path = '' - path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) // build request object const request = { @@ -144,4 +153,4 @@ function buildSecurityDeletePrivileges (opts) { } } -module.exports = buildSecurityDeletePrivileges +module.exports = buildXpackSecurityDeletePrivileges diff --git a/api/api/security.delete_role.js b/api/api/xpack.security.delete_role.js similarity index 84% rename from api/api/security.delete_role.js rename to api/api/xpack.security.delete_role.js index f8046d046..cc8af44f5 100644 --- a/api/api/security.delete_role.js +++ b/api/api/xpack.security.delete_role.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityDeleteRole (opts) { +function buildXpackSecurityDeleteRole (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.delete_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html) request + * Perform a [xpack.security.delete_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html) request * * @param {string} name - Role name * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -40,7 +40,7 @@ function buildSecurityDeleteRole (opts) { } - return function securityDeleteRole (params, options, callback) { + return function xpackSecurityDeleteRole (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityDeleteRole (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeleteRole(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( @@ -89,7 +98,7 @@ function buildSecurityDeleteRole (opts) { var path = '' - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role' + '/' + encodeURIComponent(name) // build request object const request = { @@ -129,4 +138,4 @@ function buildSecurityDeleteRole (opts) { } } -module.exports = buildSecurityDeleteRole +module.exports = buildXpackSecurityDeleteRole diff --git a/api/api/security.delete_role_mapping.js b/api/api/xpack.security.delete_role_mapping.js similarity index 83% rename from api/api/security.delete_role_mapping.js rename to api/api/xpack.security.delete_role_mapping.js index 269c7a87d..e1d8de052 100644 --- a/api/api/security.delete_role_mapping.js +++ b/api/api/xpack.security.delete_role_mapping.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityDeleteRoleMapping (opts) { +function buildXpackSecurityDeleteRoleMapping (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.delete_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html) request + * Perform a [xpack.security.delete_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html) request * * @param {string} name - Role-mapping name * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -40,7 +40,7 @@ function buildSecurityDeleteRoleMapping (opts) { } - return function securityDeleteRoleMapping (params, options, callback) { + return function xpackSecurityDeleteRoleMapping (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityDeleteRoleMapping (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeleteRoleMapping(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( @@ -89,7 +98,7 @@ function buildSecurityDeleteRoleMapping (opts) { var path = '' - path = '/' + '_security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) // build request object const request = { @@ -129,4 +138,4 @@ function buildSecurityDeleteRoleMapping (opts) { } } -module.exports = buildSecurityDeleteRoleMapping +module.exports = buildXpackSecurityDeleteRoleMapping diff --git a/api/api/security.delete_user.js b/api/api/xpack.security.delete_user.js similarity index 84% rename from api/api/security.delete_user.js rename to api/api/xpack.security.delete_user.js index f89bb0fb9..d981e347f 100644 --- a/api/api/security.delete_user.js +++ b/api/api/xpack.security.delete_user.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityDeleteUser (opts) { +function buildXpackSecurityDeleteUser (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.delete_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html) request + * Perform a [xpack.security.delete_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html) request * * @param {string} username - username * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -40,7 +40,7 @@ function buildSecurityDeleteUser (opts) { } - return function securityDeleteUser (params, options, callback) { + return function xpackSecurityDeleteUser (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityDeleteUser (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeleteUser(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['username'] == null) { return callback( @@ -89,7 +98,7 @@ function buildSecurityDeleteUser (opts) { var path = '' - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + encodeURIComponent(username) // build request object const request = { @@ -129,4 +138,4 @@ function buildSecurityDeleteUser (opts) { } } -module.exports = buildSecurityDeleteUser +module.exports = buildXpackSecurityDeleteUser diff --git a/api/api/security.disable_user.js b/api/api/xpack.security.disable_user.js similarity index 83% rename from api/api/security.disable_user.js rename to api/api/xpack.security.disable_user.js index e7f1bccde..0f5235611 100644 --- a/api/api/security.disable_user.js +++ b/api/api/xpack.security.disable_user.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityDisableUser (opts) { +function buildXpackSecurityDisableUser (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.disable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html) request + * Perform a [xpack.security.disable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html) request * * @param {string} username - The username of the user to disable * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -40,7 +40,7 @@ function buildSecurityDisableUser (opts) { } - return function securityDisableUser (params, options, callback) { + return function xpackSecurityDisableUser (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityDisableUser (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDisableUser(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -83,7 +92,7 @@ function buildSecurityDisableUser (opts) { var path = '' - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_disable' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_disable' // build request object const request = { @@ -123,4 +132,4 @@ function buildSecurityDisableUser (opts) { } } -module.exports = buildSecurityDisableUser +module.exports = buildXpackSecurityDisableUser diff --git a/api/api/security.enable_user.js b/api/api/xpack.security.enable_user.js similarity index 83% rename from api/api/security.enable_user.js rename to api/api/xpack.security.enable_user.js index 58a49c9d6..17c9ad871 100644 --- a/api/api/security.enable_user.js +++ b/api/api/xpack.security.enable_user.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityEnableUser (opts) { +function buildXpackSecurityEnableUser (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.enable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html) request + * Perform a [xpack.security.enable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html) request * * @param {string} username - The username of the user to enable * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -40,7 +40,7 @@ function buildSecurityEnableUser (opts) { } - return function securityEnableUser (params, options, callback) { + return function xpackSecurityEnableUser (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityEnableUser (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityEnableUser(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -83,7 +92,7 @@ function buildSecurityEnableUser (opts) { var path = '' - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_enable' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_enable' // build request object const request = { @@ -123,4 +132,4 @@ function buildSecurityEnableUser (opts) { } } -module.exports = buildSecurityEnableUser +module.exports = buildXpackSecurityEnableUser diff --git a/api/api/security.get_privileges.js b/api/api/xpack.security.get_privileges.js similarity index 81% rename from api/api/security.get_privileges.js rename to api/api/xpack.security.get_privileges.js index d285b6822..706d4b5e3 100644 --- a/api/api/security.get_privileges.js +++ b/api/api/xpack.security.get_privileges.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityGetPrivileges (opts) { +function buildXpackSecurityGetPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.get_privileges](TODO) request + * Perform a [xpack.security.get_privileges](TODO) request * * @param {string} application - Application name * @param {string} name - Privilege name @@ -40,7 +40,7 @@ function buildSecurityGetPrivileges (opts) { } - return function securityGetPrivileges (params, options, callback) { + return function xpackSecurityGetPrivileges (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityGetPrivileges (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetPrivileges(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -92,11 +101,11 @@ function buildSecurityGetPrivileges (opts) { var path = '' if (application && name) { - path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) } else if (application) { - path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'privilege' + '/' + encodeURIComponent(application) } else { - path = '/' + '_security' + '/' + 'privilege' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'privilege' } // build request object @@ -137,4 +146,4 @@ function buildSecurityGetPrivileges (opts) { } } -module.exports = buildSecurityGetPrivileges +module.exports = buildXpackSecurityGetPrivileges diff --git a/api/api/security.get_role.js b/api/api/xpack.security.get_role.js similarity index 82% rename from api/api/security.get_role.js rename to api/api/xpack.security.get_role.js index 24e2f384d..26584ca45 100644 --- a/api/api/security.get_role.js +++ b/api/api/xpack.security.get_role.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityGetRole (opts) { +function buildXpackSecurityGetRole (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.get_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html) request + * Perform a [xpack.security.get_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html) request * * @param {string} name - Role name */ @@ -39,7 +39,7 @@ function buildSecurityGetRole (opts) { } - return function securityGetRole (params, options, callback) { + return function xpackSecurityGetRole (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildSecurityGetRole (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetRole(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -83,9 +92,9 @@ function buildSecurityGetRole (opts) { var path = '' if ((name) != null) { - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role' + '/' + encodeURIComponent(name) } else { - path = '/' + '_security' + '/' + 'role' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role' } // build request object @@ -126,4 +135,4 @@ function buildSecurityGetRole (opts) { } } -module.exports = buildSecurityGetRole +module.exports = buildXpackSecurityGetRole diff --git a/api/api/security.get_role_mapping.js b/api/api/xpack.security.get_role_mapping.js similarity index 80% rename from api/api/security.get_role_mapping.js rename to api/api/xpack.security.get_role_mapping.js index c56e81f8b..9f4206654 100644 --- a/api/api/security.get_role_mapping.js +++ b/api/api/xpack.security.get_role_mapping.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityGetRoleMapping (opts) { +function buildXpackSecurityGetRoleMapping (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.get_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html) request + * Perform a [xpack.security.get_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html) request * * @param {string} name - Role-Mapping name */ @@ -39,7 +39,7 @@ function buildSecurityGetRoleMapping (opts) { } - return function securityGetRoleMapping (params, options, callback) { + return function xpackSecurityGetRoleMapping (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildSecurityGetRoleMapping (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetRoleMapping(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -83,9 +92,9 @@ function buildSecurityGetRoleMapping (opts) { var path = '' if ((name) != null) { - path = '/' + '_security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) } else { - path = '/' + '_security' + '/' + 'role_mapping' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role_mapping' } // build request object @@ -126,4 +135,4 @@ function buildSecurityGetRoleMapping (opts) { } } -module.exports = buildSecurityGetRoleMapping +module.exports = buildXpackSecurityGetRoleMapping diff --git a/api/api/security.get_token.js b/api/api/xpack.security.get_token.js similarity index 83% rename from api/api/security.get_token.js rename to api/api/xpack.security.get_token.js index 32ea01902..ddfe27b6d 100644 --- a/api/api/security.get_token.js +++ b/api/api/xpack.security.get_token.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityGetToken (opts) { +function buildXpackSecurityGetToken (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.get_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html) request + * Perform a [xpack.security.get_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html) request * * @param {object} body - The token request to get */ @@ -39,7 +39,7 @@ function buildSecurityGetToken (opts) { } - return function securityGetToken (params, options, callback) { + return function xpackSecurityGetToken (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildSecurityGetToken (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetToken(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -82,7 +91,7 @@ function buildSecurityGetToken (opts) { var path = '' - path = '/' + '_security' + '/' + 'oauth2' + '/' + 'token' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'oauth2' + '/' + 'token' // build request object const request = { @@ -122,4 +131,4 @@ function buildSecurityGetToken (opts) { } } -module.exports = buildSecurityGetToken +module.exports = buildXpackSecurityGetToken diff --git a/api/api/security.get_user.js b/api/api/xpack.security.get_user.js similarity index 82% rename from api/api/security.get_user.js rename to api/api/xpack.security.get_user.js index 6f29262a2..11a0b125f 100644 --- a/api/api/security.get_user.js +++ b/api/api/xpack.security.get_user.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityGetUser (opts) { +function buildXpackSecurityGetUser (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.get_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html) request + * Perform a [xpack.security.get_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html) request * * @param {list} username - A comma-separated list of usernames */ @@ -39,7 +39,7 @@ function buildSecurityGetUser (opts) { } - return function securityGetUser (params, options, callback) { + return function xpackSecurityGetUser (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildSecurityGetUser (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetUser(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -83,9 +92,9 @@ function buildSecurityGetUser (opts) { var path = '' if ((username) != null) { - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + encodeURIComponent(username) } else { - path = '/' + '_security' + '/' + 'user' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' } // build request object @@ -126,4 +135,4 @@ function buildSecurityGetUser (opts) { } } -module.exports = buildSecurityGetUser +module.exports = buildXpackSecurityGetUser diff --git a/api/api/ssl.certificates.js b/api/api/xpack.security.get_user_privileges.js similarity index 82% rename from api/api/ssl.certificates.js rename to api/api/xpack.security.get_user_privileges.js index 7e876c609..fbc07427c 100644 --- a/api/api/ssl.certificates.js +++ b/api/api/xpack.security.get_user_privileges.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSslCertificates (opts) { +function buildXpackSecurityGetUserPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ssl.certificates](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html) request + * Perform a [xpack.security.get_user_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-privileges.html) request * */ @@ -38,7 +38,7 @@ function buildSslCertificates (opts) { } - return function sslCertificates (params, options, callback) { + return function xpackSecurityGetUserPrivileges (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -50,6 +50,15 @@ function buildSslCertificates (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetUserPrivileges(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildSslCertificates (opts) { var path = '' - path = '/' + '_ssl' + '/' + 'certificates' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + '_privileges' // build request object const request = { @@ -121,4 +130,4 @@ function buildSslCertificates (opts) { } } -module.exports = buildSslCertificates +module.exports = buildXpackSecurityGetUserPrivileges diff --git a/api/api/security.has_privileges.js b/api/api/xpack.security.has_privileges.js similarity index 80% rename from api/api/security.has_privileges.js rename to api/api/xpack.security.has_privileges.js index 78987c6b8..c0c033d7a 100644 --- a/api/api/security.has_privileges.js +++ b/api/api/xpack.security.has_privileges.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityHasPrivileges (opts) { +function buildXpackSecurityHasPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.has_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html) request + * Perform a [xpack.security.has_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html) request * * @param {string} user - Username * @param {object} body - The privileges to test @@ -40,7 +40,7 @@ function buildSecurityHasPrivileges (opts) { } - return function securityHasPrivileges (params, options, callback) { + return function xpackSecurityHasPrivileges (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityHasPrivileges (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityHasPrivileges(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -84,9 +93,9 @@ function buildSecurityHasPrivileges (opts) { var path = '' if ((user) != null) { - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(user) + '/' + '_has_privileges' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + encodeURIComponent(user) + '/' + '_has_privileges' } else { - path = '/' + '_security' + '/' + 'user' + '/' + '_has_privileges' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + '_has_privileges' } // build request object @@ -127,4 +136,4 @@ function buildSecurityHasPrivileges (opts) { } } -module.exports = buildSecurityHasPrivileges +module.exports = buildXpackSecurityHasPrivileges diff --git a/api/api/security.invalidate_token.js b/api/api/xpack.security.invalidate_token.js similarity index 82% rename from api/api/security.invalidate_token.js rename to api/api/xpack.security.invalidate_token.js index fa2043b2c..03e2941fc 100644 --- a/api/api/security.invalidate_token.js +++ b/api/api/xpack.security.invalidate_token.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityInvalidateToken (opts) { +function buildXpackSecurityInvalidateToken (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.invalidate_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html) request + * Perform a [xpack.security.invalidate_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html) request * * @param {object} body - The token to invalidate */ @@ -39,7 +39,7 @@ function buildSecurityInvalidateToken (opts) { } - return function securityInvalidateToken (params, options, callback) { + return function xpackSecurityInvalidateToken (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +51,15 @@ function buildSecurityInvalidateToken (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityInvalidateToken(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -82,7 +91,7 @@ function buildSecurityInvalidateToken (opts) { var path = '' - path = '/' + '_security' + '/' + 'oauth2' + '/' + 'token' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'oauth2' + '/' + 'token' // build request object const request = { @@ -122,4 +131,4 @@ function buildSecurityInvalidateToken (opts) { } } -module.exports = buildSecurityInvalidateToken +module.exports = buildXpackSecurityInvalidateToken diff --git a/api/api/security.put_privileges.js b/api/api/xpack.security.put_privileges.js similarity index 86% rename from api/api/security.put_privileges.js rename to api/api/xpack.security.put_privileges.js index c08e9aa01..10bf969ec 100644 --- a/api/api/security.put_privileges.js +++ b/api/api/xpack.security.put_privileges.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityPutPrivileges (opts) { +function buildXpackSecurityPutPrivileges (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.put_privileges](TODO) request + * Perform a [xpack.security.put_privileges](TODO) request * * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. * @param {object} body - The privilege(s) to add @@ -40,7 +40,7 @@ function buildSecurityPutPrivileges (opts) { } - return function securityPutPrivileges (params, options, callback) { + return function xpackSecurityPutPrivileges (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +52,15 @@ function buildSecurityPutPrivileges (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutPrivileges(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -83,7 +92,7 @@ function buildSecurityPutPrivileges (opts) { var path = '' - path = '/' + '_security' + '/' + 'privilege' + path = '/' + '_xpack' + '/' + 'security' + '/' + 'privilege' // build request object const request = { @@ -123,4 +132,4 @@ function buildSecurityPutPrivileges (opts) { } } -module.exports = buildSecurityPutPrivileges +module.exports = buildXpackSecurityPutPrivileges diff --git a/api/api/security.put_role.js b/api/api/xpack.security.put_role.js similarity index 85% rename from api/api/security.put_role.js rename to api/api/xpack.security.put_role.js index 6bd851141..add645e9a 100644 --- a/api/api/security.put_role.js +++ b/api/api/xpack.security.put_role.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityPutRole (opts) { +function buildXpackSecurityPutRole (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.put_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html) request + * Perform a [xpack.security.put_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html) request * * @param {string} name - Role name * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -41,7 +41,7 @@ function buildSecurityPutRole (opts) { } - return function securityPutRole (params, options, callback) { + return function xpackSecurityPutRole (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +53,15 @@ function buildSecurityPutRole (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutRole(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( @@ -90,7 +99,7 @@ function buildSecurityPutRole (opts) { var path = '' - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role' + '/' + encodeURIComponent(name) // build request object const request = { @@ -130,4 +139,4 @@ function buildSecurityPutRole (opts) { } } -module.exports = buildSecurityPutRole +module.exports = buildXpackSecurityPutRole diff --git a/api/api/security.put_role_mapping.js b/api/api/xpack.security.put_role_mapping.js similarity index 84% rename from api/api/security.put_role_mapping.js rename to api/api/xpack.security.put_role_mapping.js index c6450d155..3469880f0 100644 --- a/api/api/security.put_role_mapping.js +++ b/api/api/xpack.security.put_role_mapping.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityPutRoleMapping (opts) { +function buildXpackSecurityPutRoleMapping (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.put_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html) request + * Perform a [xpack.security.put_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html) request * * @param {string} name - Role-mapping name * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -41,7 +41,7 @@ function buildSecurityPutRoleMapping (opts) { } - return function securityPutRoleMapping (params, options, callback) { + return function xpackSecurityPutRoleMapping (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +53,15 @@ function buildSecurityPutRoleMapping (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutRoleMapping(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['name'] == null) { return callback( @@ -90,7 +99,7 @@ function buildSecurityPutRoleMapping (opts) { var path = '' - path = '/' + '_security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) // build request object const request = { @@ -130,4 +139,4 @@ function buildSecurityPutRoleMapping (opts) { } } -module.exports = buildSecurityPutRoleMapping +module.exports = buildXpackSecurityPutRoleMapping diff --git a/api/api/security.put_user.js b/api/api/xpack.security.put_user.js similarity index 85% rename from api/api/security.put_user.js rename to api/api/xpack.security.put_user.js index 16fb9182d..aa9592876 100644 --- a/api/api/security.put_user.js +++ b/api/api/xpack.security.put_user.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityPutUser (opts) { +function buildXpackSecurityPutUser (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.put_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html) request + * Perform a [xpack.security.put_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html) request * * @param {string} username - The username of the User * @param {enum} refresh - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -41,7 +41,7 @@ function buildSecurityPutUser (opts) { } - return function securityPutUser (params, options, callback) { + return function xpackSecurityPutUser (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +53,15 @@ function buildSecurityPutUser (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutUser(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['username'] == null) { return callback( @@ -90,7 +99,7 @@ function buildSecurityPutUser (opts) { var path = '' - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + path = '/' + '_xpack' + '/' + 'security' + '/' + 'user' + '/' + encodeURIComponent(username) // build request object const request = { @@ -130,4 +139,4 @@ function buildSecurityPutUser (opts) { } } -module.exports = buildSecurityPutUser +module.exports = buildXpackSecurityPutUser diff --git a/api/api/xpack.sql.clear_cursor.js b/api/api/xpack.sql.clear_cursor.js index f35f3e363..3c9402874 100644 --- a/api/api/xpack.sql.clear_cursor.js +++ b/api/api/xpack.sql.clear_cursor.js @@ -51,6 +51,15 @@ function buildXpackSqlClearCursor (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSqlClearCursor(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -82,7 +91,7 @@ function buildXpackSqlClearCursor (opts) { var path = '' - path = '/' + '_sql' + '/' + 'close' + path = '/' + '_xpack' + '/' + 'sql' + '/' + 'close' // build request object const request = { diff --git a/api/api/xpack.sql.query.js b/api/api/xpack.sql.query.js index 125c577f6..acb891e27 100644 --- a/api/api/xpack.sql.query.js +++ b/api/api/xpack.sql.query.js @@ -52,6 +52,15 @@ function buildXpackSqlQuery (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSqlQuery(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -83,7 +92,7 @@ function buildXpackSqlQuery (opts) { var path = '' - path = '/' + '_sql' + path = '/' + '_xpack' + '/' + 'sql' // build request object const request = { diff --git a/api/api/xpack.sql.translate.js b/api/api/xpack.sql.translate.js index c8df293e7..6b4482704 100644 --- a/api/api/xpack.sql.translate.js +++ b/api/api/xpack.sql.translate.js @@ -51,6 +51,15 @@ function buildXpackSqlTranslate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSqlTranslate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -82,7 +91,7 @@ function buildXpackSqlTranslate (opts) { var path = '' - path = '/' + '_sql' + '/' + 'translate' + path = '/' + '_xpack' + '/' + 'sql' + '/' + 'translate' // build request object const request = { diff --git a/api/api/security.authenticate.js b/api/api/xpack.ssl.certificates.js similarity index 84% rename from api/api/security.authenticate.js rename to api/api/xpack.ssl.certificates.js index da504bdc4..e37c6a07a 100644 --- a/api/api/security.authenticate.js +++ b/api/api/xpack.ssl.certificates.js @@ -22,11 +22,11 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildSecurityAuthenticate (opts) { +function buildXpackSslCertificates (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [security.authenticate](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html) request + * Perform a [xpack.ssl.certificates](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html) request * */ @@ -38,7 +38,7 @@ function buildSecurityAuthenticate (opts) { } - return function securityAuthenticate (params, options, callback) { + return function xpackSslCertificates (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -50,6 +50,15 @@ function buildSecurityAuthenticate (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSslCertificates(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildSecurityAuthenticate (opts) { var path = '' - path = '/' + '_security' + '/' + '_authenticate' + path = '/' + '_xpack' + '/' + 'ssl' + '/' + 'certificates' // build request object const request = { @@ -121,4 +130,4 @@ function buildSecurityAuthenticate (opts) { } } -module.exports = buildSecurityAuthenticate +module.exports = buildXpackSslCertificates diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js index dd85627f1..61a6b8d86 100644 --- a/api/api/xpack.usage.js +++ b/api/api/xpack.usage.js @@ -51,6 +51,15 @@ function buildXpackUsage (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackUsage(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( diff --git a/api/api/xpack.watcher.ack_watch.js b/api/api/xpack.watcher.ack_watch.js index 9a8a450c4..6898177c9 100644 --- a/api/api/xpack.watcher.ack_watch.js +++ b/api/api/xpack.watcher.ack_watch.js @@ -30,14 +30,15 @@ function buildXpackWatcherAckWatch (opts) { * * @param {string} watch_id - Watch ID * @param {list} action_id - A comma-separated list of the action ids to be acked + * @param {time} master_timeout - Explicit operation timeout for connection to master node */ const acceptedQuerystring = [ - + 'master_timeout' ] const snakeCase = { - + masterTimeout: 'master_timeout' } return function xpackWatcherAckWatch (params, options, callback) { @@ -52,6 +53,15 @@ function buildXpackWatcherAckWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherAckWatch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['watch_id'] == null && params['watchId'] == null) { return callback( @@ -98,9 +108,9 @@ function buildXpackWatcherAckWatch (opts) { var path = '' if ((watch_id || watchId) != null && (action_id || actionId) != null) { - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack' + '/' + encodeURIComponent(action_id || actionId) + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack' + '/' + encodeURIComponent(action_id || actionId) } else { - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack' } // build request object diff --git a/api/api/xpack.watcher.activate_watch.js b/api/api/xpack.watcher.activate_watch.js index 1d114b189..2b5617d83 100644 --- a/api/api/xpack.watcher.activate_watch.js +++ b/api/api/xpack.watcher.activate_watch.js @@ -29,14 +29,15 @@ function buildXpackWatcherActivateWatch (opts) { * Perform a [xpack.watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request * * @param {string} watch_id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node */ const acceptedQuerystring = [ - + 'master_timeout' ] const snakeCase = { - + masterTimeout: 'master_timeout' } return function xpackWatcherActivateWatch (params, options, callback) { @@ -51,6 +52,15 @@ function buildXpackWatcherActivateWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherActivateWatch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['watch_id'] == null && params['watchId'] == null) { return callback( @@ -88,7 +98,7 @@ function buildXpackWatcherActivateWatch (opts) { var path = '' - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_activate' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_activate' // build request object const request = { diff --git a/api/api/xpack.watcher.deactivate_watch.js b/api/api/xpack.watcher.deactivate_watch.js index 1e7fe35ac..c6d5aa4b2 100644 --- a/api/api/xpack.watcher.deactivate_watch.js +++ b/api/api/xpack.watcher.deactivate_watch.js @@ -29,14 +29,15 @@ function buildXpackWatcherDeactivateWatch (opts) { * Perform a [xpack.watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request * * @param {string} watch_id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node */ const acceptedQuerystring = [ - + 'master_timeout' ] const snakeCase = { - + masterTimeout: 'master_timeout' } return function xpackWatcherDeactivateWatch (params, options, callback) { @@ -51,6 +52,15 @@ function buildXpackWatcherDeactivateWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherDeactivateWatch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['watch_id'] == null && params['watchId'] == null) { return callback( @@ -88,7 +98,7 @@ function buildXpackWatcherDeactivateWatch (opts) { var path = '' - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_deactivate' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_deactivate' // build request object const request = { diff --git a/api/api/xpack.watcher.delete_watch.js b/api/api/xpack.watcher.delete_watch.js index 063788115..78360c3d7 100644 --- a/api/api/xpack.watcher.delete_watch.js +++ b/api/api/xpack.watcher.delete_watch.js @@ -29,14 +29,15 @@ function buildXpackWatcherDeleteWatch (opts) { * Perform a [xpack.watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request * * @param {string} id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node */ const acceptedQuerystring = [ - + 'master_timeout' ] const snakeCase = { - + masterTimeout: 'master_timeout' } return function xpackWatcherDeleteWatch (params, options, callback) { @@ -51,6 +52,15 @@ function buildXpackWatcherDeleteWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherDeleteWatch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -88,7 +98,7 @@ function buildXpackWatcherDeleteWatch (opts) { var path = '' - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/xpack.watcher.execute_watch.js b/api/api/xpack.watcher.execute_watch.js index 8e14f3475..f653cf30e 100644 --- a/api/api/xpack.watcher.execute_watch.js +++ b/api/api/xpack.watcher.execute_watch.js @@ -53,6 +53,15 @@ function buildXpackWatcherExecuteWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherExecuteWatch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -77,9 +86,9 @@ function buildXpackWatcherExecuteWatch (opts) { var path = '' if ((id) != null) { - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + '/' + '_execute' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + '/' + '_execute' } else { - path = '/' + '_watcher' + '/' + 'watch' + '/' + '_execute' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + '_execute' } // build request object diff --git a/api/api/xpack.watcher.get_watch.js b/api/api/xpack.watcher.get_watch.js index f18fcb992..8b42cc698 100644 --- a/api/api/xpack.watcher.get_watch.js +++ b/api/api/xpack.watcher.get_watch.js @@ -51,6 +51,15 @@ function buildXpackWatcherGetWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherGetWatch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -88,7 +97,7 @@ function buildXpackWatcherGetWatch (opts) { var path = '' - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/xpack.watcher.put_watch.js b/api/api/xpack.watcher.put_watch.js index 269e58d5a..bdcd43d76 100644 --- a/api/api/xpack.watcher.put_watch.js +++ b/api/api/xpack.watcher.put_watch.js @@ -29,23 +29,21 @@ function buildXpackWatcherPutWatch (opts) { * Perform a [xpack.watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request * * @param {string} id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node * @param {boolean} active - Specify whether the watch is in/active by default * @param {number} version - Explicit version number for concurrency control - * @param {number} if_seq_no - only update the watch if the last operation that has changed the watch has the specified sequence number - * @param {number} if_primary_term - only update the watch if the last operation that has changed the watch has the specified primary term * @param {object} body - The watch */ const acceptedQuerystring = [ + 'master_timeout', 'active', - 'version', - 'if_seq_no', - 'if_primary_term' + 'version' ] const snakeCase = { - ifSeqNo: 'if_seq_no', - ifPrimaryTerm: 'if_primary_term' + masterTimeout: 'master_timeout' + } return function xpackWatcherPutWatch (params, options, callback) { @@ -60,6 +58,15 @@ function buildXpackWatcherPutWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherPutWatch(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -91,7 +98,7 @@ function buildXpackWatcherPutWatch (opts) { var path = '' - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) // build request object const request = { diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/xpack.watcher.restart.js similarity index 84% rename from api/api/ml.set_upgrade_mode.js rename to api/api/xpack.watcher.restart.js index cd95163a2..32df6079d 100644 --- a/api/api/ml.set_upgrade_mode.js +++ b/api/api/xpack.watcher.restart.js @@ -22,26 +22,23 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildMlSetUpgradeMode (opts) { +function buildXpackWatcherRestart (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ml.set_upgrade_mode](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html) request + * Perform a [xpack.watcher.restart](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-restart.html) request * - * @param {boolean} enabled - Whether to enable upgrade_mode ML setting or not. Defaults to false. - * @param {time} timeout - Controls the time to wait before action times out. Defaults to 30 seconds */ const acceptedQuerystring = [ - 'enabled', - 'timeout' + ] const snakeCase = { } - return function mlSetUpgradeMode (params, options, callback) { + return function xpackWatcherRestart (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -53,6 +50,15 @@ function buildMlSetUpgradeMode (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherRestart(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -84,7 +90,7 @@ function buildMlSetUpgradeMode (opts) { var path = '' - path = '/' + '_ml' + '/' + 'set_upgrade_mode' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + '_restart' // build request object const request = { @@ -124,4 +130,4 @@ function buildMlSetUpgradeMode (opts) { } } -module.exports = buildMlSetUpgradeMode +module.exports = buildXpackWatcherRestart diff --git a/api/api/xpack.watcher.start.js b/api/api/xpack.watcher.start.js index e16a81eda..c31024614 100644 --- a/api/api/xpack.watcher.start.js +++ b/api/api/xpack.watcher.start.js @@ -50,6 +50,15 @@ function buildXpackWatcherStart (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherStart(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildXpackWatcherStart (opts) { var path = '' - path = '/' + '_watcher' + '/' + '_start' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + '_start' // build request object const request = { diff --git a/api/api/xpack.watcher.stats.js b/api/api/xpack.watcher.stats.js index 6991ec20a..608bd0e50 100644 --- a/api/api/xpack.watcher.stats.js +++ b/api/api/xpack.watcher.stats.js @@ -54,6 +54,15 @@ function buildXpackWatcherStats (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -86,9 +95,9 @@ function buildXpackWatcherStats (opts) { var path = '' if ((metric) != null) { - path = '/' + '_watcher' + '/' + 'stats' + '/' + encodeURIComponent(metric) + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'stats' + '/' + encodeURIComponent(metric) } else { - path = '/' + '_watcher' + '/' + 'stats' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + 'stats' } // build request object diff --git a/api/api/xpack.watcher.stop.js b/api/api/xpack.watcher.stop.js index 17f5c33a3..e1e6eae26 100644 --- a/api/api/xpack.watcher.stop.js +++ b/api/api/xpack.watcher.stop.js @@ -50,6 +50,15 @@ function buildXpackWatcherStop (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherStop(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params.body != null) { return callback( @@ -81,7 +90,7 @@ function buildXpackWatcherStop (opts) { var path = '' - path = '/' + '_watcher' + '/' + '_stop' + path = '/' + '_xpack' + '/' + 'watcher' + '/' + '_stop' // build request object const request = { diff --git a/api/index.js b/api/index.js index ca997bffa..578912096 100644 --- a/api/index.js +++ b/api/index.js @@ -56,8 +56,6 @@ function ESAPI (opts) { delete_auto_follow_pattern: lazyLoad('./api/ccr.delete_auto_follow_pattern.js', opts), deleteAutoFollowPattern: lazyLoad('./api/ccr.delete_auto_follow_pattern.js', opts), follow: lazyLoad('./api/ccr.follow.js', opts), - follow_info: lazyLoad('./api/ccr.follow_info.js', opts), - followInfo: lazyLoad('./api/ccr.follow_info.js', opts), follow_stats: lazyLoad('./api/ccr.follow_stats.js', opts), followStats: lazyLoad('./api/ccr.follow_stats.js', opts), get_auto_follow_pattern: lazyLoad('./api/ccr.get_auto_follow_pattern.js', opts), @@ -203,100 +201,6 @@ function ESAPI (opts) { simulate: lazyLoad('./api/ingest.simulate.js', opts) }, mget: lazyLoad('./api/mget.js', opts), - ml: { - close_job: lazyLoad('./api/ml.close_job.js', opts), - closeJob: lazyLoad('./api/ml.close_job.js', opts), - delete_calendar: lazyLoad('./api/ml.delete_calendar.js', opts), - deleteCalendar: lazyLoad('./api/ml.delete_calendar.js', opts), - delete_calendar_event: lazyLoad('./api/ml.delete_calendar_event.js', opts), - deleteCalendarEvent: lazyLoad('./api/ml.delete_calendar_event.js', opts), - delete_calendar_job: lazyLoad('./api/ml.delete_calendar_job.js', opts), - deleteCalendarJob: lazyLoad('./api/ml.delete_calendar_job.js', opts), - delete_datafeed: lazyLoad('./api/ml.delete_datafeed.js', opts), - deleteDatafeed: lazyLoad('./api/ml.delete_datafeed.js', opts), - delete_expired_data: lazyLoad('./api/ml.delete_expired_data.js', opts), - deleteExpiredData: lazyLoad('./api/ml.delete_expired_data.js', opts), - delete_filter: lazyLoad('./api/ml.delete_filter.js', opts), - deleteFilter: lazyLoad('./api/ml.delete_filter.js', opts), - delete_forecast: lazyLoad('./api/ml.delete_forecast.js', opts), - deleteForecast: lazyLoad('./api/ml.delete_forecast.js', opts), - delete_job: lazyLoad('./api/ml.delete_job.js', opts), - deleteJob: lazyLoad('./api/ml.delete_job.js', opts), - delete_model_snapshot: lazyLoad('./api/ml.delete_model_snapshot.js', opts), - deleteModelSnapshot: lazyLoad('./api/ml.delete_model_snapshot.js', opts), - find_file_structure: lazyLoad('./api/ml.find_file_structure.js', opts), - findFileStructure: lazyLoad('./api/ml.find_file_structure.js', opts), - flush_job: lazyLoad('./api/ml.flush_job.js', opts), - flushJob: lazyLoad('./api/ml.flush_job.js', opts), - forecast: lazyLoad('./api/ml.forecast.js', opts), - get_buckets: lazyLoad('./api/ml.get_buckets.js', opts), - getBuckets: lazyLoad('./api/ml.get_buckets.js', opts), - get_calendar_events: lazyLoad('./api/ml.get_calendar_events.js', opts), - getCalendarEvents: lazyLoad('./api/ml.get_calendar_events.js', opts), - get_calendars: lazyLoad('./api/ml.get_calendars.js', opts), - getCalendars: lazyLoad('./api/ml.get_calendars.js', opts), - get_categories: lazyLoad('./api/ml.get_categories.js', opts), - getCategories: lazyLoad('./api/ml.get_categories.js', opts), - get_datafeed_stats: lazyLoad('./api/ml.get_datafeed_stats.js', opts), - getDatafeedStats: lazyLoad('./api/ml.get_datafeed_stats.js', opts), - get_datafeeds: lazyLoad('./api/ml.get_datafeeds.js', opts), - getDatafeeds: lazyLoad('./api/ml.get_datafeeds.js', opts), - get_filters: lazyLoad('./api/ml.get_filters.js', opts), - getFilters: lazyLoad('./api/ml.get_filters.js', opts), - get_influencers: lazyLoad('./api/ml.get_influencers.js', opts), - getInfluencers: lazyLoad('./api/ml.get_influencers.js', opts), - get_job_stats: lazyLoad('./api/ml.get_job_stats.js', opts), - getJobStats: lazyLoad('./api/ml.get_job_stats.js', opts), - get_jobs: lazyLoad('./api/ml.get_jobs.js', opts), - getJobs: lazyLoad('./api/ml.get_jobs.js', opts), - get_model_snapshots: lazyLoad('./api/ml.get_model_snapshots.js', opts), - getModelSnapshots: lazyLoad('./api/ml.get_model_snapshots.js', opts), - get_overall_buckets: lazyLoad('./api/ml.get_overall_buckets.js', opts), - getOverallBuckets: lazyLoad('./api/ml.get_overall_buckets.js', opts), - get_records: lazyLoad('./api/ml.get_records.js', opts), - getRecords: lazyLoad('./api/ml.get_records.js', opts), - info: lazyLoad('./api/ml.info.js', opts), - open_job: lazyLoad('./api/ml.open_job.js', opts), - openJob: lazyLoad('./api/ml.open_job.js', opts), - post_calendar_events: lazyLoad('./api/ml.post_calendar_events.js', opts), - postCalendarEvents: lazyLoad('./api/ml.post_calendar_events.js', opts), - post_data: lazyLoad('./api/ml.post_data.js', opts), - postData: lazyLoad('./api/ml.post_data.js', opts), - preview_datafeed: lazyLoad('./api/ml.preview_datafeed.js', opts), - previewDatafeed: lazyLoad('./api/ml.preview_datafeed.js', opts), - put_calendar: lazyLoad('./api/ml.put_calendar.js', opts), - putCalendar: lazyLoad('./api/ml.put_calendar.js', opts), - put_calendar_job: lazyLoad('./api/ml.put_calendar_job.js', opts), - putCalendarJob: lazyLoad('./api/ml.put_calendar_job.js', opts), - put_datafeed: lazyLoad('./api/ml.put_datafeed.js', opts), - putDatafeed: lazyLoad('./api/ml.put_datafeed.js', opts), - put_filter: lazyLoad('./api/ml.put_filter.js', opts), - putFilter: lazyLoad('./api/ml.put_filter.js', opts), - put_job: lazyLoad('./api/ml.put_job.js', opts), - putJob: lazyLoad('./api/ml.put_job.js', opts), - revert_model_snapshot: lazyLoad('./api/ml.revert_model_snapshot.js', opts), - revertModelSnapshot: lazyLoad('./api/ml.revert_model_snapshot.js', opts), - set_upgrade_mode: lazyLoad('./api/ml.set_upgrade_mode.js', opts), - setUpgradeMode: lazyLoad('./api/ml.set_upgrade_mode.js', opts), - start_datafeed: lazyLoad('./api/ml.start_datafeed.js', opts), - startDatafeed: lazyLoad('./api/ml.start_datafeed.js', opts), - stop_datafeed: lazyLoad('./api/ml.stop_datafeed.js', opts), - stopDatafeed: lazyLoad('./api/ml.stop_datafeed.js', opts), - update_datafeed: lazyLoad('./api/ml.update_datafeed.js', opts), - updateDatafeed: lazyLoad('./api/ml.update_datafeed.js', opts), - update_filter: lazyLoad('./api/ml.update_filter.js', opts), - updateFilter: lazyLoad('./api/ml.update_filter.js', opts), - update_job: lazyLoad('./api/ml.update_job.js', opts), - updateJob: lazyLoad('./api/ml.update_job.js', opts), - update_model_snapshot: lazyLoad('./api/ml.update_model_snapshot.js', opts), - updateModelSnapshot: lazyLoad('./api/ml.update_model_snapshot.js', opts), - validate: lazyLoad('./api/ml.validate.js', opts), - validate_detector: lazyLoad('./api/ml.validate_detector.js', opts), - validateDetector: lazyLoad('./api/ml.validate_detector.js', opts) - }, - monitoring: { - bulk: lazyLoad('./api/monitoring.bulk.js', opts) - }, msearch: lazyLoad('./api/msearch.js', opts), msearch_template: lazyLoad('./api/msearch_template.js', opts), msearchTemplate: lazyLoad('./api/msearch_template.js', opts), @@ -328,57 +232,6 @@ function ESAPI (opts) { searchShards: lazyLoad('./api/search_shards.js', opts), search_template: lazyLoad('./api/search_template.js', opts), searchTemplate: lazyLoad('./api/search_template.js', opts), - security: { - authenticate: lazyLoad('./api/security.authenticate.js', opts), - change_password: lazyLoad('./api/security.change_password.js', opts), - changePassword: lazyLoad('./api/security.change_password.js', opts), - clear_cached_realms: lazyLoad('./api/security.clear_cached_realms.js', opts), - clearCachedRealms: lazyLoad('./api/security.clear_cached_realms.js', opts), - clear_cached_roles: lazyLoad('./api/security.clear_cached_roles.js', opts), - clearCachedRoles: lazyLoad('./api/security.clear_cached_roles.js', opts), - create_api_key: lazyLoad('./api/security.create_api_key.js', opts), - createApiKey: lazyLoad('./api/security.create_api_key.js', opts), - delete_privileges: lazyLoad('./api/security.delete_privileges.js', opts), - deletePrivileges: lazyLoad('./api/security.delete_privileges.js', opts), - delete_role: lazyLoad('./api/security.delete_role.js', opts), - deleteRole: lazyLoad('./api/security.delete_role.js', opts), - delete_role_mapping: lazyLoad('./api/security.delete_role_mapping.js', opts), - deleteRoleMapping: lazyLoad('./api/security.delete_role_mapping.js', opts), - delete_user: lazyLoad('./api/security.delete_user.js', opts), - deleteUser: lazyLoad('./api/security.delete_user.js', opts), - disable_user: lazyLoad('./api/security.disable_user.js', opts), - disableUser: lazyLoad('./api/security.disable_user.js', opts), - enable_user: lazyLoad('./api/security.enable_user.js', opts), - enableUser: lazyLoad('./api/security.enable_user.js', opts), - get_api_key: lazyLoad('./api/security.get_api_key.js', opts), - getApiKey: lazyLoad('./api/security.get_api_key.js', opts), - get_privileges: lazyLoad('./api/security.get_privileges.js', opts), - getPrivileges: lazyLoad('./api/security.get_privileges.js', opts), - get_role: lazyLoad('./api/security.get_role.js', opts), - getRole: lazyLoad('./api/security.get_role.js', opts), - get_role_mapping: lazyLoad('./api/security.get_role_mapping.js', opts), - getRoleMapping: lazyLoad('./api/security.get_role_mapping.js', opts), - get_token: lazyLoad('./api/security.get_token.js', opts), - getToken: lazyLoad('./api/security.get_token.js', opts), - get_user: lazyLoad('./api/security.get_user.js', opts), - getUser: lazyLoad('./api/security.get_user.js', opts), - get_user_privileges: lazyLoad('./api/security.get_user_privileges.js', opts), - getUserPrivileges: lazyLoad('./api/security.get_user_privileges.js', opts), - has_privileges: lazyLoad('./api/security.has_privileges.js', opts), - hasPrivileges: lazyLoad('./api/security.has_privileges.js', opts), - invalidate_api_key: lazyLoad('./api/security.invalidate_api_key.js', opts), - invalidateApiKey: lazyLoad('./api/security.invalidate_api_key.js', opts), - invalidate_token: lazyLoad('./api/security.invalidate_token.js', opts), - invalidateToken: lazyLoad('./api/security.invalidate_token.js', opts), - put_privileges: lazyLoad('./api/security.put_privileges.js', opts), - putPrivileges: lazyLoad('./api/security.put_privileges.js', opts), - put_role: lazyLoad('./api/security.put_role.js', opts), - putRole: lazyLoad('./api/security.put_role.js', opts), - put_role_mapping: lazyLoad('./api/security.put_role_mapping.js', opts), - putRoleMapping: lazyLoad('./api/security.put_role_mapping.js', opts), - put_user: lazyLoad('./api/security.put_user.js', opts), - putUser: lazyLoad('./api/security.put_user.js', opts) - }, snapshot: { create: lazyLoad('./api/snapshot.create.js', opts), create_repository: lazyLoad('./api/snapshot.create_repository.js', opts), @@ -394,9 +247,6 @@ function ESAPI (opts) { verify_repository: lazyLoad('./api/snapshot.verify_repository.js', opts), verifyRepository: lazyLoad('./api/snapshot.verify_repository.js', opts) }, - ssl: { - certificates: lazyLoad('./api/ssl.certificates.js', opts) - }, tasks: { cancel: lazyLoad('./api/tasks.cancel.js', opts), get: lazyLoad('./api/tasks.get.js', opts), @@ -432,6 +282,98 @@ function ESAPI (opts) { getAssistance: lazyLoad('./api/xpack.migration.get_assistance.js', opts), upgrade: lazyLoad('./api/xpack.migration.upgrade.js', opts) }, + ml: { + close_job: lazyLoad('./api/xpack.ml.close_job.js', opts), + closeJob: lazyLoad('./api/xpack.ml.close_job.js', opts), + delete_calendar: lazyLoad('./api/xpack.ml.delete_calendar.js', opts), + deleteCalendar: lazyLoad('./api/xpack.ml.delete_calendar.js', opts), + delete_calendar_event: lazyLoad('./api/xpack.ml.delete_calendar_event.js', opts), + deleteCalendarEvent: lazyLoad('./api/xpack.ml.delete_calendar_event.js', opts), + delete_calendar_job: lazyLoad('./api/xpack.ml.delete_calendar_job.js', opts), + deleteCalendarJob: lazyLoad('./api/xpack.ml.delete_calendar_job.js', opts), + delete_datafeed: lazyLoad('./api/xpack.ml.delete_datafeed.js', opts), + deleteDatafeed: lazyLoad('./api/xpack.ml.delete_datafeed.js', opts), + delete_expired_data: lazyLoad('./api/xpack.ml.delete_expired_data.js', opts), + deleteExpiredData: lazyLoad('./api/xpack.ml.delete_expired_data.js', opts), + delete_filter: lazyLoad('./api/xpack.ml.delete_filter.js', opts), + deleteFilter: lazyLoad('./api/xpack.ml.delete_filter.js', opts), + delete_forecast: lazyLoad('./api/xpack.ml.delete_forecast.js', opts), + deleteForecast: lazyLoad('./api/xpack.ml.delete_forecast.js', opts), + delete_job: lazyLoad('./api/xpack.ml.delete_job.js', opts), + deleteJob: lazyLoad('./api/xpack.ml.delete_job.js', opts), + delete_model_snapshot: lazyLoad('./api/xpack.ml.delete_model_snapshot.js', opts), + deleteModelSnapshot: lazyLoad('./api/xpack.ml.delete_model_snapshot.js', opts), + find_file_structure: lazyLoad('./api/xpack.ml.find_file_structure.js', opts), + findFileStructure: lazyLoad('./api/xpack.ml.find_file_structure.js', opts), + flush_job: lazyLoad('./api/xpack.ml.flush_job.js', opts), + flushJob: lazyLoad('./api/xpack.ml.flush_job.js', opts), + forecast: lazyLoad('./api/xpack.ml.forecast.js', opts), + get_buckets: lazyLoad('./api/xpack.ml.get_buckets.js', opts), + getBuckets: lazyLoad('./api/xpack.ml.get_buckets.js', opts), + get_calendar_events: lazyLoad('./api/xpack.ml.get_calendar_events.js', opts), + getCalendarEvents: lazyLoad('./api/xpack.ml.get_calendar_events.js', opts), + get_calendars: lazyLoad('./api/xpack.ml.get_calendars.js', opts), + getCalendars: lazyLoad('./api/xpack.ml.get_calendars.js', opts), + get_categories: lazyLoad('./api/xpack.ml.get_categories.js', opts), + getCategories: lazyLoad('./api/xpack.ml.get_categories.js', opts), + get_datafeed_stats: lazyLoad('./api/xpack.ml.get_datafeed_stats.js', opts), + getDatafeedStats: lazyLoad('./api/xpack.ml.get_datafeed_stats.js', opts), + get_datafeeds: lazyLoad('./api/xpack.ml.get_datafeeds.js', opts), + getDatafeeds: lazyLoad('./api/xpack.ml.get_datafeeds.js', opts), + get_filters: lazyLoad('./api/xpack.ml.get_filters.js', opts), + getFilters: lazyLoad('./api/xpack.ml.get_filters.js', opts), + get_influencers: lazyLoad('./api/xpack.ml.get_influencers.js', opts), + getInfluencers: lazyLoad('./api/xpack.ml.get_influencers.js', opts), + get_job_stats: lazyLoad('./api/xpack.ml.get_job_stats.js', opts), + getJobStats: lazyLoad('./api/xpack.ml.get_job_stats.js', opts), + get_jobs: lazyLoad('./api/xpack.ml.get_jobs.js', opts), + getJobs: lazyLoad('./api/xpack.ml.get_jobs.js', opts), + get_model_snapshots: lazyLoad('./api/xpack.ml.get_model_snapshots.js', opts), + getModelSnapshots: lazyLoad('./api/xpack.ml.get_model_snapshots.js', opts), + get_overall_buckets: lazyLoad('./api/xpack.ml.get_overall_buckets.js', opts), + getOverallBuckets: lazyLoad('./api/xpack.ml.get_overall_buckets.js', opts), + get_records: lazyLoad('./api/xpack.ml.get_records.js', opts), + getRecords: lazyLoad('./api/xpack.ml.get_records.js', opts), + info: lazyLoad('./api/xpack.ml.info.js', opts), + open_job: lazyLoad('./api/xpack.ml.open_job.js', opts), + openJob: lazyLoad('./api/xpack.ml.open_job.js', opts), + post_calendar_events: lazyLoad('./api/xpack.ml.post_calendar_events.js', opts), + postCalendarEvents: lazyLoad('./api/xpack.ml.post_calendar_events.js', opts), + post_data: lazyLoad('./api/xpack.ml.post_data.js', opts), + postData: lazyLoad('./api/xpack.ml.post_data.js', opts), + preview_datafeed: lazyLoad('./api/xpack.ml.preview_datafeed.js', opts), + previewDatafeed: lazyLoad('./api/xpack.ml.preview_datafeed.js', opts), + put_calendar: lazyLoad('./api/xpack.ml.put_calendar.js', opts), + putCalendar: lazyLoad('./api/xpack.ml.put_calendar.js', opts), + put_calendar_job: lazyLoad('./api/xpack.ml.put_calendar_job.js', opts), + putCalendarJob: lazyLoad('./api/xpack.ml.put_calendar_job.js', opts), + put_datafeed: lazyLoad('./api/xpack.ml.put_datafeed.js', opts), + putDatafeed: lazyLoad('./api/xpack.ml.put_datafeed.js', opts), + put_filter: lazyLoad('./api/xpack.ml.put_filter.js', opts), + putFilter: lazyLoad('./api/xpack.ml.put_filter.js', opts), + put_job: lazyLoad('./api/xpack.ml.put_job.js', opts), + putJob: lazyLoad('./api/xpack.ml.put_job.js', opts), + revert_model_snapshot: lazyLoad('./api/xpack.ml.revert_model_snapshot.js', opts), + revertModelSnapshot: lazyLoad('./api/xpack.ml.revert_model_snapshot.js', opts), + start_datafeed: lazyLoad('./api/xpack.ml.start_datafeed.js', opts), + startDatafeed: lazyLoad('./api/xpack.ml.start_datafeed.js', opts), + stop_datafeed: lazyLoad('./api/xpack.ml.stop_datafeed.js', opts), + stopDatafeed: lazyLoad('./api/xpack.ml.stop_datafeed.js', opts), + update_datafeed: lazyLoad('./api/xpack.ml.update_datafeed.js', opts), + updateDatafeed: lazyLoad('./api/xpack.ml.update_datafeed.js', opts), + update_filter: lazyLoad('./api/xpack.ml.update_filter.js', opts), + updateFilter: lazyLoad('./api/xpack.ml.update_filter.js', opts), + update_job: lazyLoad('./api/xpack.ml.update_job.js', opts), + updateJob: lazyLoad('./api/xpack.ml.update_job.js', opts), + update_model_snapshot: lazyLoad('./api/xpack.ml.update_model_snapshot.js', opts), + updateModelSnapshot: lazyLoad('./api/xpack.ml.update_model_snapshot.js', opts), + validate: lazyLoad('./api/xpack.ml.validate.js', opts), + validate_detector: lazyLoad('./api/xpack.ml.validate_detector.js', opts), + validateDetector: lazyLoad('./api/xpack.ml.validate_detector.js', opts) + }, + monitoring: { + bulk: lazyLoad('./api/xpack.monitoring.bulk.js', opts) + }, rollup: { delete_job: lazyLoad('./api/xpack.rollup.delete_job.js', opts), deleteJob: lazyLoad('./api/xpack.rollup.delete_job.js', opts), @@ -450,12 +392,60 @@ function ESAPI (opts) { stop_job: lazyLoad('./api/xpack.rollup.stop_job.js', opts), stopJob: lazyLoad('./api/xpack.rollup.stop_job.js', opts) }, + security: { + authenticate: lazyLoad('./api/xpack.security.authenticate.js', opts), + change_password: lazyLoad('./api/xpack.security.change_password.js', opts), + changePassword: lazyLoad('./api/xpack.security.change_password.js', opts), + clear_cached_realms: lazyLoad('./api/xpack.security.clear_cached_realms.js', opts), + clearCachedRealms: lazyLoad('./api/xpack.security.clear_cached_realms.js', opts), + clear_cached_roles: lazyLoad('./api/xpack.security.clear_cached_roles.js', opts), + clearCachedRoles: lazyLoad('./api/xpack.security.clear_cached_roles.js', opts), + delete_privileges: lazyLoad('./api/xpack.security.delete_privileges.js', opts), + deletePrivileges: lazyLoad('./api/xpack.security.delete_privileges.js', opts), + delete_role: lazyLoad('./api/xpack.security.delete_role.js', opts), + deleteRole: lazyLoad('./api/xpack.security.delete_role.js', opts), + delete_role_mapping: lazyLoad('./api/xpack.security.delete_role_mapping.js', opts), + deleteRoleMapping: lazyLoad('./api/xpack.security.delete_role_mapping.js', opts), + delete_user: lazyLoad('./api/xpack.security.delete_user.js', opts), + deleteUser: lazyLoad('./api/xpack.security.delete_user.js', opts), + disable_user: lazyLoad('./api/xpack.security.disable_user.js', opts), + disableUser: lazyLoad('./api/xpack.security.disable_user.js', opts), + enable_user: lazyLoad('./api/xpack.security.enable_user.js', opts), + enableUser: lazyLoad('./api/xpack.security.enable_user.js', opts), + get_privileges: lazyLoad('./api/xpack.security.get_privileges.js', opts), + getPrivileges: lazyLoad('./api/xpack.security.get_privileges.js', opts), + get_role: lazyLoad('./api/xpack.security.get_role.js', opts), + getRole: lazyLoad('./api/xpack.security.get_role.js', opts), + get_role_mapping: lazyLoad('./api/xpack.security.get_role_mapping.js', opts), + getRoleMapping: lazyLoad('./api/xpack.security.get_role_mapping.js', opts), + get_token: lazyLoad('./api/xpack.security.get_token.js', opts), + getToken: lazyLoad('./api/xpack.security.get_token.js', opts), + get_user: lazyLoad('./api/xpack.security.get_user.js', opts), + getUser: lazyLoad('./api/xpack.security.get_user.js', opts), + get_user_privileges: lazyLoad('./api/xpack.security.get_user_privileges.js', opts), + getUserPrivileges: lazyLoad('./api/xpack.security.get_user_privileges.js', opts), + has_privileges: lazyLoad('./api/xpack.security.has_privileges.js', opts), + hasPrivileges: lazyLoad('./api/xpack.security.has_privileges.js', opts), + invalidate_token: lazyLoad('./api/xpack.security.invalidate_token.js', opts), + invalidateToken: lazyLoad('./api/xpack.security.invalidate_token.js', opts), + put_privileges: lazyLoad('./api/xpack.security.put_privileges.js', opts), + putPrivileges: lazyLoad('./api/xpack.security.put_privileges.js', opts), + put_role: lazyLoad('./api/xpack.security.put_role.js', opts), + putRole: lazyLoad('./api/xpack.security.put_role.js', opts), + put_role_mapping: lazyLoad('./api/xpack.security.put_role_mapping.js', opts), + putRoleMapping: lazyLoad('./api/xpack.security.put_role_mapping.js', opts), + put_user: lazyLoad('./api/xpack.security.put_user.js', opts), + putUser: lazyLoad('./api/xpack.security.put_user.js', opts) + }, sql: { clear_cursor: lazyLoad('./api/xpack.sql.clear_cursor.js', opts), clearCursor: lazyLoad('./api/xpack.sql.clear_cursor.js', opts), query: lazyLoad('./api/xpack.sql.query.js', opts), translate: lazyLoad('./api/xpack.sql.translate.js', opts) }, + ssl: { + certificates: lazyLoad('./api/xpack.ssl.certificates.js', opts) + }, usage: lazyLoad('./api/xpack.usage.js', opts), watcher: { ack_watch: lazyLoad('./api/xpack.watcher.ack_watch.js', opts), @@ -472,6 +462,7 @@ function ESAPI (opts) { getWatch: lazyLoad('./api/xpack.watcher.get_watch.js', opts), put_watch: lazyLoad('./api/xpack.watcher.put_watch.js', opts), putWatch: lazyLoad('./api/xpack.watcher.put_watch.js', opts), + restart: lazyLoad('./api/xpack.watcher.restart.js', opts), start: lazyLoad('./api/xpack.watcher.start.js', opts), stats: lazyLoad('./api/xpack.watcher.stats.js', opts), stop: lazyLoad('./api/xpack.watcher.stop.js', opts) diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 755fddf88..6ed515f75 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -34,6 +34,7 @@ export interface Bulk extends Generic { refresh?: 'true' | 'false' | 'wait_for'; routing?: string; timeout?: string; + fields?: string | string[]; _source?: string | string[]; _source_excludes?: string | string[]; _source_includes?: string | string[]; @@ -356,7 +357,7 @@ export interface Count extends Generic { export interface Create extends Generic { id: string; index: string; - type?: string; + type: string; wait_for_active_shards?: string; parent?: string; refresh?: 'true' | 'false' | 'wait_for'; @@ -371,7 +372,7 @@ export interface Create extends Generic { export interface Delete extends Generic { id: string; index: string; - type?: string; + type: string; wait_for_active_shards?: string; parent?: string; refresh?: 'true' | 'false' | 'wait_for'; @@ -435,7 +436,7 @@ export interface DeleteScript extends Generic { export interface Exists extends Generic { id: string; index: string; - type?: string; + type: string; stored_fields?: string | string[]; parent?: string; preference?: string; @@ -452,7 +453,7 @@ export interface Exists extends Generic { export interface ExistsSource extends Generic { id: string; index: string; - type?: string; + type: string; parent?: string; preference?: string; realtime?: boolean; @@ -468,7 +469,7 @@ export interface ExistsSource extends Generic { export interface Explain extends Generic { id: string; index: string; - type?: string; + type: string; analyze_wildcard?: boolean; analyzer?: string; default_operator?: 'AND' | 'OR'; @@ -491,12 +492,13 @@ export interface FieldCaps extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + body?: any; } export interface Get extends Generic { id: string; index: string; - type?: string; + type: string; stored_fields?: string | string[]; parent?: string; preference?: string; @@ -520,7 +522,7 @@ export interface GetScript extends Generic { export interface GetSource extends Generic { id: string; index: string; - type?: string; + type: string; parent?: string; preference?: string; realtime?: boolean; @@ -536,7 +538,7 @@ export interface GetSource extends Generic { export interface Index extends Generic { id?: string; index: string; - type?: string; + type: string; wait_for_active_shards?: string; op_type?: 'index' | 'create'; parent?: string; @@ -558,12 +560,14 @@ export interface IndicesAnalyze extends Generic { export interface IndicesClearCache extends Generic { index?: string | string[]; + field_data?: boolean; fielddata?: boolean; fields?: string | string[]; query?: boolean; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + request_cache?: boolean; request?: boolean; } @@ -578,10 +582,10 @@ export interface IndicesClose extends Generic { export interface IndicesCreate extends Generic { index: string; - include_type_name?: boolean; wait_for_active_shards?: string; timeout?: string; master_timeout?: string; + update_all_types?: boolean; body?: any; } @@ -670,7 +674,6 @@ export interface IndicesForcemerge extends Generic { export interface IndicesGet extends Generic { index: string | string[]; - include_type_name?: boolean; local?: boolean; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -693,7 +696,6 @@ export interface IndicesGetFieldMapping extends Generic { index?: string | string[]; type?: string | string[]; fields: string | string[]; - include_type_name?: boolean; include_defaults?: boolean; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -704,7 +706,6 @@ export interface IndicesGetFieldMapping extends Generic { export interface IndicesGetMapping extends Generic { index?: string | string[]; type?: string | string[]; - include_type_name?: boolean; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; @@ -726,7 +727,6 @@ export interface IndicesGetSettings extends Generic { export interface IndicesGetTemplate extends Generic { name?: string | string[]; - include_type_name?: boolean; flat_settings?: boolean; master_timeout?: string; local?: boolean; @@ -759,13 +759,13 @@ export interface IndicesPutAlias extends Generic { export interface IndicesPutMapping extends Generic { index?: string | string[]; - type?: string; - include_type_name?: boolean; + type: string; timeout?: string; master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + update_all_types?: boolean; body: any; } @@ -783,7 +783,6 @@ export interface IndicesPutSettings extends Generic { export interface IndicesPutTemplate extends Generic { name: string; - include_type_name?: boolean; order?: number; create?: boolean; timeout?: string; @@ -808,7 +807,6 @@ export interface IndicesRefresh extends Generic { export interface IndicesRollover extends Generic { alias: string; new_index?: string; - include_type_name?: boolean; timeout?: string; dry_run?: boolean; master_timeout?: string; @@ -950,7 +948,6 @@ export interface Msearch extends Generic { pre_filter_shard_size?: number; max_concurrent_shard_requests?: number; rest_total_hits_as_int?: boolean; - ccs_minimize_roundtrips?: boolean; body: any; } @@ -961,7 +958,6 @@ export interface MsearchTemplate extends Generic { typed_keys?: boolean; max_concurrent_searches?: number; rest_total_hits_as_int?: boolean; - ccs_minimize_roundtrips?: boolean; body: any; } @@ -1081,7 +1077,6 @@ export interface Search extends Generic { type?: string | string[]; analyzer?: string; analyze_wildcard?: boolean; - ccs_minimize_roundtrips?: boolean; default_operator?: 'AND' | 'OR'; df?: string; explain?: boolean; @@ -1115,7 +1110,6 @@ export interface Search extends Generic { allow_partial_search_results?: boolean; typed_keys?: boolean; version?: boolean; - seq_no_primary_term?: boolean; request_cache?: boolean; batched_reduce_size?: number; max_concurrent_shard_requests?: number; @@ -1149,7 +1143,6 @@ export interface SearchTemplate extends Generic { profile?: boolean; typed_keys?: boolean; rest_total_hits_as_int?: boolean; - ccs_minimize_roundtrips?: boolean; body: any; } @@ -1241,7 +1234,7 @@ export interface TasksList extends Generic { export interface Termvectors extends Generic { index: string; - type?: string; + type: string; id?: string; term_statistics?: boolean; field_statistics?: boolean; @@ -1261,8 +1254,9 @@ export interface Termvectors extends Generic { export interface Update extends Generic { id: string; index: string; - type?: string; + type: string; wait_for_active_shards?: string; + fields?: string | string[]; _source?: string | string[]; _source_excludes?: string | string[]; _source_includes?: string | string[]; @@ -1272,8 +1266,8 @@ export interface Update extends Generic { retry_on_conflict?: number; routing?: string; timeout?: string; - if_seq_no?: number; - if_primary_term?: number; + version?: number; + version_type?: 'internal' | 'force'; body: any; } @@ -1328,14 +1322,9 @@ export interface CcrDeleteAutoFollowPattern extends Generic { export interface CcrFollow extends Generic { index: string; - wait_for_active_shards?: string; body: any; } -export interface CcrFollowInfo extends Generic { - index?: string | string[]; -} - export interface CcrFollowStats extends Generic { index?: string | string[]; } @@ -1425,443 +1414,6 @@ export interface IndicesUnfreeze extends Generic { wait_for_active_shards?: string; } -export interface MlCloseJob extends Generic { - job_id: string; - allow_no_jobs?: boolean; - force?: boolean; - timeout?: string; - body?: any; -} - -export interface MlDeleteCalendar extends Generic { - calendar_id: string; -} - -export interface MlDeleteCalendarEvent extends Generic { - calendar_id: string; - event_id: string; -} - -export interface MlDeleteCalendarJob extends Generic { - calendar_id: string; - job_id: string; -} - -export interface MlDeleteDatafeed extends Generic { - datafeed_id: string; - force?: boolean; -} - -export interface MlDeleteExpiredData extends Generic { -} - -export interface MlDeleteFilter extends Generic { - filter_id: string; -} - -export interface MlDeleteForecast extends Generic { - job_id: string; - forecast_id?: string; - allow_no_forecasts?: boolean; - timeout?: string; -} - -export interface MlDeleteJob extends Generic { - job_id: string; - force?: boolean; - wait_for_completion?: boolean; -} - -export interface MlDeleteModelSnapshot extends Generic { - job_id: string; - snapshot_id: string; -} - -export interface MlFindFileStructure extends Generic { - lines_to_sample?: number; - timeout?: string; - charset?: string; - format?: 'ndjson' | 'xml' | 'delimited' | 'semi_structured_text'; - has_header_row?: boolean; - column_names?: string | string[]; - delimiter?: string; - quote?: string; - should_trim_fields?: boolean; - grok_pattern?: string; - timestamp_field?: string; - timestamp_format?: string; - explain?: boolean; - body: any; -} - -export interface MlFlushJob extends Generic { - job_id: string; - calc_interim?: boolean; - start?: string; - end?: string; - advance_time?: string; - skip_time?: string; - body?: any; -} - -export interface MlForecast extends Generic { - job_id: string; - duration?: string; - expires_in?: string; -} - -export interface MlGetBuckets extends Generic { - job_id: string; - timestamp?: string; - expand?: boolean; - exclude_interim?: boolean; - from?: number; - size?: number; - start?: string; - end?: string; - anomaly_score?: number; - sort?: string; - desc?: boolean; - body?: any; -} - -export interface MlGetCalendarEvents extends Generic { - calendar_id: string; - job_id?: string; - start?: string; - end?: string; - from?: number; - size?: number; -} - -export interface MlGetCalendars extends Generic { - calendar_id?: string; - from?: number; - size?: number; -} - -export interface MlGetCategories extends Generic { - job_id: string; - category_id?: number; - from?: number; - size?: number; - body?: any; -} - -export interface MlGetDatafeedStats extends Generic { - datafeed_id?: string; - allow_no_datafeeds?: boolean; -} - -export interface MlGetDatafeeds extends Generic { - datafeed_id?: string; - allow_no_datafeeds?: boolean; -} - -export interface MlGetFilters extends Generic { - filter_id?: string; - from?: number; - size?: number; -} - -export interface MlGetInfluencers extends Generic { - job_id: string; - exclude_interim?: boolean; - from?: number; - size?: number; - start?: string; - end?: string; - influencer_score?: number; - sort?: string; - desc?: boolean; - body?: any; -} - -export interface MlGetJobStats extends Generic { - job_id?: string; - allow_no_jobs?: boolean; -} - -export interface MlGetJobs extends Generic { - job_id?: string; - allow_no_jobs?: boolean; -} - -export interface MlGetModelSnapshots extends Generic { - job_id: string; - snapshot_id?: string; - from?: number; - size?: number; - start?: string; - end?: string; - sort?: string; - desc?: boolean; - body?: any; -} - -export interface MlGetOverallBuckets extends Generic { - job_id: string; - top_n?: number; - bucket_span?: string; - overall_score?: number; - exclude_interim?: boolean; - start?: string; - end?: string; - allow_no_jobs?: boolean; - body?: any; -} - -export interface MlGetRecords extends Generic { - job_id: string; - exclude_interim?: boolean; - from?: number; - size?: number; - start?: string; - end?: string; - record_score?: number; - sort?: string; - desc?: boolean; - body?: any; -} - -export interface MlInfo extends Generic { -} - -export interface MlOpenJob extends Generic { - job_id: string; - ignore_downtime?: boolean; - timeout?: string; -} - -export interface MlPostCalendarEvents extends Generic { - calendar_id: string; - body: any; -} - -export interface MlPostData extends Generic { - job_id: string; - reset_start?: string; - reset_end?: string; - body: any; -} - -export interface MlPreviewDatafeed extends Generic { - datafeed_id: string; -} - -export interface MlPutCalendar extends Generic { - calendar_id: string; - body?: any; -} - -export interface MlPutCalendarJob extends Generic { - calendar_id: string; - job_id: string; -} - -export interface MlPutDatafeed extends Generic { - datafeed_id: string; - body: any; -} - -export interface MlPutFilter extends Generic { - filter_id: string; - body: any; -} - -export interface MlPutJob extends Generic { - job_id: string; - body: any; -} - -export interface MlRevertModelSnapshot extends Generic { - job_id: string; - snapshot_id: string; - delete_intervening_results?: boolean; - body?: any; -} - -export interface MlSetUpgradeMode extends Generic { - enabled?: boolean; - timeout?: string; -} - -export interface MlStartDatafeed extends Generic { - datafeed_id: string; - start?: string; - end?: string; - timeout?: string; - body?: any; -} - -export interface MlStopDatafeed extends Generic { - datafeed_id: string; - allow_no_datafeeds?: boolean; - force?: boolean; - timeout?: string; -} - -export interface MlUpdateDatafeed extends Generic { - datafeed_id: string; - body: any; -} - -export interface MlUpdateFilter extends Generic { - filter_id: string; - body: any; -} - -export interface MlUpdateJob extends Generic { - job_id: string; - body: any; -} - -export interface MlUpdateModelSnapshot extends Generic { - job_id: string; - snapshot_id: string; - body: any; -} - -export interface MlValidate extends Generic { - body: any; -} - -export interface MlValidateDetector extends Generic { - body: any; -} - -export interface MonitoringBulk extends Generic { - type?: string; - system_id?: string; - system_api_version?: string; - interval?: string; - body: any; -} - -export interface SecurityAuthenticate extends Generic { -} - -export interface SecurityChangePassword extends Generic { - username?: string; - refresh?: 'true' | 'false' | 'wait_for'; - body: any; -} - -export interface SecurityClearCachedRealms extends Generic { - realms: string | string[]; - usernames?: string | string[]; -} - -export interface SecurityClearCachedRoles extends Generic { - name: string | string[]; -} - -export interface SecurityCreateApiKey extends Generic { - refresh?: 'true' | 'false' | 'wait_for'; - body: any; -} - -export interface SecurityDeletePrivileges extends Generic { - application: string; - name: string; - refresh?: 'true' | 'false' | 'wait_for'; -} - -export interface SecurityDeleteRole extends Generic { - name: string; - refresh?: 'true' | 'false' | 'wait_for'; -} - -export interface SecurityDeleteRoleMapping extends Generic { - name: string; - refresh?: 'true' | 'false' | 'wait_for'; -} - -export interface SecurityDeleteUser extends Generic { - username: string; - refresh?: 'true' | 'false' | 'wait_for'; -} - -export interface SecurityDisableUser extends Generic { - username?: string; - refresh?: 'true' | 'false' | 'wait_for'; -} - -export interface SecurityEnableUser extends Generic { - username?: string; - refresh?: 'true' | 'false' | 'wait_for'; -} - -export interface SecurityGetApiKey extends Generic { - id?: string; - name?: string; - username?: string; - realm_name?: string; -} - -export interface SecurityGetPrivileges extends Generic { - application?: string; - name?: string; -} - -export interface SecurityGetRole extends Generic { - name?: string; -} - -export interface SecurityGetRoleMapping extends Generic { - name?: string; -} - -export interface SecurityGetToken extends Generic { - body: any; -} - -export interface SecurityGetUser extends Generic { - username?: string | string[]; -} - -export interface SecurityGetUserPrivileges extends Generic { -} - -export interface SecurityHasPrivileges extends Generic { - user?: string; - body: any; -} - -export interface SecurityInvalidateApiKey extends Generic { - body: any; -} - -export interface SecurityInvalidateToken extends Generic { - body: any; -} - -export interface SecurityPutPrivileges extends Generic { - refresh?: 'true' | 'false' | 'wait_for'; - body: any; -} - -export interface SecurityPutRole extends Generic { - name: string; - refresh?: 'true' | 'false' | 'wait_for'; - body: any; -} - -export interface SecurityPutRoleMapping extends Generic { - name: string; - refresh?: 'true' | 'false' | 'wait_for'; - body: any; -} - -export interface SecurityPutUser extends Generic { - username: string; - refresh?: 'true' | 'false' | 'wait_for'; - body: any; -} - -export interface SslCertificates extends Generic { -} - export interface XpackGraphExplore extends Generic { index?: string | string[]; type?: string | string[]; @@ -1917,6 +1469,313 @@ export interface XpackMigrationUpgrade extends Generic { wait_for_completion?: boolean; } +export interface XpackMlCloseJob extends Generic { + job_id: string; + allow_no_jobs?: boolean; + force?: boolean; + timeout?: string; +} + +export interface XpackMlDeleteCalendar extends Generic { + calendar_id: string; +} + +export interface XpackMlDeleteCalendarEvent extends Generic { + calendar_id: string; + event_id: string; +} + +export interface XpackMlDeleteCalendarJob extends Generic { + calendar_id: string; + job_id: string; +} + +export interface XpackMlDeleteDatafeed extends Generic { + datafeed_id: string; + force?: boolean; +} + +export interface XpackMlDeleteExpiredData extends Generic { +} + +export interface XpackMlDeleteFilter extends Generic { + filter_id: string; +} + +export interface XpackMlDeleteForecast extends Generic { + job_id: string; + forecast_id?: string; + allow_no_forecasts?: boolean; + timeout?: string; +} + +export interface XpackMlDeleteJob extends Generic { + job_id: string; + force?: boolean; + wait_for_completion?: boolean; +} + +export interface XpackMlDeleteModelSnapshot extends Generic { + job_id: string; + snapshot_id: string; +} + +export interface XpackMlFindFileStructure extends Generic { + lines_to_sample?: number; + timeout?: string; + charset?: string; + format?: 'ndjson' | 'xml' | 'delimited' | 'semi_structured_text'; + has_header_row?: boolean; + column_names?: string | string[]; + delimiter?: string; + quote?: string; + should_trim_fields?: boolean; + grok_pattern?: string; + timestamp_field?: string; + timestamp_format?: string; + explain?: boolean; + body: any; +} + +export interface XpackMlFlushJob extends Generic { + job_id: string; + calc_interim?: boolean; + start?: string; + end?: string; + advance_time?: string; + skip_time?: string; + body?: any; +} + +export interface XpackMlForecast extends Generic { + job_id: string; + duration?: string; + expires_in?: string; +} + +export interface XpackMlGetBuckets extends Generic { + job_id: string; + timestamp?: string; + expand?: boolean; + exclude_interim?: boolean; + from?: number; + size?: number; + start?: string; + end?: string; + anomaly_score?: number; + sort?: string; + desc?: boolean; + body?: any; +} + +export interface XpackMlGetCalendarEvents extends Generic { + calendar_id: string; + job_id?: string; + start?: string; + end?: string; + from?: number; + size?: number; +} + +export interface XpackMlGetCalendars extends Generic { + calendar_id?: string; + from?: number; + size?: number; +} + +export interface XpackMlGetCategories extends Generic { + job_id: string; + category_id?: number; + from?: number; + size?: number; + body?: any; +} + +export interface XpackMlGetDatafeedStats extends Generic { + datafeed_id?: string; + allow_no_datafeeds?: boolean; +} + +export interface XpackMlGetDatafeeds extends Generic { + datafeed_id?: string; + allow_no_datafeeds?: boolean; +} + +export interface XpackMlGetFilters extends Generic { + filter_id?: string; + from?: number; + size?: number; +} + +export interface XpackMlGetInfluencers extends Generic { + job_id: string; + exclude_interim?: boolean; + from?: number; + size?: number; + start?: string; + end?: string; + influencer_score?: number; + sort?: string; + desc?: boolean; + body?: any; +} + +export interface XpackMlGetJobStats extends Generic { + job_id?: string; + allow_no_jobs?: boolean; +} + +export interface XpackMlGetJobs extends Generic { + job_id?: string; + allow_no_jobs?: boolean; +} + +export interface XpackMlGetModelSnapshots extends Generic { + job_id: string; + snapshot_id?: string; + from?: number; + size?: number; + start?: string; + end?: string; + sort?: string; + desc?: boolean; + body?: any; +} + +export interface XpackMlGetOverallBuckets extends Generic { + job_id: string; + top_n?: number; + bucket_span?: string; + overall_score?: number; + exclude_interim?: boolean; + start?: string; + end?: string; + allow_no_jobs?: boolean; + body?: any; +} + +export interface XpackMlGetRecords extends Generic { + job_id: string; + exclude_interim?: boolean; + from?: number; + size?: number; + start?: string; + end?: string; + record_score?: number; + sort?: string; + desc?: boolean; + body?: any; +} + +export interface XpackMlInfo extends Generic { +} + +export interface XpackMlOpenJob extends Generic { + job_id: string; + ignore_downtime?: boolean; + timeout?: string; +} + +export interface XpackMlPostCalendarEvents extends Generic { + calendar_id: string; + body: any; +} + +export interface XpackMlPostData extends Generic { + job_id: string; + reset_start?: string; + reset_end?: string; + body: any; +} + +export interface XpackMlPreviewDatafeed extends Generic { + datafeed_id: string; +} + +export interface XpackMlPutCalendar extends Generic { + calendar_id: string; + body?: any; +} + +export interface XpackMlPutCalendarJob extends Generic { + calendar_id: string; + job_id: string; +} + +export interface XpackMlPutDatafeed extends Generic { + datafeed_id: string; + body: any; +} + +export interface XpackMlPutFilter extends Generic { + filter_id: string; + body: any; +} + +export interface XpackMlPutJob extends Generic { + job_id: string; + body: any; +} + +export interface XpackMlRevertModelSnapshot extends Generic { + job_id: string; + snapshot_id: string; + delete_intervening_results?: boolean; + body?: any; +} + +export interface XpackMlStartDatafeed extends Generic { + datafeed_id: string; + start?: string; + end?: string; + timeout?: string; + body?: any; +} + +export interface XpackMlStopDatafeed extends Generic { + datafeed_id: string; + allow_no_datafeeds?: boolean; + force?: boolean; + timeout?: string; +} + +export interface XpackMlUpdateDatafeed extends Generic { + datafeed_id: string; + body: any; +} + +export interface XpackMlUpdateFilter extends Generic { + filter_id: string; + body: any; +} + +export interface XpackMlUpdateJob extends Generic { + job_id: string; + body: any; +} + +export interface XpackMlUpdateModelSnapshot extends Generic { + job_id: string; + snapshot_id: string; + body: any; +} + +export interface XpackMlValidate extends Generic { + body: any; +} + +export interface XpackMlValidateDetector extends Generic { + body: any; +} + +export interface XpackMonitoringBulk extends Generic { + type?: string; + system_id?: string; + system_api_version?: string; + interval?: string; + body: any; +} + export interface XpackRollupDeleteJob extends Generic { id: string; } @@ -1942,7 +1801,6 @@ export interface XpackRollupRollupSearch extends Generic { index: string; type?: string; typed_keys?: boolean; - rest_total_hits_as_int?: boolean; body: any; } @@ -1956,6 +1814,111 @@ export interface XpackRollupStopJob extends Generic { timeout?: string; } +export interface XpackSecurityAuthenticate extends Generic { +} + +export interface XpackSecurityChangePassword extends Generic { + username?: string; + refresh?: 'true' | 'false' | 'wait_for'; + body: any; +} + +export interface XpackSecurityClearCachedRealms extends Generic { + realms: string | string[]; + usernames?: string | string[]; +} + +export interface XpackSecurityClearCachedRoles extends Generic { + name: string | string[]; +} + +export interface XpackSecurityDeletePrivileges extends Generic { + application: string; + name: string; + refresh?: 'true' | 'false' | 'wait_for'; +} + +export interface XpackSecurityDeleteRole extends Generic { + name: string; + refresh?: 'true' | 'false' | 'wait_for'; +} + +export interface XpackSecurityDeleteRoleMapping extends Generic { + name: string; + refresh?: 'true' | 'false' | 'wait_for'; +} + +export interface XpackSecurityDeleteUser extends Generic { + username: string; + refresh?: 'true' | 'false' | 'wait_for'; +} + +export interface XpackSecurityDisableUser extends Generic { + username?: string; + refresh?: 'true' | 'false' | 'wait_for'; +} + +export interface XpackSecurityEnableUser extends Generic { + username?: string; + refresh?: 'true' | 'false' | 'wait_for'; +} + +export interface XpackSecurityGetPrivileges extends Generic { + application?: string; + name?: string; +} + +export interface XpackSecurityGetRole extends Generic { + name?: string; +} + +export interface XpackSecurityGetRoleMapping extends Generic { + name?: string; +} + +export interface XpackSecurityGetToken extends Generic { + body: any; +} + +export interface XpackSecurityGetUser extends Generic { + username?: string | string[]; +} + +export interface XpackSecurityGetUserPrivileges extends Generic { +} + +export interface XpackSecurityHasPrivileges extends Generic { + user?: string; + body: any; +} + +export interface XpackSecurityInvalidateToken extends Generic { + body: any; +} + +export interface XpackSecurityPutPrivileges extends Generic { + refresh?: 'true' | 'false' | 'wait_for'; + body: any; +} + +export interface XpackSecurityPutRole extends Generic { + name: string; + refresh?: 'true' | 'false' | 'wait_for'; + body: any; +} + +export interface XpackSecurityPutRoleMapping extends Generic { + name: string; + refresh?: 'true' | 'false' | 'wait_for'; + body: any; +} + +export interface XpackSecurityPutUser extends Generic { + username: string; + refresh?: 'true' | 'false' | 'wait_for'; + body: any; +} + export interface XpackSqlClearCursor extends Generic { body: any; } @@ -1969,6 +1932,9 @@ export interface XpackSqlTranslate extends Generic { body: any; } +export interface XpackSslCertificates extends Generic { +} + export interface XpackUsage extends Generic { master_timeout?: string; } @@ -1976,18 +1942,22 @@ export interface XpackUsage extends Generic { export interface XpackWatcherAckWatch extends Generic { watch_id: string; action_id?: string | string[]; + master_timeout?: string; } export interface XpackWatcherActivateWatch extends Generic { watch_id: string; + master_timeout?: string; } export interface XpackWatcherDeactivateWatch extends Generic { watch_id: string; + master_timeout?: string; } export interface XpackWatcherDeleteWatch extends Generic { id: string; + master_timeout?: string; } export interface XpackWatcherExecuteWatch extends Generic { @@ -2002,13 +1972,15 @@ export interface XpackWatcherGetWatch extends Generic { export interface XpackWatcherPutWatch extends Generic { id: string; + master_timeout?: string; active?: boolean; version?: number; - if_seq_no?: number; - if_primary_term?: number; body?: any; } +export interface XpackWatcherRestart extends Generic { +} + export interface XpackWatcherStart extends Generic { }