From b19f0d5fc7d6bba6702dc99b4a09737e42bfe469 Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 19 Mar 2019 11:23:46 +0100 Subject: [PATCH] API generation --- api/api/bulk.js | 25 +- api/api/cat.aliases.js | 11 +- api/api/cat.allocation.js | 11 +- api/api/cat.count.js | 11 +- api/api/cat.fielddata.js | 11 +- api/api/cat.health.js | 11 +- api/api/cat.help.js | 11 +- api/api/cat.indices.js | 11 +- api/api/cat.master.js | 11 +- api/api/cat.nodeattrs.js | 11 +- api/api/cat.nodes.js | 11 +- api/api/cat.pending_tasks.js | 11 +- api/api/cat.plugins.js | 11 +- api/api/cat.recovery.js | 11 +- api/api/cat.repositories.js | 11 +- api/api/cat.segments.js | 11 +- api/api/cat.shards.js | 11 +- api/api/cat.snapshots.js | 17 +- api/api/cat.tasks.js | 14 +- api/api/cat.templates.js | 11 +- api/api/cat.thread_pool.js | 11 +- api/api/ccr.delete_auto_follow_pattern.js | 126 --- api/api/ccr.follow.js | 134 --- api/api/ccr.follow_info.js | 118 --- api/api/ccr.follow_stats.js | 118 --- api/api/ccr.get_auto_follow_pattern.js | 122 --- api/api/ccr.pause_follow.js | 126 --- api/api/ccr.put_auto_follow_pattern.js | 133 --- api/api/ccr.resume_follow.js | 127 --- api/api/ccr.stats.js | 117 --- api/api/ccr.unfollow.js | 126 --- api/api/clear_scroll.js | 11 +- api/api/cluster.allocation_explain.js | 11 +- api/api/cluster.get_settings.js | 11 +- api/api/cluster.health.js | 14 +- api/api/cluster.pending_tasks.js | 11 +- api/api/cluster.put_settings.js | 15 +- api/api/cluster.remote_info.js | 11 +- api/api/cluster.reroute.js | 11 +- api/api/cluster.state.js | 17 +- api/api/cluster.stats.js | 11 +- api/api/count.js | 14 +- .../{indices.freeze.js => count_percolate.js} | 83 +- api/api/create.js | 27 +- api/api/delete.js | 36 +- api/api/delete_by_query.js | 29 +- api/api/delete_by_query_rethrottle.js | 146 --- api/api/delete_script.js | 36 +- ...her.delete_watch.js => delete_template.js} | 30 +- api/api/exists.js | 35 +- api/api/exists_source.js | 35 +- api/api/explain.js | 35 +- api/api/field_caps.js | 18 +- ...ation.get_assistance.js => field_stats.js} | 43 +- api/api/get.js | 29 +- api/api/get_script.js | 39 +- api/api/get_source.js | 37 +- ...k.watcher.get_watch.js => get_template.js} | 30 +- api/api/ilm.delete_lifecycle.js | 126 --- api/api/ilm.explain_lifecycle.js | 127 --- api/api/ilm.get_lifecycle.js | 130 --- api/api/ilm.get_status.js | 125 --- api/api/ilm.move_to_step.js | 119 --- api/api/ilm.put_lifecycle.js | 119 --- api/api/ilm.remove_policy.js | 126 --- api/api/ilm.retry.js | 126 --- api/api/ilm.start.js | 125 --- api/api/ilm.stop.js | 125 --- api/api/index.js | 40 +- api/api/indices.analyze.js | 35 +- api/api/indices.clear_cache.js | 23 +- api/api/indices.close.js | 11 +- api/api/indices.create.js | 17 +- api/api/indices.delete.js | 20 +- api/api/indices.delete_alias.js | 11 +- api/api/indices.delete_template.js | 11 +- api/api/indices.exists.js | 11 +- api/api/indices.exists_alias.js | 17 +- api/api/indices.exists_template.js | 11 +- api/api/indices.exists_type.js | 11 +- api/api/indices.flush.js | 11 +- api/api/indices.flush_synced.js | 11 +- api/api/indices.forcemerge.js | 17 +- api/api/indices.get.js | 36 +- api/api/indices.get_alias.js | 11 +- api/api/indices.get_field_mapping.js | 14 +- api/api/indices.get_mapping.js | 17 +- api/api/indices.get_settings.js | 14 +- api/api/indices.get_template.js | 14 +- api/api/indices.get_upgrade.js | 11 +- api/api/indices.open.js | 14 +- api/api/indices.put_alias.js | 11 +- api/api/indices.put_mapping.js | 29 +- api/api/indices.put_settings.js | 13 +- api/api/indices.put_template.js | 14 +- api/api/indices.recovery.js | 11 +- api/api/indices.refresh.js | 11 +- api/api/indices.rollover.js | 14 +- api/api/indices.segments.js | 14 +- api/api/indices.shard_stores.js | 14 +- api/api/indices.shrink.js | 14 +- api/api/indices.split.js | 158 --- api/api/indices.stats.js | 11 +- api/api/indices.update_aliases.js | 11 +- api/api/indices.upgrade.js | 11 +- api/api/indices.validate_query.js | 14 +- api/api/info.js | 11 +- api/api/ingest.delete_pipeline.js | 11 +- api/api/ingest.get_pipeline.js | 11 +- api/api/ingest.processor_grok.js | 9 + api/api/ingest.put_pipeline.js | 11 +- api/api/ingest.simulate.js | 11 +- api/api/mget.js | 23 +- api/api/ml.close_job.js | 133 --- api/api/ml.delete_calendar.js | 132 --- api/api/ml.delete_calendar_event.js | 147 --- api/api/ml.delete_calendar_job.js | 147 --- api/api/ml.delete_datafeed.js | 133 --- api/api/ml.delete_expired_data.js | 125 --- api/api/ml.delete_filter.js | 132 --- api/api/ml.delete_forecast.js | 149 --- api/api/ml.delete_job.js | 135 --- api/api/ml.delete_model_snapshot.js | 147 --- api/api/ml.find_file_structure.js | 158 --- api/api/ml.flush_job.js | 138 --- api/api/ml.forecast.js | 135 --- api/api/ml.get_buckets.js | 159 --- api/api/ml.get_calendar_events.js | 142 --- api/api/ml.get_calendars.js | 133 --- api/api/ml.get_categories.js | 135 --- api/api/ml.get_datafeed_stats.js | 131 --- api/api/ml.get_datafeeds.js | 131 --- api/api/ml.get_filters.js | 133 --- api/api/ml.get_influencers.js | 144 --- api/api/ml.get_job_stats.js | 131 --- api/api/ml.get_jobs.js | 131 --- api/api/ml.get_model_snapshots.js | 151 --- api/api/ml.get_overall_buckets.js | 144 --- api/api/ml.get_records.js | 144 --- api/api/ml.info.js | 117 --- api/api/ml.open_job.js | 134 --- api/api/ml.post_calendar_events.js | 133 --- api/api/ml.post_data.js | 137 --- api/api/ml.preview_datafeed.js | 132 --- api/api/ml.put_calendar.js | 127 --- api/api/ml.put_calendar_job.js | 147 --- api/api/ml.put_datafeed.js | 133 --- api/api/ml.put_filter.js | 133 --- api/api/ml.put_job.js | 133 --- api/api/ml.revert_model_snapshot.js | 143 --- api/api/ml.set_upgrade_mode.js | 128 --- api/api/ml.start_datafeed.js | 132 --- api/api/ml.stop_datafeed.js | 132 --- api/api/ml.update_datafeed.js | 133 --- api/api/ml.update_filter.js | 133 --- api/api/ml.update_job.js | 133 --- api/api/ml.update_model_snapshot.js | 148 --- api/api/ml.validate.js | 126 --- api/api/ml.validate_detector.js | 126 --- api/api/monitoring.bulk.js | 138 --- .../{indices.unfreeze.js => mpercolate.js} | 62 +- api/api/msearch.js | 20 +- api/api/msearch_template.js | 17 +- api/api/mtermvectors.js | 11 +- api/api/nodes.hot_threads.js | 11 +- api/api/nodes.info.js | 11 +- api/api/nodes.reload_secure_settings.js | 137 --- api/api/nodes.stats.js | 11 +- api/api/nodes.usage.js | 142 --- api/api/percolate.js | 199 ++++ api/api/ping.js | 11 +- api/api/put_script.js | 35 +- ...pack.rollup.put_job.js => put_template.js} | 32 +- api/api/reindex.js | 11 +- api/api/reindex_rethrottle.js | 25 +- api/api/render_search_template.js | 11 +- api/api/scripts_painless_execute.js | 123 --- api/api/scroll.js | 14 +- api/api/search.js | 46 +- api/api/search_shards.js | 28 +- api/api/search_template.js | 24 +- api/api/security.authenticate.js | 125 --- api/api/security.change_password.js | 132 --- api/api/security.clear_cached_realms.js | 133 --- api/api/security.clear_cached_roles.js | 132 --- api/api/security.create_api_key.js | 127 --- api/api/security.delete_privileges.js | 148 --- api/api/security.delete_role.js | 133 --- api/api/security.delete_role_mapping.js | 133 --- api/api/security.delete_user.js | 133 --- api/api/security.disable_user.js | 127 --- api/api/security.enable_user.js | 127 --- api/api/security.get_api_key.js | 132 --- api/api/security.get_privileges.js | 141 --- api/api/security.get_role.js | 130 --- api/api/security.get_role_mapping.js | 130 --- api/api/security.get_token.js | 126 --- api/api/security.get_user.js | 130 --- api/api/security.get_user_privileges.js | 125 --- api/api/security.has_privileges.js | 131 --- api/api/security.invalidate_api_key.js | 126 --- api/api/security.invalidate_token.js | 126 --- api/api/security.put_privileges.js | 127 --- api/api/security.put_role.js | 134 --- api/api/security.put_role_mapping.js | 134 --- api/api/security.put_user.js | 134 --- api/api/snapshot.create.js | 11 +- api/api/snapshot.create_repository.js | 11 +- api/api/snapshot.delete.js | 11 +- api/api/snapshot.delete_repository.js | 11 +- api/api/snapshot.get.js | 11 +- api/api/snapshot.get_repository.js | 11 +- api/api/snapshot.restore.js | 11 +- api/api/snapshot.status.js | 11 +- api/api/snapshot.verify_repository.js | 11 +- api/api/ssl.certificates.js | 125 --- api/api/{rank_eval.js => suggest.js} | 31 +- api/api/tasks.cancel.js | 14 +- api/api/tasks.get.js | 19 +- api/api/tasks.list.js | 16 +- api/api/termvectors.js | 23 +- api/api/update.js | 52 +- api/api/update_by_query.js | 25 +- api/api/update_by_query_rethrottle.js | 146 --- api/api/xpack.graph.explore.js | 135 --- api/api/xpack.info.js | 126 --- api/api/xpack.license.delete.js | 125 --- api/api/xpack.license.get.js | 126 --- api/api/xpack.license.get_basic_status.js | 125 --- api/api/xpack.license.get_trial_status.js | 125 --- api/api/xpack.license.post.js | 119 --- api/api/xpack.license.post_start_basic.js | 126 --- api/api/xpack.license.post_start_trial.js | 128 --- api/api/xpack.migration.deprecations.js | 130 --- api/api/xpack.migration.upgrade.js | 127 --- api/api/xpack.rollup.delete_job.js | 126 --- api/api/xpack.rollup.get_jobs.js | 122 --- api/api/xpack.rollup.get_rollup_caps.js | 122 --- api/api/xpack.rollup.get_rollup_index_caps.js | 126 --- api/api/xpack.rollup.rollup_search.js | 150 --- api/api/xpack.rollup.start_job.js | 126 --- api/api/xpack.rollup.stop_job.js | 130 --- api/api/xpack.sql.clear_cursor.js | 126 --- api/api/xpack.sql.query.js | 127 --- api/api/xpack.sql.translate.js | 126 --- api/api/xpack.usage.js | 126 --- api/api/xpack.watcher.ack_watch.js | 145 --- api/api/xpack.watcher.activate_watch.js | 132 --- api/api/xpack.watcher.deactivate_watch.js | 132 --- api/api/xpack.watcher.execute_watch.js | 124 --- api/api/xpack.watcher.put_watch.js | 135 --- api/api/xpack.watcher.start.js | 125 --- api/api/xpack.watcher.stats.js | 133 --- api/api/xpack.watcher.stop.js | 125 --- api/index.js | 286 +---- api/requestParams.d.ts | 974 +++--------------- 256 files changed, 2094 insertions(+), 18640 deletions(-) delete mode 100644 api/api/ccr.delete_auto_follow_pattern.js delete mode 100644 api/api/ccr.follow.js delete mode 100644 api/api/ccr.follow_info.js delete mode 100644 api/api/ccr.follow_stats.js delete mode 100644 api/api/ccr.get_auto_follow_pattern.js delete mode 100644 api/api/ccr.pause_follow.js delete mode 100644 api/api/ccr.put_auto_follow_pattern.js delete mode 100644 api/api/ccr.resume_follow.js delete mode 100644 api/api/ccr.stats.js delete mode 100644 api/api/ccr.unfollow.js rename api/api/{indices.freeze.js => count_percolate.js} (56%) delete mode 100644 api/api/delete_by_query_rethrottle.js rename api/api/{xpack.watcher.delete_watch.js => delete_template.js} (81%) rename api/api/{xpack.migration.get_assistance.js => field_stats.js} (74%) rename api/api/{xpack.watcher.get_watch.js => get_template.js} (81%) delete mode 100644 api/api/ilm.delete_lifecycle.js delete mode 100644 api/api/ilm.explain_lifecycle.js delete mode 100644 api/api/ilm.get_lifecycle.js delete mode 100644 api/api/ilm.get_status.js delete mode 100644 api/api/ilm.move_to_step.js delete mode 100644 api/api/ilm.put_lifecycle.js delete mode 100644 api/api/ilm.remove_policy.js delete mode 100644 api/api/ilm.retry.js delete mode 100644 api/api/ilm.start.js delete mode 100644 api/api/ilm.stop.js delete mode 100644 api/api/indices.split.js delete mode 100644 api/api/ml.close_job.js delete mode 100644 api/api/ml.delete_calendar.js delete mode 100644 api/api/ml.delete_calendar_event.js delete mode 100644 api/api/ml.delete_calendar_job.js delete mode 100644 api/api/ml.delete_datafeed.js delete mode 100644 api/api/ml.delete_expired_data.js delete mode 100644 api/api/ml.delete_filter.js delete mode 100644 api/api/ml.delete_forecast.js delete mode 100644 api/api/ml.delete_job.js delete mode 100644 api/api/ml.delete_model_snapshot.js delete mode 100644 api/api/ml.find_file_structure.js delete mode 100644 api/api/ml.flush_job.js delete mode 100644 api/api/ml.forecast.js delete mode 100644 api/api/ml.get_buckets.js delete mode 100644 api/api/ml.get_calendar_events.js delete mode 100644 api/api/ml.get_calendars.js delete mode 100644 api/api/ml.get_categories.js delete mode 100644 api/api/ml.get_datafeed_stats.js delete mode 100644 api/api/ml.get_datafeeds.js delete mode 100644 api/api/ml.get_filters.js delete mode 100644 api/api/ml.get_influencers.js delete mode 100644 api/api/ml.get_job_stats.js delete mode 100644 api/api/ml.get_jobs.js delete mode 100644 api/api/ml.get_model_snapshots.js delete mode 100644 api/api/ml.get_overall_buckets.js delete mode 100644 api/api/ml.get_records.js delete mode 100644 api/api/ml.info.js delete mode 100644 api/api/ml.open_job.js delete mode 100644 api/api/ml.post_calendar_events.js delete mode 100644 api/api/ml.post_data.js delete mode 100644 api/api/ml.preview_datafeed.js delete mode 100644 api/api/ml.put_calendar.js delete mode 100644 api/api/ml.put_calendar_job.js delete mode 100644 api/api/ml.put_datafeed.js delete mode 100644 api/api/ml.put_filter.js delete mode 100644 api/api/ml.put_job.js delete mode 100644 api/api/ml.revert_model_snapshot.js delete mode 100644 api/api/ml.set_upgrade_mode.js delete mode 100644 api/api/ml.start_datafeed.js delete mode 100644 api/api/ml.stop_datafeed.js delete mode 100644 api/api/ml.update_datafeed.js delete mode 100644 api/api/ml.update_filter.js delete mode 100644 api/api/ml.update_job.js delete mode 100644 api/api/ml.update_model_snapshot.js delete mode 100644 api/api/ml.validate.js delete mode 100644 api/api/ml.validate_detector.js delete mode 100644 api/api/monitoring.bulk.js rename api/api/{indices.unfreeze.js => mpercolate.js} (69%) delete mode 100644 api/api/nodes.reload_secure_settings.js delete mode 100644 api/api/nodes.usage.js create mode 100644 api/api/percolate.js rename api/api/{xpack.rollup.put_job.js => put_template.js} (81%) delete mode 100644 api/api/scripts_painless_execute.js delete mode 100644 api/api/security.authenticate.js delete mode 100644 api/api/security.change_password.js delete mode 100644 api/api/security.clear_cached_realms.js delete mode 100644 api/api/security.clear_cached_roles.js delete mode 100644 api/api/security.create_api_key.js delete mode 100644 api/api/security.delete_privileges.js delete mode 100644 api/api/security.delete_role.js delete mode 100644 api/api/security.delete_role_mapping.js delete mode 100644 api/api/security.delete_user.js delete mode 100644 api/api/security.disable_user.js delete mode 100644 api/api/security.enable_user.js delete mode 100644 api/api/security.get_api_key.js delete mode 100644 api/api/security.get_privileges.js delete mode 100644 api/api/security.get_role.js delete mode 100644 api/api/security.get_role_mapping.js delete mode 100644 api/api/security.get_token.js delete mode 100644 api/api/security.get_user.js delete mode 100644 api/api/security.get_user_privileges.js delete mode 100644 api/api/security.has_privileges.js delete mode 100644 api/api/security.invalidate_api_key.js delete mode 100644 api/api/security.invalidate_token.js delete mode 100644 api/api/security.put_privileges.js delete mode 100644 api/api/security.put_role.js delete mode 100644 api/api/security.put_role_mapping.js delete mode 100644 api/api/security.put_user.js delete mode 100644 api/api/ssl.certificates.js rename api/api/{rank_eval.js => suggest.js} (81%) delete mode 100644 api/api/update_by_query_rethrottle.js delete mode 100644 api/api/xpack.graph.explore.js delete mode 100644 api/api/xpack.info.js delete mode 100644 api/api/xpack.license.delete.js delete mode 100644 api/api/xpack.license.get.js delete mode 100644 api/api/xpack.license.get_basic_status.js delete mode 100644 api/api/xpack.license.get_trial_status.js delete mode 100644 api/api/xpack.license.post.js delete mode 100644 api/api/xpack.license.post_start_basic.js delete mode 100644 api/api/xpack.license.post_start_trial.js delete mode 100644 api/api/xpack.migration.deprecations.js delete mode 100644 api/api/xpack.migration.upgrade.js delete mode 100644 api/api/xpack.rollup.delete_job.js delete mode 100644 api/api/xpack.rollup.get_jobs.js delete mode 100644 api/api/xpack.rollup.get_rollup_caps.js delete mode 100644 api/api/xpack.rollup.get_rollup_index_caps.js delete mode 100644 api/api/xpack.rollup.rollup_search.js delete mode 100644 api/api/xpack.rollup.start_job.js delete mode 100644 api/api/xpack.rollup.stop_job.js delete mode 100644 api/api/xpack.sql.clear_cursor.js delete mode 100644 api/api/xpack.sql.query.js delete mode 100644 api/api/xpack.sql.translate.js delete mode 100644 api/api/xpack.usage.js delete mode 100644 api/api/xpack.watcher.ack_watch.js delete mode 100644 api/api/xpack.watcher.activate_watch.js delete mode 100644 api/api/xpack.watcher.deactivate_watch.js delete mode 100644 api/api/xpack.watcher.execute_watch.js delete mode 100644 api/api/xpack.watcher.put_watch.js delete mode 100644 api/api/xpack.watcher.start.js delete mode 100644 api/api/xpack.watcher.stats.js delete mode 100644 api/api/xpack.watcher.stop.js diff --git a/api/api/bulk.js b/api/api/bulk.js index 0b802e073..1a8b6cdce 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -26,7 +26,7 @@ function buildBulk (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request + * Perform a [bulk](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-bulk.html) request * * @param {string} index - Default index for items which don't provide one * @param {string} type - Default document type for items which don't provide one @@ -35,9 +35,10 @@ 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 + * @param {list} _source_exclude - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request + * @param {list} _source_include - Default list of fields to extract and return from the _source field, can be overridden on each sub-request * @param {string} pipeline - The pipeline id to preprocess incoming documents with * @param {object} body - The operation definition and data (action-data pairs), separated by newlines */ @@ -48,9 +49,10 @@ function buildBulk (opts) { 'routing', 'timeout', 'type', + 'fields', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'pipeline', 'pretty', 'human', @@ -61,8 +63,8 @@ function buildBulk (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -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 89a1895e3..77a5def5c 100644 --- a/api/api/cat.aliases.js +++ b/api/api/cat.aliases.js @@ -26,7 +26,7 @@ function buildCatAliases (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request + * Perform a [cat.aliases](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-alias.html) request * * @param {list} name - A comma-separated list of alias names to return * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 5cabb6bc2..5637c89fe 100644 --- a/api/api/cat.allocation.js +++ b/api/api/cat.allocation.js @@ -26,7 +26,7 @@ function buildCatAllocation (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.allocation](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request + * Perform a [cat.allocation](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-allocation.html) request * * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 672fa7fc8..bbb07ab62 100644 --- a/api/api/cat.count.js +++ b/api/api/cat.count.js @@ -26,7 +26,7 @@ function buildCatCount (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.count](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request + * Perform a [cat.count](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-count.html) request * * @param {list} index - A comma-separated list of index names to limit the returned information * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 260716e58..7bf3f31d8 100644 --- a/api/api/cat.fielddata.js +++ b/api/api/cat.fielddata.js @@ -26,7 +26,7 @@ function buildCatFielddata (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.fielddata](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request + * Perform a [cat.fielddata](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-fielddata.html) request * * @param {list} fields - A comma-separated list of fields to return the fielddata size * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 2f1afd132..bab0fa5bd 100644 --- a/api/api/cat.health.js +++ b/api/api/cat.health.js @@ -26,7 +26,7 @@ function buildCatHealth (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request + * Perform a [cat.health](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-health.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) @@ -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 95e02b1c1..5adb752e9 100644 --- a/api/api/cat.help.js +++ b/api/api/cat.help.js @@ -26,7 +26,7 @@ function buildCatHelp (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.help](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html) request + * Perform a [cat.help](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat.html) request * * @param {boolean} help - Return help information * @param {list} s - Comma-separated list of column names or column aliases to sort by @@ -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 2ef3abf81..cf7fd57a2 100644 --- a/api/api/cat.indices.js +++ b/api/api/cat.indices.js @@ -26,7 +26,7 @@ function buildCatIndices (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.indices](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html) request + * Perform a [cat.indices](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-indices.html) request * * @param {list} index - A comma-separated list of index names to limit the returned information * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 7269fe2a0..45c1416b5 100644 --- a/api/api/cat.master.js +++ b/api/api/cat.master.js @@ -26,7 +26,7 @@ function buildCatMaster (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.master](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html) request + * Perform a [cat.master](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-master.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) @@ -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 45b5cfddc..46303baac 100644 --- a/api/api/cat.nodeattrs.js +++ b/api/api/cat.nodeattrs.js @@ -26,7 +26,7 @@ function buildCatNodeattrs (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.nodeattrs](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html) request + * Perform a [cat.nodeattrs](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-nodeattrs.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) @@ -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 dbaeee193..73b25b62a 100644 --- a/api/api/cat.nodes.js +++ b/api/api/cat.nodes.js @@ -26,7 +26,7 @@ function buildCatNodes (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.nodes](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html) request + * Perform a [cat.nodes](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-nodes.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {boolean} full_id - Return the full node ID instead of the shortened version (default: false) @@ -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 9e8ea4594..8ad2cc841 100644 --- a/api/api/cat.pending_tasks.js +++ b/api/api/cat.pending_tasks.js @@ -26,7 +26,7 @@ function buildCatPendingTasks (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html) request + * Perform a [cat.pending_tasks](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-pending-tasks.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) @@ -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 89cc30946..a085d52a0 100644 --- a/api/api/cat.plugins.js +++ b/api/api/cat.plugins.js @@ -26,7 +26,7 @@ function buildCatPlugins (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.plugins](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html) request + * Perform a [cat.plugins](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-plugins.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) @@ -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 3aa01d012..3ea17a2b2 100644 --- a/api/api/cat.recovery.js +++ b/api/api/cat.recovery.js @@ -26,7 +26,7 @@ function buildCatRecovery (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html) request + * Perform a [cat.recovery](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-recovery.html) request * * @param {list} index - A comma-separated list of index names to limit the returned information * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 4eaaa7061..00872d7b2 100644 --- a/api/api/cat.repositories.js +++ b/api/api/cat.repositories.js @@ -26,7 +26,7 @@ function buildCatRepositories (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.repositories](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html) request + * Perform a [cat.repositories](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-repositories.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {boolean} local - Return local information, do not retrieve the state from master node @@ -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 5dcf86df4..7a35b5f60 100644 --- a/api/api/cat.segments.js +++ b/api/api/cat.segments.js @@ -26,7 +26,7 @@ function buildCatSegments (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html) request + * Perform a [cat.segments](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-segments.html) request * * @param {list} index - A comma-separated list of index names to limit the returned information * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 703536170..5d530dea9 100644 --- a/api/api/cat.shards.js +++ b/api/api/cat.shards.js @@ -26,7 +26,7 @@ function buildCatShards (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html) request + * Perform a [cat.shards](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-shards.html) request * * @param {list} index - A comma-separated list of index names to limit the returned information * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 292c688e2..4bef1a98b 100644 --- a/api/api/cat.snapshots.js +++ b/api/api/cat.snapshots.js @@ -26,7 +26,7 @@ function buildCatSnapshots (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html) request + * Perform a [cat.snapshots](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-snapshots.html) request * * @param {list} repository - Name of repository from which to fetch the snapshot information * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -72,7 +72,22 @@ 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['repository'] == null) { + return callback( + new ConfigurationError('Missing required parameter: repository'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), diff --git a/api/api/cat.tasks.js b/api/api/cat.tasks.js index c38e6d28b..be8c8a372 100644 --- a/api/api/cat.tasks.js +++ b/api/api/cat.tasks.js @@ -26,12 +26,13 @@ function buildCatTasks (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request + * Perform a [cat.tasks](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tasks.html) request * * @param {string} format - a short version of the Accept header, e.g. json, yaml * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all. * @param {boolean} detailed - Return detailed task information (default: false) + * @param {string} parent_node - Return tasks with specified parent node. * @param {number} parent_task - Return tasks with specified parent task id. Set to -1 to return all. * @param {list} h - Comma-separated list of column names to display * @param {boolean} help - Return help information @@ -44,6 +45,7 @@ function buildCatTasks (opts) { 'node_id', 'actions', 'detailed', + 'parent_node', 'parent_task', 'h', 'help', @@ -58,6 +60,7 @@ function buildCatTasks (opts) { const snakeCase = { nodeId: 'node_id', + parentNode: 'parent_node', parentTask: 'parent_task', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -75,6 +78,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 312aa06c0..36dcc45d5 100644 --- a/api/api/cat.templates.js +++ b/api/api/cat.templates.js @@ -26,7 +26,7 @@ function buildCatTemplates (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.templates](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html) request + * Perform a [cat.templates](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-templates.html) request * * @param {string} name - A pattern that returned template names must match * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 e3d67271e..5b7356042 100644 --- a/api/api/cat.thread_pool.js +++ b/api/api/cat.thread_pool.js @@ -26,7 +26,7 @@ function buildCatThreadPool (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cat.thread_pool](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request + * Perform a [cat.thread_pool](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cat-thread-pool.html) request * * @param {list} thread_pool_patterns - A comma-separated list of regular-expressions to filter the thread pools in the output * @param {string} format - a short version of the Accept header, e.g. json, yaml @@ -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 deleted file mode 100644 index 68953cf75..000000000 --- a/api/api/ccr.delete_auto_follow_pattern.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 buildCcrDeleteAutoFollowPattern (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.delete_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html) request - * - * @param {string} name - The name of the auto follow pattern. - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrDeleteAutoFollowPattern (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['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - 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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name) - - // 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, - querystring: options.querystring || 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 = buildCcrDeleteAutoFollowPattern diff --git a/api/api/ccr.follow.js b/api/api/ccr.follow.js deleted file mode 100644 index c304598e1..000000000 --- a/api/api/ccr.follow.js +++ /dev/null @@ -1,134 +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 buildCcrFollow (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = 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) { - options = options || {} - if (typeof options === 'function') { - callback = options - options = {} - } - if (typeof params === 'function' || params == null) { - callback = params - params = {} - options = {} - } - - // check required parameters - if (params['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - result - ) - } - 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, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'follow' - - // 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, - querystring: options.querystring || 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 = buildCcrFollow diff --git a/api/api/ccr.follow_info.js b/api/api/ccr.follow_info.js deleted file mode 100644 index e2568c08f..000000000 --- a/api/api/ccr.follow_info.js +++ /dev/null @@ -1,118 +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, - querystring: options.querystring || 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 deleted file mode 100644 index 5517bdf6a..000000000 --- a/api/api/ccr.follow_stats.js +++ /dev/null @@ -1,118 +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 buildCcrFollowStats (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.follow_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.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 ccrFollowStats (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' + '/' + 'stats' - - // 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, - querystring: options.querystring || 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 = buildCcrFollowStats diff --git a/api/api/ccr.get_auto_follow_pattern.js b/api/api/ccr.get_auto_follow_pattern.js deleted file mode 100644 index 12ebea4ad..000000000 --- a/api/api/ccr.get_auto_follow_pattern.js +++ /dev/null @@ -1,122 +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 buildCcrGetAutoFollowPattern (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.get_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html) request - * - * @param {string} name - The name of the auto follow pattern. - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrGetAutoFollowPattern (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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((name) != null) { - path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name) - } else { - path = '/' + '_ccr' + '/' + 'auto_follow' - } - - // 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, - querystring: options.querystring || 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 = buildCcrGetAutoFollowPattern diff --git a/api/api/ccr.pause_follow.js b/api/api/ccr.pause_follow.js deleted file mode 100644 index e2ec7e107..000000000 --- a/api/api/ccr.pause_follow.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 buildCcrPauseFollow (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.pause_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html) request - * - * @param {string} index - The name of the follower index that should pause following its leader index. - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrPauseFollow (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['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - 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, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'pause_follow' - - // 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, - querystring: options.querystring || 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 = buildCcrPauseFollow diff --git a/api/api/ccr.put_auto_follow_pattern.js b/api/api/ccr.put_auto_follow_pattern.js deleted file mode 100644 index 751ffbaef..000000000 --- a/api/api/ccr.put_auto_follow_pattern.js +++ /dev/null @@ -1,133 +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 buildCcrPutAutoFollowPattern (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.put_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html) request - * - * @param {string} name - The name of the auto follow pattern. - * @param {object} body - The specification of the auto follow pattern - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrPutAutoFollowPattern (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['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) - } - 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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name) - - // 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, - querystring: options.querystring || 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 = buildCcrPutAutoFollowPattern diff --git a/api/api/ccr.resume_follow.js b/api/api/ccr.resume_follow.js deleted file mode 100644 index 56f794228..000000000 --- a/api/api/ccr.resume_follow.js +++ /dev/null @@ -1,127 +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 buildCcrResumeFollow (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.resume_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html) request - * - * @param {string} index - The name of the follow index to resume following. - * @param {object} body - The name of the leader index and other optional ccr related parameters - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrResumeFollow (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['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - 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, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'resume_follow' - - // 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, - querystring: options.querystring || 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 = buildCcrResumeFollow diff --git a/api/api/ccr.stats.js b/api/api/ccr.stats.js deleted file mode 100644 index 62c5f77e3..000000000 --- a/api/api/ccr.stats.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 buildCcrStats (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrStats (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 } = 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 = '/' + '_ccr' + '/' + 'stats' - - // 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, - querystring: options.querystring || 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 = buildCcrStats diff --git a/api/api/ccr.unfollow.js b/api/api/ccr.unfollow.js deleted file mode 100644 index ed1dae36c..000000000 --- a/api/api/ccr.unfollow.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 buildCcrUnfollow (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ccr.unfollow](http://www.elastic.co/guide/en/elasticsearch/reference/current) request - * - * @param {string} index - The name of the follower index that should be turned into a regular index. - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ccrUnfollow (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['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - 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, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'unfollow' - - // 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, - querystring: options.querystring || 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 = buildCcrUnfollow diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 0f1cab1fd..a2ece726e 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -26,7 +26,7 @@ function buildClearScroll (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request + * Perform a [clear_scroll](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-request-scroll.html) request * * @param {list} scroll_id - A comma-separated list of scroll IDs to clear * @param {object} body - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter @@ -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 db63a40f8..8bf8c14ff 100644 --- a/api/api/cluster.allocation_explain.js +++ b/api/api/cluster.allocation_explain.js @@ -26,7 +26,7 @@ function buildClusterAllocationExplain (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.allocation_explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html) request + * Perform a [cluster.allocation_explain](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-allocation-explain.html) request * * @param {boolean} include_yes_decisions - Return 'YES' decisions in explanation (default: false) * @param {boolean} include_disk_info - Return information about disk usage and shard sizes (default: false) @@ -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 2a388a99b..61be07e83 100644 --- a/api/api/cluster.get_settings.js +++ b/api/api/cluster.get_settings.js @@ -26,7 +26,7 @@ function buildClusterGetSettings (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request + * Perform a [cluster.get_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-update-settings.html) request * * @param {boolean} flat_settings - Return settings in flat format (default: false) * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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 4c137c444..7b4bc8555 100644 --- a/api/api/cluster.health.js +++ b/api/api/cluster.health.js @@ -26,7 +26,7 @@ function buildClusterHealth (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request + * Perform a [cluster.health](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-health.html) request * * @param {list} index - Limit the information returned to a specific index * @param {enum} level - Specify the level of detail for returned information @@ -37,7 +37,6 @@ function buildClusterHealth (opts) { * @param {string} wait_for_nodes - Wait until the specified number of nodes is available * @param {enum} wait_for_events - Wait until all currently queued events with the given priority are processed * @param {boolean} wait_for_no_relocating_shards - Whether to wait until there are no relocating shards in the cluster - * @param {boolean} wait_for_no_initializing_shards - Whether to wait until there are no initializing shards in the cluster * @param {enum} wait_for_status - Wait until cluster is in a specific state */ @@ -50,7 +49,6 @@ function buildClusterHealth (opts) { 'wait_for_nodes', 'wait_for_events', 'wait_for_no_relocating_shards', - 'wait_for_no_initializing_shards', 'wait_for_status', 'pretty', 'human', @@ -65,7 +63,6 @@ function buildClusterHealth (opts) { waitForNodes: 'wait_for_nodes', waitForEvents: 'wait_for_events', waitForNoRelocatingShards: 'wait_for_no_relocating_shards', - waitForNoInitializingShards: 'wait_for_no_initializing_shards', waitForStatus: 'wait_for_status', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -83,6 +80,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 808365927..a06ee2272 100644 --- a/api/api/cluster.pending_tasks.js +++ b/api/api/cluster.pending_tasks.js @@ -26,7 +26,7 @@ function buildClusterPendingTasks (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html) request + * Perform a [cluster.pending_tasks](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-pending.html) request * * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) * @param {time} master_timeout - Specify timeout for connection to master @@ -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 41e5306b4..f438a1931 100644 --- a/api/api/cluster.put_settings.js +++ b/api/api/cluster.put_settings.js @@ -26,7 +26,7 @@ function buildClusterPutSettings (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request + * Perform a [cluster.put_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-update-settings.html) request * * @param {boolean} flat_settings - Return settings in flat format (default: false) * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -64,12 +64,13 @@ function buildClusterPutSettings (opts) { options = {} } - // check required parameters - if (params['body'] == null) { - return callback( - new ConfigurationError('Missing required parameter: body'), - result - ) + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + clusterPutSettings(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) } // validate headers object diff --git a/api/api/cluster.remote_info.js b/api/api/cluster.remote_info.js index 882857680..7bcefae45 100644 --- a/api/api/cluster.remote_info.js +++ b/api/api/cluster.remote_info.js @@ -26,7 +26,7 @@ function buildClusterRemoteInfo (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html) request + * Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-remote-info.html) request * */ @@ -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 36f410dbf..bd661cca2 100644 --- a/api/api/cluster.reroute.js +++ b/api/api/cluster.reroute.js @@ -26,7 +26,7 @@ function buildClusterReroute (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.reroute](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html) request + * Perform a [cluster.reroute](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-reroute.html) request * * @param {boolean} dry_run - Simulate the operation only and return the resulting state * @param {boolean} explain - Return an explanation of why the commands can or cannot be executed @@ -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 2994f933d..0d7e22f1c 100644 --- a/api/api/cluster.state.js +++ b/api/api/cluster.state.js @@ -26,15 +26,13 @@ function buildClusterState (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request + * Perform a [cluster.state](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-state.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {list} metric - Limit the information returned to the specified metrics * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) * @param {time} master_timeout - Specify timeout for connection to master * @param {boolean} flat_settings - Return settings in flat format (default: false) - * @param {number} wait_for_metadata_version - Wait for the metadata version to be equal or greater than the specified metadata version - * @param {time} wait_for_timeout - The maximum time to wait for wait_for_metadata_version before timing out * @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. @@ -44,8 +42,6 @@ function buildClusterState (opts) { 'local', 'master_timeout', 'flat_settings', - 'wait_for_metadata_version', - 'wait_for_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', @@ -59,8 +55,6 @@ function buildClusterState (opts) { const snakeCase = { masterTimeout: 'master_timeout', flatSettings: 'flat_settings', - waitForMetadataVersion: 'wait_for_metadata_version', - waitForTimeout: 'wait_for_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', @@ -80,6 +74,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 4e47179db..7b44e71ae 100644 --- a/api/api/cluster.stats.js +++ b/api/api/cluster.stats.js @@ -26,7 +26,7 @@ function buildClusterStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [cluster.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html) request + * Perform a [cluster.stats](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-stats.html) request * * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {boolean} flat_settings - Return settings in flat format (default: false) @@ -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 707526fbc..d0684d8d5 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -26,12 +26,11 @@ function buildCount (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [count](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html) request + * Perform a [count](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-count.html) request * * @param {list} index - A comma-separated list of indices to restrict the results * @param {list} type - A comma-separated list of types to restrict the results * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) - * @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled * @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 {number} min_score - Include only documents with a specific `_score` value in the result @@ -49,7 +48,6 @@ function buildCount (opts) { const acceptedQuerystring = [ 'ignore_unavailable', - 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', @@ -71,7 +69,6 @@ function buildCount (opts) { const snakeCase = { ignoreUnavailable: 'ignore_unavailable', - ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', minScore: 'min_score', @@ -94,6 +91,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/indices.freeze.js b/api/api/count_percolate.js similarity index 56% rename from api/api/indices.freeze.js rename to api/api/count_percolate.js index ac0a26a17..555b45766 100644 --- a/api/api/indices.freeze.js +++ b/api/api/count_percolate.js @@ -22,39 +22,56 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildIndicesFreeze (opts) { +function buildCountPercolate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.freeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request + * Perform a [count_percolate](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-percolate.html) request * - * @param {string} index - The name of the index to freeze - * @param {time} timeout - Explicit operation timeout - * @param {time} master_timeout - Specify timeout for connection to master + * @param {string} index - The index of the document being count percolated. + * @param {string} type - The type of the document being count percolated. + * @param {string} id - Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster. + * @param {list} routing - A comma-separated list of specific routing values + * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @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 {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns. + * @param {string} percolate_index - The index to count percolate the document into. Defaults to index. + * @param {string} percolate_type - The type to count percolate document into. Defaults to type. + * @param {number} version - Explicit version number for concurrency control + * @param {enum} version_type - Specific version type + * @param {object} body - The count percolator request definition using the percolate DSL */ const acceptedQuerystring = [ - 'timeout', - 'master_timeout', + 'routing', + 'preference', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'wait_for_active_shards' + 'percolate_index', + 'percolate_type', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ] const snakeCase = { - masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', - waitForActiveShards: 'wait_for_active_shards' + percolateIndex: 'percolate_index', + percolateType: 'percolate_type', + versionType: 'version_type', + errorTrace: 'error_trace', + filterPath: 'filter_path' } - return function indicesFreeze (params, options, callback) { + return function countPercolate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -66,6 +83,15 @@ function buildIndicesFreeze (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + countPercolate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['index'] == null) { return callback( @@ -73,9 +99,22 @@ function buildIndicesFreeze (opts) { result ) } - if (params.body != null) { + if (params['type'] == null) { return callback( - new ConfigurationError('This API does not require a body'), + new ConfigurationError('Missing required parameter: type'), + result + ) + } + + // check required url components + 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 ) } @@ -89,11 +128,11 @@ function buildIndicesFreeze (opts) { } var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var { method, body, index, type, id } = params + var querystring = semicopy(params, ['method', 'body', 'index', 'type', 'id']) if (method == null) { - method = 'POST' + method = body == null ? 'GET' : 'POST' } var ignore = options.ignore || null @@ -103,13 +142,17 @@ function buildIndicesFreeze (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_freeze' + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_percolate' + '/' + 'count' + } else { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_percolate' + '/' + 'count' + } // build request object const request = { method, path, - body: '', + body: body || '', querystring } @@ -144,4 +187,4 @@ function buildIndicesFreeze (opts) { } } -module.exports = buildIndicesFreeze +module.exports = buildCountPercolate diff --git a/api/api/create.js b/api/api/create.js index d775805e3..65c0e6461 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -26,7 +26,7 @@ function buildCreate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [create](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request + * Perform a [create](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-index_.html) request * * @param {string} id - Document ID * @param {string} index - The name of the index @@ -36,6 +36,8 @@ function buildCreate (opts) { * @param {enum} refresh - If `true` 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` (the default) then do nothing with refreshes. * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout + * @param {time} timestamp - Explicit timestamp for the document + * @param {time} ttl - Expiration time for the document * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type * @param {string} pipeline - The pipeline id to preprocess incoming documents with @@ -48,6 +50,8 @@ function buildCreate (opts) { 'refresh', 'routing', 'timeout', + 'timestamp', + 'ttl', 'version', 'version_type', 'pipeline', @@ -77,6 +81,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 +103,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 +139,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 a46f08723..9fd0565ee 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -26,7 +26,7 @@ function buildDelete (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html) request + * Perform a [delete](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete.html) request * * @param {string} id - The document ID * @param {string} index - The name of the index @@ -36,8 +36,6 @@ function buildDelete (opts) { * @param {enum} refresh - If `true` then refresh the effected 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` (the default) then do nothing with refreshes. * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout - * @param {number} if_seq_no - only perform the delete operation if the last operation that has changed the document has the specified sequence number - * @param {number} if_primary_term - only perform the delete 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 */ @@ -48,8 +46,6 @@ function buildDelete (opts) { 'refresh', 'routing', 'timeout', - 'if_seq_no', - 'if_primary_term', 'version', 'version_type', 'pretty', @@ -61,8 +57,6 @@ function buildDelete (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', - ifSeqNo: 'if_seq_no', - ifPrimaryTerm: 'if_primary_term', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -80,6 +74,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 +96,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 +110,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 +145,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 8abdc65d4..888908c3d 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -26,7 +26,7 @@ function buildDeleteByQuery (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request + * Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete-by-query.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -37,7 +37,7 @@ function buildDeleteByQuery (opts) { * @param {number} from - Starting offset (default: 0) * @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} conflicts - What to do when the delete by query hits version conflicts? + * @param {enum} conflicts - What to do when the delete-by-query hits version conflicts? * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) @@ -49,8 +49,8 @@ function buildDeleteByQuery (opts) { * @param {number} size - Number of hits to return (default: 10) * @param {list} sort - A comma-separated list of : pairs * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} terminate_after - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. * @param {list} stats - Specific 'tag' of the request for logging and statistical purposes * @param {boolean} version - Specify whether to return document version as part of a hit @@ -58,8 +58,8 @@ function buildDeleteByQuery (opts) { * @param {boolean} refresh - Should the effected indexes be refreshed? * @param {time} timeout - Time each individual bulk request should wait for shards that are unavailable. * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the delete by query 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 {number} scroll_size - Size on the scroll request powering the delete by query - * @param {boolean} wait_for_completion - Should the request should block until the delete by query is complete. + * @param {number} scroll_size - Size on the scroll request powering the update_by_query + * @param {boolean} wait_for_completion - Should the request should block until the delete-by-query is complete. * @param {number} requests_per_second - The throttle for this request in sub-requests per second. -1 means no throttle. * @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. * @param {object} body - The search definition using the Query DSL @@ -85,8 +85,8 @@ function buildDeleteByQuery (opts) { 'size', 'sort', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'terminate_after', 'stats', 'version', @@ -113,8 +113,8 @@ function buildDeleteByQuery (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', @@ -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 deleted file mode 100644 index e2003517b..000000000 --- a/api/api/delete_by_query_rethrottle.js +++ /dev/null @@ -1,146 +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 buildDeleteByQueryRethrottle (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [delete_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html) request - * - * @param {string} task_id - The task id to rethrottle - * @param {number} requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. - */ - - const acceptedQuerystring = [ - 'requests_per_second', - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ] - - const snakeCase = { - requestsPerSecond: 'requests_per_second', - errorTrace: 'error_trace', - filterPath: 'filter_path' - } - - return function deleteByQueryRethrottle (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['task_id'] == null && params['taskId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: task_id or taskId'), - result - ) - } - if (params['requests_per_second'] == null && params['requestsPerSecond'] == null) { - return callback( - new ConfigurationError('Missing required parameter: requests_per_second or requestsPerSecond'), - result - ) - } - 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, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_delete_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildDeleteByQueryRethrottle diff --git a/api/api/delete_script.js b/api/api/delete_script.js index 3032c3274..7d4faadd4 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -26,9 +26,10 @@ function buildDeleteScript (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [delete_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request + * Perform a [delete_script](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-scripting.html) request * * @param {string} id - Script ID + * @param {string} lang - Script language * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master */ @@ -61,6 +62,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( @@ -68,6 +78,12 @@ function buildDeleteScript (opts) { result ) } + if (params['lang'] == null) { + return callback( + new ConfigurationError('Missing required parameter: lang'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), @@ -75,6 +91,14 @@ function buildDeleteScript (opts) { ) } + // check required url components + if (params['id'] != null && (params['lang'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: lang'), + result + ) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -84,8 +108,8 @@ function buildDeleteScript (opts) { } var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var { method, body, id, lang } = params + var querystring = semicopy(params, ['method', 'body', 'id', 'lang']) if (method == null) { method = 'DELETE' @@ -98,7 +122,11 @@ function buildDeleteScript (opts) { var path = '' - path = '/' + '_scripts' + '/' + encodeURIComponent(id) + if ((lang) != null && (id) != null) { + path = '/' + '_scripts' + '/' + encodeURIComponent(lang) + '/' + encodeURIComponent(id) + } else { + path = '/' + '_scripts' + '/' + encodeURIComponent(lang) + } // build request object const request = { diff --git a/api/api/xpack.watcher.delete_watch.js b/api/api/delete_template.js similarity index 81% rename from api/api/xpack.watcher.delete_watch.js rename to api/api/delete_template.js index d718a1201..48e884503 100644 --- a/api/api/xpack.watcher.delete_watch.js +++ b/api/api/delete_template.js @@ -22,24 +22,29 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherDeleteWatch (opts) { +function buildDeleteTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [xpack.watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request + * Perform a [delete_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-template.html) request * - * @param {string} id - Watch ID + * @param {string} id - Template ID */ const acceptedQuerystring = [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ] const snakeCase = { - + errorTrace: 'error_trace', + filterPath: 'filter_path' } - return function xpackWatcherDeleteWatch (params, options, callback) { + return function deleteTemplate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +56,15 @@ function buildXpackWatcherDeleteWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + deleteTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -88,7 +102,7 @@ function buildXpackWatcherDeleteWatch (opts) { var path = '' - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + path = '/' + '_search' + '/' + 'template' + '/' + encodeURIComponent(id) // build request object const request = { @@ -129,4 +143,4 @@ function buildXpackWatcherDeleteWatch (opts) { } } -module.exports = buildXpackWatcherDeleteWatch +module.exports = buildDeleteTemplate diff --git a/api/api/exists.js b/api/api/exists.js index 723eef705..4159b1763 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -26,7 +26,7 @@ function buildExists (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request + * Perform a [exists](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html) request * * @param {string} id - The document ID * @param {string} index - The name of the index @@ -38,8 +38,8 @@ function buildExists (opts) { * @param {boolean} refresh - Refresh the shard containing the document before performing the operation * @param {string} routing - Specific routing value * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type */ @@ -52,8 +52,8 @@ function buildExists (opts) { 'refresh', 'routing', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'version', 'version_type', 'pretty', @@ -65,8 +65,8 @@ function buildExists (opts) { const snakeCase = { storedFields: 'stored_fields', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -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 70abafbbb..164c2ba25 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -30,15 +30,15 @@ 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 * @param {boolean} refresh - Refresh the shard containing the document before performing the operation * @param {string} routing - Specific routing value * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type */ @@ -50,8 +50,8 @@ function buildExistsSource (opts) { 'refresh', 'routing', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'version', 'version_type', 'pretty', @@ -62,8 +62,8 @@ function buildExistsSource (opts) { ] const snakeCase = { - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -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 04b4bddad..c0b22753a 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -26,7 +26,7 @@ function buildExplain (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html) request + * Perform a [explain](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-explain.html) request * * @param {string} id - The document ID * @param {string} index - The name of the index @@ -42,8 +42,8 @@ function buildExplain (opts) { * @param {string} q - Query in the Lucene query string syntax * @param {string} routing - Specific routing value * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {object} body - The query definition using the Query DSL */ @@ -59,8 +59,8 @@ function buildExplain (opts) { 'q', 'routing', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'pretty', 'human', 'error_trace', @@ -72,8 +72,8 @@ function buildExplain (opts) { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', storedFields: 'stored_fields', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -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 df9ea43fe..2501c81b8 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -26,13 +26,14 @@ function buildFieldCaps (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html) request + * Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-field-caps.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {list} fields - A comma-separated list of field names * @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/xpack.migration.get_assistance.js b/api/api/field_stats.js similarity index 74% rename from api/api/xpack.migration.get_assistance.js rename to api/api/field_stats.js index 9eb209743..a13006ccb 100644 --- a/api/api/xpack.migration.get_assistance.js +++ b/api/api/field_stats.js @@ -22,31 +22,43 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackMigrationGetAssistance (opts) { +function buildFieldStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [xpack.migration.get_assistance](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html) request + * Perform a [field_stats](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-field-stats.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {list} fields - A comma-separated list of fields for to get field statistics for (min value, max value, and more) + * @param {enum} level - Defines if field stats should be returned on a per index level or on a cluster wide level + * @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} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {object} body - Field json objects containing the name and optionally a range to filter out indices result, that have results outside the defined bounds */ const acceptedQuerystring = [ + 'fields', + 'level', + 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'ignore_unavailable' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ] const snakeCase = { + ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', - ignoreUnavailable: 'ignore_unavailable' + errorTrace: 'error_trace', + filterPath: 'filter_path' } - return function xpackMigrationGetAssistance (params, options, callback) { + return function fieldStats (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -58,6 +70,15 @@ function buildXpackMigrationGetAssistance (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + fieldStats(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -71,7 +92,7 @@ function buildXpackMigrationGetAssistance (opts) { var querystring = semicopy(params, ['method', 'body', 'index']) if (method == null) { - method = 'GET' + method = body == null ? 'GET' : 'POST' } var ignore = options.ignore || null @@ -82,16 +103,16 @@ function buildXpackMigrationGetAssistance (opts) { var path = '' if ((index) != null) { - path = '/' + '_migration' + '/' + 'assistance' + '/' + encodeURIComponent(index) + path = '/' + encodeURIComponent(index) + '/' + '_field_stats' } else { - path = '/' + '_migration' + '/' + 'assistance' + path = '/' + '_field_stats' } // build request object const request = { method, path, - body: null, + body: body || '', querystring } @@ -126,4 +147,4 @@ function buildXpackMigrationGetAssistance (opts) { } } -module.exports = buildXpackMigrationGetAssistance +module.exports = buildFieldStats diff --git a/api/api/get.js b/api/api/get.js index b6f2b6ca9..e3488c02c 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -26,7 +26,7 @@ function buildGet (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [get](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request + * Perform a [get](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html) request * * @param {string} id - The document ID * @param {string} index - The name of the index @@ -38,8 +38,6 @@ function buildGet (opts) { * @param {boolean} refresh - Refresh the shard containing the document before performing the operation * @param {string} routing - Specific routing value * @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 * @param {list} _source_exclude - A list of fields to exclude from the returned _source field * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} version - Explicit version number for concurrency control @@ -54,8 +52,6 @@ function buildGet (opts) { 'refresh', 'routing', '_source', - '_source_excludes', - '_source_includes', '_source_exclude', '_source_include', 'version', @@ -69,8 +65,6 @@ function buildGet (opts) { const snakeCase = { storedFields: 'stored_fields', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', _sourceExclude: '_source_exclude', _sourceInclude: '_source_include', versionType: 'version_type', @@ -90,6 +84,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 +106,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 +142,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 016bad224..664765d9b 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -26,14 +26,13 @@ function buildGetScript (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [get_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request + * Perform a [get_script](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-scripting.html) request * * @param {string} id - Script ID - * @param {time} master_timeout - Specify timeout for connection to master + * @param {string} lang - Script language */ const acceptedQuerystring = [ - 'master_timeout', 'pretty', 'human', 'error_trace', @@ -42,7 +41,6 @@ function buildGetScript (opts) { ] const snakeCase = { - masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -59,6 +57,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( @@ -66,6 +73,12 @@ function buildGetScript (opts) { result ) } + if (params['lang'] == null) { + return callback( + new ConfigurationError('Missing required parameter: lang'), + result + ) + } if (params.body != null) { return callback( new ConfigurationError('This API does not require a body'), @@ -73,6 +86,14 @@ function buildGetScript (opts) { ) } + // check required url components + if (params['id'] != null && (params['lang'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: lang'), + result + ) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -82,8 +103,8 @@ function buildGetScript (opts) { } var warnings = null - var { method, body, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) + var { method, body, id, lang } = params + var querystring = semicopy(params, ['method', 'body', 'id', 'lang']) if (method == null) { method = 'GET' @@ -96,7 +117,11 @@ function buildGetScript (opts) { var path = '' - path = '/' + '_scripts' + '/' + encodeURIComponent(id) + if ((lang) != null && (id) != null) { + path = '/' + '_scripts' + '/' + encodeURIComponent(lang) + '/' + encodeURIComponent(id) + } else { + path = '/' + '_scripts' + '/' + encodeURIComponent(lang) + } // build request object const request = { diff --git a/api/api/get_source.js b/api/api/get_source.js index e9bbf46c4..85146d5db 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -26,19 +26,19 @@ function buildGetSource (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [get_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request + * Perform a [get_source](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-get.html) request * * @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 * @param {boolean} refresh - Refresh the shard containing the document before performing the operation * @param {string} routing - Specific routing value * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type */ @@ -50,8 +50,8 @@ function buildGetSource (opts) { 'refresh', 'routing', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'version', 'version_type', 'pretty', @@ -62,8 +62,8 @@ function buildGetSource (opts) { ] const snakeCase = { - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -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/xpack.watcher.get_watch.js b/api/api/get_template.js similarity index 81% rename from api/api/xpack.watcher.get_watch.js rename to api/api/get_template.js index dc25bc471..9d3df8448 100644 --- a/api/api/xpack.watcher.get_watch.js +++ b/api/api/get_template.js @@ -22,24 +22,29 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackWatcherGetWatch (opts) { +function buildGetTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [xpack.watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request + * Perform a [get_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-template.html) request * - * @param {string} id - Watch ID + * @param {string} id - Template ID */ const acceptedQuerystring = [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ] const snakeCase = { - + errorTrace: 'error_trace', + filterPath: 'filter_path' } - return function xpackWatcherGetWatch (params, options, callback) { + return function getTemplate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -51,6 +56,15 @@ function buildXpackWatcherGetWatch (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + getTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -88,7 +102,7 @@ function buildXpackWatcherGetWatch (opts) { var path = '' - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + path = '/' + '_search' + '/' + 'template' + '/' + encodeURIComponent(id) // build request object const request = { @@ -129,4 +143,4 @@ function buildXpackWatcherGetWatch (opts) { } } -module.exports = buildXpackWatcherGetWatch +module.exports = buildGetTemplate diff --git a/api/api/ilm.delete_lifecycle.js b/api/api/ilm.delete_lifecycle.js deleted file mode 100644 index b7e42854e..000000000 --- a/api/api/ilm.delete_lifecycle.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 buildIlmDeleteLifecycle (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html) request - * - * @param {string} policy - The name of the index lifecycle policy - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmDeleteLifecycle (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, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildIlmDeleteLifecycle diff --git a/api/api/ilm.explain_lifecycle.js b/api/api/ilm.explain_lifecycle.js deleted file mode 100644 index e7357bdbe..000000000 --- a/api/api/ilm.explain_lifecycle.js +++ /dev/null @@ -1,127 +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 buildIlmExplainLifecycle (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request - * - * @param {string} index - The name of the index to explain - * @param {boolean} human - Return data such as dates in a human readable format - */ - - const acceptedQuerystring = [ - 'human' - ] - - const snakeCase = { - - } - - return function ilmExplainLifecycle (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, 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) + '/' + '_ilm' + '/' + 'explain' - - // 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, - querystring: options.querystring || 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 = buildIlmExplainLifecycle diff --git a/api/api/ilm.get_lifecycle.js b/api/api/ilm.get_lifecycle.js deleted file mode 100644 index b3c4c18e0..000000000 --- a/api/api/ilm.get_lifecycle.js +++ /dev/null @@ -1,130 +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 buildIlmGetLifecycle (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.get_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html) request - * - * @param {string} policy - The name of the index lifecycle policy - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmGetLifecycle (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, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((policy) != null) { - path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy) - } else { - path = '/' + '_ilm' + '/' + 'policy' - } - - // 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, - querystring: options.querystring || 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 = buildIlmGetLifecycle diff --git a/api/api/ilm.get_status.js b/api/api/ilm.get_status.js deleted file mode 100644 index f104b9c2a..000000000 --- a/api/api/ilm.get_status.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 buildIlmGetStatus (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.get_status](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmGetStatus (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 = '/' + '_ilm' + '/' + 'status' - - // 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, - querystring: options.querystring || 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 = buildIlmGetStatus diff --git a/api/api/ilm.move_to_step.js b/api/api/ilm.move_to_step.js deleted file mode 100644 index 13c0510e5..000000000 --- a/api/api/ilm.move_to_step.js +++ /dev/null @@ -1,119 +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 buildIlmMoveToStep (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.move_to_step](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html) request - * - * @param {string} index - The name of the index whose lifecycle step is to change - * @param {object} body - The new lifecycle step to move to - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmMoveToStep (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ilm' + '/' + 'move' + '/' + encodeURIComponent(index) - - // 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, - querystring: options.querystring || 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 = buildIlmMoveToStep diff --git a/api/api/ilm.put_lifecycle.js b/api/api/ilm.put_lifecycle.js deleted file mode 100644 index 830276149..000000000 --- a/api/api/ilm.put_lifecycle.js +++ /dev/null @@ -1,119 +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 buildIlmPutLifecycle (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.put_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html) request - * - * @param {string} policy - The name of the index lifecycle policy - * @param {object} body - The lifecycle policy definition to register - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmPutLifecycle (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, policy } = params - var querystring = semicopy(params, ['method', 'body', 'policy']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy) - - // 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, - querystring: options.querystring || 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 = buildIlmPutLifecycle diff --git a/api/api/ilm.remove_policy.js b/api/api/ilm.remove_policy.js deleted file mode 100644 index 5d517e06f..000000000 --- a/api/api/ilm.remove_policy.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 buildIlmRemovePolicy (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.remove_policy](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html) request - * - * @param {string} index - The name of the index to remove policy on - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmRemovePolicy (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, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'remove' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildIlmRemovePolicy diff --git a/api/api/ilm.retry.js b/api/api/ilm.retry.js deleted file mode 100644 index ceba161f6..000000000 --- a/api/api/ilm.retry.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 buildIlmRetry (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.retry](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html) request - * - * @param {string} index - The name of the indices (comma-separated) whose failed lifecycle step is to be retry - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmRetry (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, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'retry' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildIlmRetry diff --git a/api/api/ilm.start.js b/api/api/ilm.start.js deleted file mode 100644 index 3df608a93..000000000 --- a/api/api/ilm.start.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 buildIlmStart (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.start](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmStart (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ilm' + '/' + 'start' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildIlmStart diff --git a/api/api/ilm.stop.js b/api/api/ilm.stop.js deleted file mode 100644 index daba30ab5..000000000 --- a/api/api/ilm.stop.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 buildIlmStop (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ilm.stop](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function ilmStop (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ilm' + '/' + 'stop' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildIlmStop diff --git a/api/api/index.js b/api/api/index.js index c8b2cf25c..f47f4a4c0 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -26,7 +26,7 @@ function buildIndex (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [index](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request + * Perform a [index](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-index_.html) request * * @param {string} id - Document ID * @param {string} index - The name of the index @@ -37,10 +37,10 @@ function buildIndex (opts) { * @param {enum} refresh - If `true` 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` (the default) then do nothing with refreshes. * @param {string} routing - Specific routing value * @param {time} timeout - Explicit operation timeout + * @param {time} timestamp - Explicit timestamp for the document + * @param {time} ttl - Expiration time for the document * @param {number} version - Explicit version number for concurrency control * @param {enum} version_type - Specific version type - * @param {number} if_seq_no - only perform the index operation if the last operation that has changed the document has the specified sequence number - * @param {number} if_primary_term - only perform the index operation if the last operation that has changed the document has the specified primary term * @param {string} pipeline - The pipeline id to preprocess incoming documents with * @param {object} body - The document */ @@ -52,10 +52,10 @@ function buildIndex (opts) { 'refresh', 'routing', 'timeout', + 'timestamp', + 'ttl', 'version', 'version_type', - 'if_seq_no', - 'if_primary_term', 'pipeline', 'pretty', 'human', @@ -68,8 +68,6 @@ function buildIndex (opts) { waitForActiveShards: 'wait_for_active_shards', opType: 'op_type', versionType: 'version_type', - ifSeqNo: 'if_seq_no', - ifPrimaryTerm: 'if_primary_term', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -86,6 +84,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 +100,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 +114,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 +151,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 34e753bc7..c3d0e636a 100644 --- a/api/api/indices.analyze.js +++ b/api/api/indices.analyze.js @@ -26,15 +26,35 @@ function buildIndicesAnalyze (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.analyze](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html) request + * Perform a [indices.analyze](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-analyze.html) request * * @param {string} index - The name of the index to scope the operation + * @param {string} analyzer - The name of the analyzer to use + * @param {list} char_filter - A comma-separated list of character filters to use for the analysis + * @param {string} field - Use the analyzer configured for this field (instead of passing the analyzer name) + * @param {list} filter - A comma-separated list of filters to use for the analysis * @param {string} index - The name of the index to scope the operation - * @param {object} body - Define analyzer/tokenizer parameters and the text on which the analysis should be performed + * @param {boolean} prefer_local - With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true) + * @param {list} text - The text on which the analysis should be performed (when request body is not used) + * @param {string} tokenizer - The name of the tokenizer to use for the analysis + * @param {boolean} explain - With `true`, outputs more advanced details. (default: false) + * @param {list} attributes - A comma-separated list of token attributes to output, this parameter works only with `explain=true` + * @param {enum} format - Format of the output + * @param {object} body - The text on which the analysis should be performed */ const acceptedQuerystring = [ + 'analyzer', + 'char_filter', + 'field', + 'filter', 'index', + 'prefer_local', + 'text', + 'tokenizer', + 'explain', + 'attributes', + 'format', 'pretty', 'human', 'error_trace', @@ -43,6 +63,8 @@ function buildIndicesAnalyze (opts) { ] const snakeCase = { + charFilter: 'char_filter', + preferLocal: 'prefer_local', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -59,6 +81,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 26b35f715..47d6e17e6 100644 --- a/api/api/indices.clear_cache.js +++ b/api/api/indices.clear_cache.js @@ -26,20 +26,24 @@ function buildIndicesClearCache (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request + * Perform a [indices.clear_cache](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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 * @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 {list} fields - A comma-separated list of fields to clear when using the `field_data` parameter (default: all) * @param {boolean} query - Clear query caches * @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 {list} index - A comma-separated list of index name to limit the operation + * @param {boolean} recycler - Clear the recycler cache + * @param {boolean} request_cache - Clear request cache * @param {boolean} request - Clear request cache */ const acceptedQuerystring = [ + 'field_data', 'fielddata', 'fields', 'query', @@ -47,6 +51,8 @@ function buildIndicesClearCache (opts) { 'allow_no_indices', 'expand_wildcards', 'index', + 'recycler', + 'request_cache', 'request', 'pretty', 'human', @@ -56,9 +62,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 +83,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 +113,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 299c3102f..00cb30910 100644 --- a/api/api/indices.close.js +++ b/api/api/indices.close.js @@ -26,7 +26,7 @@ function buildIndicesClose (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.close](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request + * Perform a [indices.close](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-open-close.html) request * * @param {list} index - A comma separated list of indices to close * @param {time} timeout - Explicit operation timeout @@ -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 02a39b5e3..9bde7794d 100644 --- a/api/api/indices.create.js +++ b/api/api/indices.create.js @@ -26,21 +26,21 @@ function buildIndicesCreate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request + * Perform a [indices.create](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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 9b300519b..0e9ee33ba 100644 --- a/api/api/indices.delete.js +++ b/api/api/indices.delete.js @@ -26,22 +26,16 @@ function buildIndicesDelete (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html) request + * Perform a [indices.delete](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-delete-index.html) request * * @param {list} index - A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master - * @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) - * @param {enum} expand_wildcards - Whether wildcard expressions should get expanded to open or closed indices (default: open) */ const acceptedQuerystring = [ 'timeout', 'master_timeout', - 'ignore_unavailable', - 'allow_no_indices', - 'expand_wildcards', 'pretty', 'human', 'error_trace', @@ -51,9 +45,6 @@ function buildIndicesDelete (opts) { const snakeCase = { masterTimeout: 'master_timeout', - ignoreUnavailable: 'ignore_unavailable', - allowNoIndices: 'allow_no_indices', - expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -70,6 +61,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 04dc7778c..0fb33f9f7 100644 --- a/api/api/indices.delete_alias.js +++ b/api/api/indices.delete_alias.js @@ -26,7 +26,7 @@ function buildIndicesDeleteAlias (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.delete_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request + * Perform a [indices.delete_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request * * @param {list} index - A comma-separated list of index names (supports wildcards); use `_all` for all indices * @param {list} name - A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. @@ -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 41022e367..b52f486d9 100644 --- a/api/api/indices.delete_template.js +++ b/api/api/indices.delete_template.js @@ -26,7 +26,7 @@ function buildIndicesDeleteTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.delete_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request + * Perform a [indices.delete_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-templates.html) request * * @param {string} name - The name of the template * @param {time} timeout - Explicit operation timeout @@ -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 171966b42..531db4ffa 100644 --- a/api/api/indices.exists.js +++ b/api/api/indices.exists.js @@ -26,7 +26,7 @@ function buildIndicesExists (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html) request + * Perform a [indices.exists](http://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-exists.html) request * * @param {list} index - A comma-separated list of index names * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) @@ -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 67ca6a283..16d27ed22 100644 --- a/api/api/indices.exists_alias.js +++ b/api/api/indices.exists_alias.js @@ -26,7 +26,7 @@ function buildIndicesExistsAlias (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.exists_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request + * Perform a [indices.exists_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request * * @param {list} index - A comma-separated list of index names to filter aliases * @param {list} name - A comma-separated list of alias names to return @@ -68,13 +68,16 @@ function buildIndicesExistsAlias (opts) { options = {} } - // check required parameters - if (params['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) + // 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.body != null) { return callback( new ConfigurationError('This API does not require a body'), diff --git a/api/api/indices.exists_template.js b/api/api/indices.exists_template.js index ac3291d8a..d6b82885c 100644 --- a/api/api/indices.exists_template.js +++ b/api/api/indices.exists_template.js @@ -26,7 +26,7 @@ function buildIndicesExistsTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.exists_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request + * Perform a [indices.exists_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-templates.html) request * * @param {list} name - The comma separated names of the index templates * @param {boolean} flat_settings - Return settings in flat format (default: false) @@ -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 b4b1965ee..66a6d5a69 100644 --- a/api/api/indices.exists_type.js +++ b/api/api/indices.exists_type.js @@ -26,7 +26,7 @@ function buildIndicesExistsType (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.exists_type](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html) request + * Perform a [indices.exists_type](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-types-exists.html) request * * @param {list} index - A comma-separated list of index names; use `_all` to check the types across all indices * @param {list} type - A comma-separated list of document types to check @@ -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 2114f8df3..073a957f2 100644 --- a/api/api/indices.flush.js +++ b/api/api/indices.flush.js @@ -26,7 +26,7 @@ function buildIndicesFlush (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.flush](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html) request + * Perform a [indices.flush](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-flush.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string for all indices * @param {boolean} force - Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) @@ -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 af85ce93b..fe7c4fbc2 100644 --- a/api/api/indices.flush_synced.js +++ b/api/api/indices.flush_synced.js @@ -26,7 +26,7 @@ function buildIndicesFlushSynced (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html) request + * Perform a [indices.flush_synced](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-synced-flush.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string for all indices * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -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 86d1498de..56bbcbaa1 100644 --- a/api/api/indices.forcemerge.js +++ b/api/api/indices.forcemerge.js @@ -26,7 +26,7 @@ function buildIndicesForcemerge (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.forcemerge](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) request + * Perform a [indices.forcemerge](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-forcemerge.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {boolean} flush - Specify whether the index should be flushed after performing the operation (default: true) @@ -35,6 +35,8 @@ function buildIndicesForcemerge (opts) { * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. * @param {number} max_num_segments - The number of segments the index should be merged into (default: dynamic) * @param {boolean} only_expunge_deletes - Specify whether the operation should only expunge deleted documents + * @param {undefined} operation_threading - TODO: ? + * @param {boolean} wait_for_merge - Specify whether the request should block until the merge process is finished (default: true) */ const acceptedQuerystring = [ @@ -44,6 +46,8 @@ function buildIndicesForcemerge (opts) { 'expand_wildcards', 'max_num_segments', 'only_expunge_deletes', + 'operation_threading', + 'wait_for_merge', 'pretty', 'human', 'error_trace', @@ -57,6 +61,8 @@ function buildIndicesForcemerge (opts) { expandWildcards: 'expand_wildcards', maxNumSegments: 'max_num_segments', onlyExpungeDeletes: 'only_expunge_deletes', + operationThreading: 'operation_threading', + waitForMerge: 'wait_for_merge', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -73,6 +79,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.get.js b/api/api/indices.get.js index c36ebe463..62385dbeb 100644 --- a/api/api/indices.get.js +++ b/api/api/indices.get.js @@ -26,28 +26,25 @@ function buildIndicesGet (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request + * Perform a [indices.get](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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 {list} feature - A comma-separated list of features * @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) * @param {enum} expand_wildcards - Whether wildcard expressions should get expanded to open or closed indices (default: open) * @param {boolean} flat_settings - Return settings in flat format (default: false) * @param {boolean} include_defaults - Whether to return all default setting for each of the indices. - * @param {time} master_timeout - Specify timeout for connection to master */ const acceptedQuerystring = [ - 'include_type_name', 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'flat_settings', 'include_defaults', - 'master_timeout', 'pretty', 'human', 'error_trace', @@ -56,13 +53,11 @@ function buildIndicesGet (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', - masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -79,6 +74,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( @@ -93,6 +97,14 @@ function buildIndicesGet (opts) { ) } + // check required url components + if (params['feature'] != null && (params['index'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: index'), + result + ) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -102,8 +114,8 @@ function buildIndicesGet (opts) { } var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var { method, body, index, feature } = params + var querystring = semicopy(params, ['method', 'body', 'index', 'feature']) if (method == null) { method = 'GET' @@ -116,7 +128,11 @@ function buildIndicesGet (opts) { var path = '' - path = '/' + encodeURIComponent(index) + if ((index) != null && (feature) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(feature) + } else { + path = '/' + encodeURIComponent(index) + } // build request object const request = { diff --git a/api/api/indices.get_alias.js b/api/api/indices.get_alias.js index a9353e28c..f0b4662b9 100644 --- a/api/api/indices.get_alias.js +++ b/api/api/indices.get_alias.js @@ -26,7 +26,7 @@ function buildIndicesGetAlias (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.get_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request + * Perform a [indices.get_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request * * @param {list} index - A comma-separated list of index names to filter aliases * @param {list} name - A comma-separated list of alias names to return @@ -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 7e9bbfc47..37083bbd2 100644 --- a/api/api/indices.get_field_mapping.js +++ b/api/api/indices.get_field_mapping.js @@ -26,12 +26,11 @@ function buildIndicesGetFieldMapping (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.get_field_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html) request + * Perform a [indices.get_field_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-get-field-mapping.html) request * * @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 e860001d0..357a8052d 100644 --- a/api/api/indices.get_mapping.js +++ b/api/api/indices.get_mapping.js @@ -26,24 +26,20 @@ function buildIndicesGetMapping (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.get_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html) request + * Perform a [indices.get_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-get-mapping.html) request * * @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. - * @param {time} master_timeout - Specify timeout for connection to master * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) */ const acceptedQuerystring = [ - 'include_type_name', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'master_timeout', 'local', 'pretty', 'human', @@ -53,11 +49,9 @@ function buildIndicesGetMapping (opts) { ] const snakeCase = { - includeTypeName: 'include_type_name', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', - masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -74,6 +68,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 d0b10a27f..580d51cee 100644 --- a/api/api/indices.get_settings.js +++ b/api/api/indices.get_settings.js @@ -26,11 +26,10 @@ function buildIndicesGetSettings (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html) request + * Perform a [indices.get_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-get-settings.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {list} name - The name of the settings that should be included - * @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. @@ -40,7 +39,6 @@ function buildIndicesGetSettings (opts) { */ const acceptedQuerystring = [ - 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', @@ -55,7 +53,6 @@ function buildIndicesGetSettings (opts) { ] const snakeCase = { - masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', @@ -77,6 +74,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 31b52655d..e59568638 100644 --- a/api/api/indices.get_template.js +++ b/api/api/indices.get_template.js @@ -26,17 +26,15 @@ function buildIndicesGetTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.get_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request + * Perform a [indices.get_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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 554913cd3..101b44225 100644 --- a/api/api/indices.get_upgrade.js +++ b/api/api/indices.get_upgrade.js @@ -26,7 +26,7 @@ function buildIndicesGetUpgrade (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.get_upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request + * Perform a [indices.get_upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-upgrade.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -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 0e473c5b1..7826edb88 100644 --- a/api/api/indices.open.js +++ b/api/api/indices.open.js @@ -26,7 +26,7 @@ function buildIndicesOpen (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.open](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request + * Perform a [indices.open](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-open-close.html) request * * @param {list} index - A comma separated list of indices to open * @param {time} timeout - Explicit operation timeout @@ -34,7 +34,6 @@ function buildIndicesOpen (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 {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns. */ const acceptedQuerystring = [ @@ -43,7 +42,6 @@ function buildIndicesOpen (opts) { 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'wait_for_active_shards', 'pretty', 'human', 'error_trace', @@ -56,7 +54,6 @@ function buildIndicesOpen (opts) { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', - waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -73,6 +70,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 953ddc243..39c8d2db7 100644 --- a/api/api/indices.put_alias.js +++ b/api/api/indices.put_alias.js @@ -26,7 +26,7 @@ function buildIndicesPutAlias (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.put_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request + * Perform a [indices.put_alias](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request * * @param {list} index - A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. * @param {string} name - The name of the alias to be created or updated @@ -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 22fcd75a5..1b72b9af1 100644 --- a/api/api/indices.put_mapping.js +++ b/api/api/indices.put_mapping.js @@ -26,26 +26,26 @@ function buildIndicesPutMapping (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.put_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html) request + * Perform a [indices.put_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-put-mapping.html) request * * @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 a548bab5e..c84525020 100644 --- a/api/api/indices.put_settings.js +++ b/api/api/indices.put_settings.js @@ -26,11 +26,10 @@ function buildIndicesPutSettings (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html) request + * Perform a [indices.put_settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-update-settings.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {time} master_timeout - Specify timeout for connection to master - * @param {time} timeout - Explicit operation timeout * @param {boolean} preserve_existing - Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `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) @@ -41,7 +40,6 @@ function buildIndicesPutSettings (opts) { const acceptedQuerystring = [ 'master_timeout', - 'timeout', 'preserve_existing', 'ignore_unavailable', 'allow_no_indices', @@ -77,6 +75,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 ae78703b4..eb929f382 100644 --- a/api/api/indices.put_template.js +++ b/api/api/indices.put_template.js @@ -26,10 +26,9 @@ function buildIndicesPutTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.put_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request + * Perform a [indices.put_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/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 0a92e0bf6..653de637c 100644 --- a/api/api/indices.recovery.js +++ b/api/api/indices.recovery.js @@ -26,7 +26,7 @@ function buildIndicesRecovery (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html) request + * Perform a [indices.recovery](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-recovery.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {boolean} detailed - Whether to display detailed information about shard recovery @@ -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 78bfd9133..d98ffd1a3 100644 --- a/api/api/indices.refresh.js +++ b/api/api/indices.refresh.js @@ -26,7 +26,7 @@ function buildIndicesRefresh (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.refresh](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html) request + * Perform a [indices.refresh](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-refresh.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) @@ -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 42620f517..f2e7fab12 100644 --- a/api/api/indices.rollover.js +++ b/api/api/indices.rollover.js @@ -26,11 +26,10 @@ function buildIndicesRollover (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.rollover](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html) request + * Perform a [indices.rollover](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-rollover-index.html) request * * @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 dd0634d1b..ffa1cda88 100644 --- a/api/api/indices.segments.js +++ b/api/api/indices.segments.js @@ -26,12 +26,13 @@ function buildIndicesSegments (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html) request + * Perform a [indices.segments](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-segments.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @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 {undefined} operation_threading - TODO: ? * @param {boolean} verbose - Includes detailed memory usage by Lucene. */ @@ -39,6 +40,7 @@ function buildIndicesSegments (opts) { 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'operation_threading', 'verbose', 'pretty', 'human', @@ -51,6 +53,7 @@ function buildIndicesSegments (opts) { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + operationThreading: 'operation_threading', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -67,6 +70,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 648b03f27..3ad7c1b6e 100644 --- a/api/api/indices.shard_stores.js +++ b/api/api/indices.shard_stores.js @@ -26,13 +26,14 @@ function buildIndicesShardStores (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.shard_stores](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html) request + * Perform a [indices.shard_stores](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-shards-stores.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {list} status - A comma-separated list of statuses used to filter on shards to get store information for * @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 {undefined} operation_threading - TODO: ? */ const acceptedQuerystring = [ @@ -40,6 +41,7 @@ function buildIndicesShardStores (opts) { 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'operation_threading', 'pretty', 'human', 'error_trace', @@ -51,6 +53,7 @@ function buildIndicesShardStores (opts) { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + operationThreading: 'operation_threading', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -67,6 +70,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 07214df56..831655613 100644 --- a/api/api/indices.shrink.js +++ b/api/api/indices.shrink.js @@ -26,11 +26,10 @@ function buildIndicesShrink (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.shrink](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html) request + * Perform a [indices.shrink](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-shrink-index.html) request * * @param {string} index - The name of the source index to shrink * @param {string} target - The name of the target index to shrink into - * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. @@ -38,7 +37,6 @@ function buildIndicesShrink (opts) { */ const acceptedQuerystring = [ - 'copy_settings', 'timeout', 'master_timeout', 'wait_for_active_shards', @@ -50,7 +48,6 @@ function buildIndicesShrink (opts) { ] const snakeCase = { - copySettings: 'copy_settings', masterTimeout: 'master_timeout', waitForActiveShards: 'wait_for_active_shards', errorTrace: 'error_trace', @@ -69,6 +66,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 deleted file mode 100644 index 10119f632..000000000 --- a/api/api/indices.split.js +++ /dev/null @@ -1,158 +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 buildIndicesSplit (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [indices.split](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html) request - * - * @param {string} index - The name of the source index to split - * @param {string} target - The name of the target index to split into - * @param {boolean} copy_settings - whether or not to copy settings from the source index (defaults to false) - * @param {time} timeout - Explicit operation timeout - * @param {time} master_timeout - Specify timeout for connection to master - * @param {string} wait_for_active_shards - Set the number of active shards to wait for on the shrunken index before the operation returns. - * @param {object} body - The configuration for the target index (`settings` and `aliases`) - */ - - const acceptedQuerystring = [ - 'copy_settings', - 'timeout', - 'master_timeout', - 'wait_for_active_shards', - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ] - - const snakeCase = { - copySettings: 'copy_settings', - masterTimeout: 'master_timeout', - waitForActiveShards: 'wait_for_active_shards', - errorTrace: 'error_trace', - filterPath: 'filter_path' - } - - return function indicesSplit (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['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - result - ) - } - if (params['target'] == null) { - return callback( - new ConfigurationError('Missing required parameter: target'), - result - ) - } - - // check required url components - if (params['target'] != null && (params['index'] == null)) { - return callback( - new ConfigurationError('Missing required parameter of the url: index'), - 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, index, target } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'target']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + encodeURIComponent(index) + '/' + '_split' + '/' + encodeURIComponent(target) - - // 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, - querystring: options.querystring || 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 = buildIndicesSplit diff --git a/api/api/indices.stats.js b/api/api/indices.stats.js index ab726f2e9..68791a0c7 100644 --- a/api/api/indices.stats.js +++ b/api/api/indices.stats.js @@ -26,7 +26,7 @@ function buildIndicesStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html) request + * Perform a [indices.stats](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-stats.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @param {list} metric - Limit the information returned the specific metrics. @@ -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.update_aliases.js b/api/api/indices.update_aliases.js index 2fe49b94d..8f2f0c198 100644 --- a/api/api/indices.update_aliases.js +++ b/api/api/indices.update_aliases.js @@ -26,7 +26,7 @@ function buildIndicesUpdateAliases (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.update_aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request + * Perform a [indices.update_aliases](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-aliases.html) request * * @param {time} timeout - Request timeout * @param {time} master_timeout - Specify timeout for connection to master @@ -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 e24016557..678ae77ee 100644 --- a/api/api/indices.upgrade.js +++ b/api/api/indices.upgrade.js @@ -26,7 +26,7 @@ function buildIndicesUpgrade (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request + * Perform a [indices.upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/indices-upgrade.html) request * * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices * @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) @@ -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 c83d7f2b6..8db455dd7 100644 --- a/api/api/indices.validate_query.js +++ b/api/api/indices.validate_query.js @@ -26,7 +26,7 @@ function buildIndicesValidateQuery (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.validate_query](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html) request + * Perform a [indices.validate_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-validate.html) request * * @param {list} index - A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types @@ -34,6 +34,7 @@ function buildIndicesValidateQuery (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 {undefined} operation_threading - TODO: ? * @param {string} q - Query in the Lucene query string syntax * @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) @@ -50,6 +51,7 @@ function buildIndicesValidateQuery (opts) { 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'operation_threading', 'q', 'analyzer', 'analyze_wildcard', @@ -69,6 +71,7 @@ function buildIndicesValidateQuery (opts) { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', + operationThreading: 'operation_threading', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', allShards: 'all_shards', @@ -88,6 +91,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 6ffca21d0..e24f5f969 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -26,7 +26,7 @@ function buildInfo (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [info](http://www.elastic.co/guide/) request + * Perform a [info](https://www.elastic.co/guide/) request * */ @@ -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 dd07e23f7..e9bc2ef6e 100644 --- a/api/api/ingest.delete_pipeline.js +++ b/api/api/ingest.delete_pipeline.js @@ -26,7 +26,7 @@ function buildIngestDeletePipeline (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ingest.delete_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.delete_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/5.x/ingest.html) request * * @param {string} id - Pipeline ID * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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 f2318e734..8866471c0 100644 --- a/api/api/ingest.get_pipeline.js +++ b/api/api/ingest.get_pipeline.js @@ -26,7 +26,7 @@ function buildIngestGetPipeline (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ingest.get_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.get_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/5.x/ingest.html) request * * @param {string} id - Comma separated list of pipeline ids. Wildcards supported * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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 dfe478da6..711193ce2 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 973442efd..caca58638 100644 --- a/api/api/ingest.put_pipeline.js +++ b/api/api/ingest.put_pipeline.js @@ -26,7 +26,7 @@ function buildIngestPutPipeline (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ingest.put_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.put_pipeline](https://www.elastic.co/guide/en/elasticsearch/plugins/5.x/ingest.html) request * * @param {string} id - Pipeline ID * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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 d4c19e617..b623b7c95 100644 --- a/api/api/ingest.simulate.js +++ b/api/api/ingest.simulate.js @@ -26,7 +26,7 @@ function buildIngestSimulate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ingest.simulate](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html) request + * Perform a [ingest.simulate](https://www.elastic.co/guide/en/elasticsearch/plugins/5.x/ingest.html) request * * @param {string} id - Pipeline ID * @param {boolean} verbose - Verbose mode. Display data output for each processor in executed pipeline @@ -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 ffd31137b..46d0257b7 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -26,7 +26,7 @@ function buildMget (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [mget](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html) request + * Perform a [mget](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-multi-get.html) request * * @param {string} index - The name of the index * @param {string} type - The type of the document @@ -36,8 +36,8 @@ function buildMget (opts) { * @param {boolean} refresh - Refresh the shard containing the document before performing the operation * @param {string} routing - Specific routing value * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {object} body - Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL. */ @@ -48,8 +48,8 @@ function buildMget (opts) { 'refresh', 'routing', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'pretty', 'human', 'error_trace', @@ -59,8 +59,8 @@ function buildMget (opts) { const snakeCase = { storedFields: 'stored_fields', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -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/ml.close_job.js b/api/api/ml.close_job.js deleted file mode 100644 index cb7aaf795..000000000 --- a/api/api/ml.close_job.js +++ /dev/null @@ -1,133 +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 buildMlCloseJob (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 - * - * @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 = [ - 'allow_no_jobs', - 'force', - 'timeout' - ] - - const snakeCase = { - allowNoJobs: 'allow_no_jobs' - - } - - return function mlCloseJob (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_close' - - // 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, - querystring: options.querystring || 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 = buildMlCloseJob diff --git a/api/api/ml.delete_calendar.js b/api/api/ml.delete_calendar.js deleted file mode 100644 index e1bd7083c..000000000 --- a/api/api/ml.delete_calendar.js +++ /dev/null @@ -1,132 +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 buildMlDeleteCalendar (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.delete_calendar](undefined) request - * - * @param {string} calendar_id - The ID of the calendar to delete - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlDeleteCalendar (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['calendar_id'] == null && params['calendarId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: calendar_id or calendarId'), - result - ) - } - 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, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteCalendar diff --git a/api/api/ml.delete_calendar_event.js b/api/api/ml.delete_calendar_event.js deleted file mode 100644 index c96503503..000000000 --- a/api/api/ml.delete_calendar_event.js +++ /dev/null @@ -1,147 +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 buildMlDeleteCalendarEvent (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [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 - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlDeleteCalendarEvent (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['calendar_id'] == null && params['calendarId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: calendar_id or calendarId'), - result - ) - } - if (params['event_id'] == null && params['eventId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: event_id or eventId'), - result - ) - } - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // check required url components - if ((params['event_id'] != null || params['eventId'] != null) && ((params['calendar_id'] == null && params['calendarId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: calendar_id'), - 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, calendarId, calendar_id, eventId, event_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'eventId', 'event_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + '/' + encodeURIComponent(event_id || eventId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteCalendarEvent diff --git a/api/api/ml.delete_calendar_job.js b/api/api/ml.delete_calendar_job.js deleted file mode 100644 index ecb6eca9c..000000000 --- a/api/api/ml.delete_calendar_job.js +++ /dev/null @@ -1,147 +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 buildMlDeleteCalendarJob (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [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 - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlDeleteCalendarJob (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['calendar_id'] == null && params['calendarId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: calendar_id or calendarId'), - result - ) - } - if (params['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // check required url components - if ((params['job_id'] != null || params['jobId'] != null) && ((params['calendar_id'] == null && params['calendarId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: calendar_id'), - 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, calendarId, calendar_id, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'jobId', 'job_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteCalendarJob diff --git a/api/api/ml.delete_datafeed.js b/api/api/ml.delete_datafeed.js deleted file mode 100644 index 11f3e1ea0..000000000 --- a/api/api/ml.delete_datafeed.js +++ /dev/null @@ -1,133 +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 buildMlDeleteDatafeed (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 - * - * @param {string} datafeed_id - The ID of the datafeed to delete - * @param {boolean} force - True if the datafeed should be forcefully deleted - */ - - const acceptedQuerystring = [ - 'force' - ] - - const snakeCase = { - - } - - return function mlDeleteDatafeed (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['datafeed_id'] == null && params['datafeedId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), - result - ) - } - 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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteDatafeed diff --git a/api/api/ml.delete_expired_data.js b/api/api/ml.delete_expired_data.js deleted file mode 100644 index 46804629d..000000000 --- a/api/api/ml.delete_expired_data.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 buildMlDeleteExpiredData (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.delete_expired_data](undefined) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlDeleteExpiredData (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 = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + '_delete_expired_data' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteExpiredData diff --git a/api/api/ml.delete_filter.js b/api/api/ml.delete_filter.js deleted file mode 100644 index 02be51572..000000000 --- a/api/api/ml.delete_filter.js +++ /dev/null @@ -1,132 +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 buildMlDeleteFilter (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.delete_filter](undefined) request - * - * @param {string} filter_id - The ID of the filter to delete - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlDeleteFilter (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['filter_id'] == null && params['filterId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: filter_id or filterId'), - result - ) - } - 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, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteFilter diff --git a/api/api/ml.delete_forecast.js b/api/api/ml.delete_forecast.js deleted file mode 100644 index 41c98db5b..000000000 --- a/api/api/ml.delete_forecast.js +++ /dev/null @@ -1,149 +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 buildMlDeleteForecast (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 - * - * @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` - * @param {boolean} allow_no_forecasts - Whether to ignore if `_all` matches no forecasts - * @param {time} timeout - Controls the time to wait until the forecast(s) are deleted. Default to 30 seconds - */ - - const acceptedQuerystring = [ - 'allow_no_forecasts', - 'timeout' - ] - - const snakeCase = { - allowNoForecasts: 'allow_no_forecasts' - - } - - return function mlDeleteForecast (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // check required url components - if ((params['forecast_id'] != null || params['forecastId'] != null) && ((params['job_id'] == null && params['jobId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: job_id'), - 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, jobId, job_id, forecastId, forecast_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'forecastId', 'forecast_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((job_id || jobId) != null && (forecast_id || forecastId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + '/' + encodeURIComponent(forecast_id || forecastId) - } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' - } - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteForecast diff --git a/api/api/ml.delete_job.js b/api/api/ml.delete_job.js deleted file mode 100644 index 04dda816e..000000000 --- a/api/api/ml.delete_job.js +++ /dev/null @@ -1,135 +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 buildMlDeleteJob (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 - * - * @param {string} job_id - The ID of the job to delete - * @param {boolean} force - True if the job should be forcefully deleted - * @param {boolean} wait_for_completion - Should this request wait until the operation has completed before returning - */ - - const acceptedQuerystring = [ - 'force', - 'wait_for_completion' - ] - - const snakeCase = { - waitForCompletion: 'wait_for_completion' - } - - return function mlDeleteJob (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteJob diff --git a/api/api/ml.delete_model_snapshot.js b/api/api/ml.delete_model_snapshot.js deleted file mode 100644 index e289f739f..000000000 --- a/api/api/ml.delete_model_snapshot.js +++ /dev/null @@ -1,147 +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 buildMlDeleteModelSnapshot (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 - * - * @param {string} job_id - The ID of the job to fetch - * @param {string} snapshot_id - The ID of the snapshot to delete - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlDeleteModelSnapshot (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - if (params['snapshot_id'] == null && params['snapshotId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: snapshot_id or snapshotId'), - result - ) - } - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // check required url components - if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null && params['jobId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: job_id'), - 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, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlDeleteModelSnapshot diff --git a/api/api/ml.find_file_structure.js b/api/api/ml.find_file_structure.js deleted file mode 100644 index 471ace592..000000000 --- a/api/api/ml.find_file_structure.js +++ /dev/null @@ -1,158 +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 buildMlFindFileStructure (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 - * - * @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 - * @param {string} charset - Optional parameter to specify the character set of the file - * @param {enum} format - Optional parameter to specify the high level file format - * @param {boolean} has_header_row - Optional parameter to specify whether a delimited file includes the column names in its first row - * @param {list} column_names - Optional parameter containing a comma separated list of the column names for a delimited file - * @param {string} delimiter - Optional parameter to specify the delimiter character for a delimited file - must be a single character - * @param {string} quote - Optional parameter to specify the quote character for a delimited file - must be a single character - * @param {boolean} should_trim_fields - Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them - * @param {string} grok_pattern - Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file - * @param {string} timestamp_field - Optional parameter to specify the timestamp field in the file - * @param {string} timestamp_format - Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format - * @param {boolean} explain - Whether to include a commentary on how the structure was derived - * @param {object} body - The contents of the file to be analyzed - */ - - const acceptedQuerystring = [ - 'lines_to_sample', - 'timeout', - 'charset', - 'format', - 'has_header_row', - 'column_names', - 'delimiter', - 'quote', - 'should_trim_fields', - 'grok_pattern', - 'timestamp_field', - 'timestamp_format', - 'explain' - ] - - const snakeCase = { - linesToSample: 'lines_to_sample', - hasHeaderRow: 'has_header_row', - columnNames: 'column_names', - shouldTrimFields: 'should_trim_fields', - grokPattern: 'grok_pattern', - timestampField: 'timestamp_field', - timestampFormat: 'timestamp_format' - - } - - return function mlFindFileStructure (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'find_file_structure' - - // build request object - const request = { - method, - path, - bulkBody: body, - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlFindFileStructure diff --git a/api/api/ml.flush_job.js b/api/api/ml.flush_job.js deleted file mode 100644 index 120e65908..000000000 --- a/api/api/ml.flush_job.js +++ /dev/null @@ -1,138 +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 buildMlFlushJob (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 - * - * @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 - * @param {string} start - When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results - * @param {string} end - When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results - * @param {string} advance_time - Advances time to the given value generating results and updating the model for the advanced interval - * @param {string} skip_time - Skips time to the given value without generating results or updating the model for the skipped interval - * @param {object} body - Flush parameters - */ - - const acceptedQuerystring = [ - 'calc_interim', - 'start', - 'end', - 'advance_time', - 'skip_time' - ] - - const snakeCase = { - calcInterim: 'calc_interim', - advanceTime: 'advance_time', - skipTime: 'skip_time' - } - - return function mlFlushJob (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_flush' - - // 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, - querystring: options.querystring || 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 = buildMlFlushJob diff --git a/api/api/ml.forecast.js b/api/api/ml.forecast.js deleted file mode 100644 index 9aa6645eb..000000000 --- a/api/api/ml.forecast.js +++ /dev/null @@ -1,135 +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 buildMlForecast (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.forecast](undefined) request - * - * @param {string} job_id - The ID of the job to forecast for - * @param {time} duration - The duration of the forecast - * @param {time} expires_in - The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity. - */ - - const acceptedQuerystring = [ - 'duration', - 'expires_in' - ] - - const snakeCase = { - expiresIn: 'expires_in' - } - - return function mlForecast (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlForecast diff --git a/api/api/ml.get_buckets.js b/api/api/ml.get_buckets.js deleted file mode 100644 index 9d9bcc8de..000000000 --- a/api/api/ml.get_buckets.js +++ /dev/null @@ -1,159 +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 buildMlGetBuckets (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 - * - * @param {string} job_id - ID of the job to get bucket results from - * @param {string} timestamp - The timestamp of the desired single bucket result - * @param {boolean} expand - Include anomaly records - * @param {boolean} exclude_interim - Exclude interim results - * @param {int} from - skips a number of buckets - * @param {int} size - specifies a max number of buckets to get - * @param {string} start - Start time filter for buckets - * @param {string} end - End time filter for buckets - * @param {double} anomaly_score - Filter for the most anomalous buckets - * @param {string} sort - Sort buckets by a particular field - * @param {boolean} desc - Set the sort direction - * @param {object} body - Bucket selection details if not provided in URI - */ - - const acceptedQuerystring = [ - 'expand', - 'exclude_interim', - 'from', - 'size', - 'start', - 'end', - 'anomaly_score', - 'sort', - 'desc' - ] - - const snakeCase = { - excludeInterim: 'exclude_interim', - anomalyScore: 'anomaly_score' - - } - - return function mlGetBuckets (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - - // check required url components - if (params['timestamp'] != null && ((params['job_id'] == null && params['jobId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: job_id'), - 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, jobId, job_id, timestamp } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'timestamp']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((job_id || jobId) != null && (timestamp) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' + '/' + encodeURIComponent(timestamp) - } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetBuckets diff --git a/api/api/ml.get_calendar_events.js b/api/api/ml.get_calendar_events.js deleted file mode 100644 index c20b70306..000000000 --- a/api/api/ml.get_calendar_events.js +++ /dev/null @@ -1,142 +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 buildMlGetCalendarEvents (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [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' - * @param {string} start - Get events after this time - * @param {date} end - Get events before this time - * @param {int} from - Skips a number of events - * @param {int} size - Specifies a max number of events to get - */ - - const acceptedQuerystring = [ - 'job_id', - 'start', - 'end', - 'from', - 'size' - ] - - const snakeCase = { - jobId: 'job_id' - - } - - return function mlGetCalendarEvents (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['calendar_id'] == null && params['calendarId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: calendar_id or calendarId'), - result - ) - } - 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, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' - - // 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, - querystring: options.querystring || 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 = buildMlGetCalendarEvents diff --git a/api/api/ml.get_calendars.js b/api/api/ml.get_calendars.js deleted file mode 100644 index 524e6de9c..000000000 --- a/api/api/ml.get_calendars.js +++ /dev/null @@ -1,133 +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 buildMlGetCalendars (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.get_calendars](undefined) request - * - * @param {string} calendar_id - The ID of the calendar to fetch - * @param {int} from - skips a number of calendars - * @param {int} size - specifies a max number of calendars to get - */ - - const acceptedQuerystring = [ - 'from', - 'size' - ] - - const snakeCase = { - - } - - return function mlGetCalendars (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, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((calendar_id || calendarId) != null) { - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) - } else { - path = '/' + '_ml' + '/' + 'calendars' - } - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlGetCalendars diff --git a/api/api/ml.get_categories.js b/api/api/ml.get_categories.js deleted file mode 100644 index 575d6f241..000000000 --- a/api/api/ml.get_categories.js +++ /dev/null @@ -1,135 +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 buildMlGetCategories (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 - * - * @param {string} job_id - The name of the job - * @param {long} category_id - The identifier of the category definition of interest - * @param {int} from - skips a number of categories - * @param {int} size - specifies a max number of categories to get - * @param {object} body - Category selection details if not provided in URI - */ - - const acceptedQuerystring = [ - 'from', - 'size' - ] - - const snakeCase = { - - } - - return function mlGetCategories (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - 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, jobId, job_id, categoryId, category_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'categoryId', 'category_id']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - 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) - } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetCategories diff --git a/api/api/ml.get_datafeed_stats.js b/api/api/ml.get_datafeed_stats.js deleted file mode 100644 index 6be270e5b..000000000 --- a/api/api/ml.get_datafeed_stats.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 buildMlGetDatafeedStats (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 - * - * @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) - */ - - const acceptedQuerystring = [ - 'allow_no_datafeeds' - ] - - const snakeCase = { - allowNoDatafeeds: 'allow_no_datafeeds' - } - - return function mlGetDatafeedStats (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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((datafeed_id || datafeedId) != null) { - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stats' - } else { - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + '_stats' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetDatafeedStats diff --git a/api/api/ml.get_datafeeds.js b/api/api/ml.get_datafeeds.js deleted file mode 100644 index f6d74432f..000000000 --- a/api/api/ml.get_datafeeds.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 buildMlGetDatafeeds (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 - * - * @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) - */ - - const acceptedQuerystring = [ - 'allow_no_datafeeds' - ] - - const snakeCase = { - allowNoDatafeeds: 'allow_no_datafeeds' - } - - return function mlGetDatafeeds (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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((datafeed_id || datafeedId) != null) { - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) - } else { - path = '/' + '_ml' + '/' + 'datafeeds' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetDatafeeds diff --git a/api/api/ml.get_filters.js b/api/api/ml.get_filters.js deleted file mode 100644 index 6a1cf9ba4..000000000 --- a/api/api/ml.get_filters.js +++ /dev/null @@ -1,133 +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 buildMlGetFilters (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.get_filters](undefined) request - * - * @param {string} filter_id - The ID of the filter to fetch - * @param {int} from - skips a number of filters - * @param {int} size - specifies a max number of filters to get - */ - - const acceptedQuerystring = [ - 'from', - 'size' - ] - - const snakeCase = { - - } - - return function mlGetFilters (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, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((filter_id || filterId) != null) { - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) - } else { - path = '/' + '_ml' + '/' + 'filters' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetFilters diff --git a/api/api/ml.get_influencers.js b/api/api/ml.get_influencers.js deleted file mode 100644 index 44a70a329..000000000 --- a/api/api/ml.get_influencers.js +++ /dev/null @@ -1,144 +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 buildMlGetInfluencers (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 - * - * @param {string} job_id - - * @param {boolean} exclude_interim - Exclude interim results - * @param {int} from - skips a number of influencers - * @param {int} size - specifies a max number of influencers to get - * @param {string} start - start timestamp for the requested influencers - * @param {string} end - end timestamp for the requested influencers - * @param {double} influencer_score - influencer score threshold for the requested influencers - * @param {string} sort - sort field for the requested influencers - * @param {boolean} desc - whether the results should be sorted in decending order - * @param {object} body - Influencer selection criteria - */ - - const acceptedQuerystring = [ - 'exclude_interim', - 'from', - 'size', - 'start', - 'end', - 'influencer_score', - 'sort', - 'desc' - ] - - const snakeCase = { - excludeInterim: 'exclude_interim', - influencerScore: 'influencer_score' - - } - - return function mlGetInfluencers (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'influencers' - - // 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, - querystring: options.querystring || 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 = buildMlGetInfluencers diff --git a/api/api/ml.get_job_stats.js b/api/api/ml.get_job_stats.js deleted file mode 100644 index 81c6c0195..000000000 --- a/api/api/ml.get_job_stats.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 buildMlGetJobStats (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 - * - * @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) - */ - - const acceptedQuerystring = [ - 'allow_no_jobs' - ] - - const snakeCase = { - allowNoJobs: 'allow_no_jobs' - } - - return function mlGetJobStats (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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((job_id || jobId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_stats' - } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_stats' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetJobStats diff --git a/api/api/ml.get_jobs.js b/api/api/ml.get_jobs.js deleted file mode 100644 index d4cc390d2..000000000 --- a/api/api/ml.get_jobs.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 buildMlGetJobs (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 - * - * @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) - */ - - const acceptedQuerystring = [ - 'allow_no_jobs' - ] - - const snakeCase = { - allowNoJobs: 'allow_no_jobs' - } - - return function mlGetJobs (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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((job_id || jobId) != null) { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) - } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetJobs diff --git a/api/api/ml.get_model_snapshots.js b/api/api/ml.get_model_snapshots.js deleted file mode 100644 index 677760294..000000000 --- a/api/api/ml.get_model_snapshots.js +++ /dev/null @@ -1,151 +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 buildMlGetModelSnapshots (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 - * - * @param {string} job_id - The ID of the job to fetch - * @param {string} snapshot_id - The ID of the snapshot to fetch - * @param {int} from - Skips a number of documents - * @param {int} size - The default number of documents returned in queries as a string. - * @param {date} start - The filter 'start' query parameter - * @param {date} end - The filter 'end' query parameter - * @param {string} sort - Name of the field to sort on - * @param {boolean} desc - True if the results should be sorted in descending order - * @param {object} body - Model snapshot selection criteria - */ - - const acceptedQuerystring = [ - 'from', - 'size', - 'start', - 'end', - 'sort', - 'desc' - ] - - const snakeCase = { - - } - - return function mlGetModelSnapshots (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - - // check required url components - if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null && params['jobId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: job_id'), - 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, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - 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) - } else { - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' - } - - // 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, - querystring: options.querystring || 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 = buildMlGetModelSnapshots diff --git a/api/api/ml.get_overall_buckets.js b/api/api/ml.get_overall_buckets.js deleted file mode 100644 index d8269c4b8..000000000 --- a/api/api/ml.get_overall_buckets.js +++ /dev/null @@ -1,144 +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 buildMlGetOverallBuckets (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 - * - * @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 - * @param {string} bucket_span - The span of the overall buckets. Defaults to the longest job bucket_span - * @param {double} overall_score - Returns overall buckets with overall scores higher than this value - * @param {boolean} exclude_interim - If true overall buckets that include interim buckets will be excluded - * @param {string} start - Returns overall buckets with timestamps after this time - * @param {string} end - Returns overall buckets with timestamps earlier than this time - * @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 {object} body - Overall bucket selection details if not provided in URI - */ - - const acceptedQuerystring = [ - 'top_n', - 'bucket_span', - 'overall_score', - 'exclude_interim', - 'start', - 'end', - 'allow_no_jobs' - ] - - const snakeCase = { - topN: 'top_n', - bucketSpan: 'bucket_span', - overallScore: 'overall_score', - excludeInterim: 'exclude_interim', - allowNoJobs: 'allow_no_jobs' - } - - return function mlGetOverallBuckets (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets' - - // 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, - querystring: options.querystring || 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 = buildMlGetOverallBuckets diff --git a/api/api/ml.get_records.js b/api/api/ml.get_records.js deleted file mode 100644 index e80d7575b..000000000 --- a/api/api/ml.get_records.js +++ /dev/null @@ -1,144 +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 buildMlGetRecords (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 - * - * @param {string} job_id - - * @param {boolean} exclude_interim - Exclude interim results - * @param {int} from - skips a number of records - * @param {int} size - specifies a max number of records to get - * @param {string} start - Start time filter for records - * @param {string} end - End time filter for records - * @param {double} record_score - - * @param {string} sort - Sort records by a particular field - * @param {boolean} desc - Set the sort direction - * @param {object} body - Record selection criteria - */ - - const acceptedQuerystring = [ - 'exclude_interim', - 'from', - 'size', - 'start', - 'end', - 'record_score', - 'sort', - 'desc' - ] - - const snakeCase = { - excludeInterim: 'exclude_interim', - recordScore: 'record_score' - - } - - return function mlGetRecords (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'records' - - // 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, - querystring: options.querystring || 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 = buildMlGetRecords diff --git a/api/api/ml.info.js b/api/api/ml.info.js deleted file mode 100644 index ed7424f5a..000000000 --- a/api/api/ml.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 buildMlInfo (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.info](undefined) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlInfo (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 } = 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 = '/' + '_ml' + '/' + '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, - querystring: options.querystring || 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 = buildMlInfo diff --git a/api/api/ml.open_job.js b/api/api/ml.open_job.js deleted file mode 100644 index fed169189..000000000 --- a/api/api/ml.open_job.js +++ /dev/null @@ -1,134 +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 buildMlOpenJob (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 - * - * @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 - * @param {time} timeout - Controls the time to wait until a job has opened. Default to 30 minutes - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlOpenJob (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - 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, jobId, job_id, ignoreDowntime, ignore_downtime, timeout } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'ignoreDowntime', 'ignore_downtime', 'timeout']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_open' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlOpenJob diff --git a/api/api/ml.post_calendar_events.js b/api/api/ml.post_calendar_events.js deleted file mode 100644 index df35bfb5a..000000000 --- a/api/api/ml.post_calendar_events.js +++ /dev/null @@ -1,133 +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 buildMlPostCalendarEvents (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.post_calendar_events](undefined) request - * - * @param {string} calendar_id - The ID of the calendar to modify - * @param {object} body - A list of events - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlPostCalendarEvents (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['calendar_id'] == null && params['calendarId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: calendar_id or calendarId'), - result - ) - } - 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, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' - - // 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, - querystring: options.querystring || 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 = buildMlPostCalendarEvents diff --git a/api/api/ml.post_data.js b/api/api/ml.post_data.js deleted file mode 100644 index 4c33f437e..000000000 --- a/api/api/ml.post_data.js +++ /dev/null @@ -1,137 +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 buildMlPostData (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 - * - * @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 - * @param {string} reset_end - Optional parameter to specify the end of the bucket resetting range - * @param {object} body - The data to process - */ - - const acceptedQuerystring = [ - 'reset_start', - 'reset_end' - ] - - const snakeCase = { - resetStart: 'reset_start', - resetEnd: 'reset_end' - } - - return function mlPostData (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_data' - - // 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, - querystring: options.querystring || 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 = buildMlPostData diff --git a/api/api/ml.preview_datafeed.js b/api/api/ml.preview_datafeed.js deleted file mode 100644 index 82d859f83..000000000 --- a/api/api/ml.preview_datafeed.js +++ /dev/null @@ -1,132 +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 buildMlPreviewDatafeed (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 - * - * @param {string} datafeed_id - The ID of the datafeed to preview - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlPreviewDatafeed (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['datafeed_id'] == null && params['datafeedId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), - result - ) - } - 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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview' - - // 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, - querystring: options.querystring || 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 = buildMlPreviewDatafeed diff --git a/api/api/ml.put_calendar.js b/api/api/ml.put_calendar.js deleted file mode 100644 index 63b039d3f..000000000 --- a/api/api/ml.put_calendar.js +++ /dev/null @@ -1,127 +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 buildMlPutCalendar (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.put_calendar](undefined) request - * - * @param {string} calendar_id - The ID of the calendar to create - * @param {object} body - The calendar details - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlPutCalendar (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['calendar_id'] == null && params['calendarId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: calendar_id or calendarId'), - 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, calendarId, calendar_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) - - // 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, - querystring: options.querystring || 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 = buildMlPutCalendar diff --git a/api/api/ml.put_calendar_job.js b/api/api/ml.put_calendar_job.js deleted file mode 100644 index 57630c10b..000000000 --- a/api/api/ml.put_calendar_job.js +++ /dev/null @@ -1,147 +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 buildMlPutCalendarJob (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [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 - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlPutCalendarJob (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['calendar_id'] == null && params['calendarId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: calendar_id or calendarId'), - result - ) - } - if (params['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // check required url components - if ((params['job_id'] != null || params['jobId'] != null) && ((params['calendar_id'] == null && params['calendarId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: calendar_id'), - 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, calendarId, calendar_id, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'calendarId', 'calendar_id', 'jobId', 'job_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlPutCalendarJob diff --git a/api/api/ml.put_datafeed.js b/api/api/ml.put_datafeed.js deleted file mode 100644 index e9c16382b..000000000 --- a/api/api/ml.put_datafeed.js +++ /dev/null @@ -1,133 +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 buildMlPutDatafeed (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 - * - * @param {string} datafeed_id - The ID of the datafeed to create - * @param {object} body - The datafeed config - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlPutDatafeed (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['datafeed_id'] == null && params['datafeedId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), - result - ) - } - 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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) - - // 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, - querystring: options.querystring || 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 = buildMlPutDatafeed diff --git a/api/api/ml.put_filter.js b/api/api/ml.put_filter.js deleted file mode 100644 index a9f475c5c..000000000 --- a/api/api/ml.put_filter.js +++ /dev/null @@ -1,133 +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 buildMlPutFilter (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.put_filter](undefined) request - * - * @param {string} filter_id - The ID of the filter to create - * @param {object} body - The filter details - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlPutFilter (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['filter_id'] == null && params['filterId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: filter_id or filterId'), - result - ) - } - 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, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) - - // 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, - querystring: options.querystring || 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 = buildMlPutFilter diff --git a/api/api/ml.put_job.js b/api/api/ml.put_job.js deleted file mode 100644 index df710de00..000000000 --- a/api/api/ml.put_job.js +++ /dev/null @@ -1,133 +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 buildMlPutJob (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 - * - * @param {string} job_id - The ID of the job to create - * @param {object} body - The job - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlPutJob (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) - - // 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, - querystring: options.querystring || 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 = buildMlPutJob diff --git a/api/api/ml.revert_model_snapshot.js b/api/api/ml.revert_model_snapshot.js deleted file mode 100644 index bc95a70b9..000000000 --- a/api/api/ml.revert_model_snapshot.js +++ /dev/null @@ -1,143 +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 buildMlRevertModelSnapshot (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 - * - * @param {string} job_id - The ID of the job to fetch - * @param {string} snapshot_id - The ID of the snapshot to revert to - * @param {boolean} delete_intervening_results - Should we reset the results back to the time of the snapshot? - * @param {object} body - Reversion options - */ - - const acceptedQuerystring = [ - 'delete_intervening_results' - ] - - const snakeCase = { - deleteInterveningResults: 'delete_intervening_results' - } - - return function mlRevertModelSnapshot (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - if (params['snapshot_id'] == null && params['snapshotId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: snapshot_id or snapshotId'), - result - ) - } - - // check required url components - if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null && params['jobId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: job_id'), - 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, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_revert' - - // 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, - querystring: options.querystring || 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 = buildMlRevertModelSnapshot diff --git a/api/api/ml.set_upgrade_mode.js b/api/api/ml.set_upgrade_mode.js deleted file mode 100644 index 8ef6cfedc..000000000 --- a/api/api/ml.set_upgrade_mode.js +++ /dev/null @@ -1,128 +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 buildMlSetUpgradeMode (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 - * - * @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) { - 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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'set_upgrade_mode' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMlSetUpgradeMode diff --git a/api/api/ml.start_datafeed.js b/api/api/ml.start_datafeed.js deleted file mode 100644 index 479610503..000000000 --- a/api/api/ml.start_datafeed.js +++ /dev/null @@ -1,132 +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 buildMlStartDatafeed (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 - * - * @param {string} datafeed_id - The ID of the datafeed to start - * @param {string} start - The start time from where the datafeed should begin - * @param {string} end - The end time when the datafeed should stop. When not set, the datafeed continues in real time - * @param {time} timeout - Controls the time to wait until a datafeed has started. Default to 20 seconds - * @param {object} body - The start datafeed parameters - */ - - const acceptedQuerystring = [ - 'start', - 'end', - 'timeout' - ] - - const snakeCase = { - - } - - return function mlStartDatafeed (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['datafeed_id'] == null && params['datafeedId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), - 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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_start' - - // 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, - querystring: options.querystring || 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 = buildMlStartDatafeed diff --git a/api/api/ml.stop_datafeed.js b/api/api/ml.stop_datafeed.js deleted file mode 100644 index 5dc2d95bd..000000000 --- a/api/api/ml.stop_datafeed.js +++ /dev/null @@ -1,132 +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 buildMlStopDatafeed (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 - * - * @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) - * @param {boolean} force - True if the datafeed should be forcefully stopped. - * @param {time} timeout - Controls the time to wait until a datafeed has stopped. Default to 20 seconds - */ - - const acceptedQuerystring = [ - 'allow_no_datafeeds', - 'force', - 'timeout' - ] - - const snakeCase = { - allowNoDatafeeds: 'allow_no_datafeeds' - - } - - return function mlStopDatafeed (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['datafeed_id'] == null && params['datafeedId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), - 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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stop' - - // 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, - querystring: options.querystring || 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 = buildMlStopDatafeed diff --git a/api/api/ml.update_datafeed.js b/api/api/ml.update_datafeed.js deleted file mode 100644 index 0dbf778ee..000000000 --- a/api/api/ml.update_datafeed.js +++ /dev/null @@ -1,133 +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 buildMlUpdateDatafeed (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 - * - * @param {string} datafeed_id - The ID of the datafeed to update - * @param {object} body - The datafeed update settings - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlUpdateDatafeed (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['datafeed_id'] == null && params['datafeedId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), - result - ) - } - 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, datafeedId, datafeed_id } = params - var querystring = semicopy(params, ['method', 'body', 'datafeedId', 'datafeed_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_update' - - // 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, - querystring: options.querystring || 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 = buildMlUpdateDatafeed diff --git a/api/api/ml.update_filter.js b/api/api/ml.update_filter.js deleted file mode 100644 index a4cc7e2c5..000000000 --- a/api/api/ml.update_filter.js +++ /dev/null @@ -1,133 +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 buildMlUpdateFilter (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.update_filter](undefined) request - * - * @param {string} filter_id - The ID of the filter to update - * @param {object} body - The filter update - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlUpdateFilter (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['filter_id'] == null && params['filterId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: filter_id or filterId'), - result - ) - } - 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, filterId, filter_id } = params - var querystring = semicopy(params, ['method', 'body', 'filterId', 'filter_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) + '/' + '_update' - - // 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, - querystring: options.querystring || 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 = buildMlUpdateFilter diff --git a/api/api/ml.update_job.js b/api/api/ml.update_job.js deleted file mode 100644 index 5155916fc..000000000 --- a/api/api/ml.update_job.js +++ /dev/null @@ -1,133 +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 buildMlUpdateJob (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 - * - * @param {string} job_id - The ID of the job to create - * @param {object} body - The job update settings - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlUpdateJob (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - 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, jobId, job_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_update' - - // 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, - querystring: options.querystring || 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 = buildMlUpdateJob diff --git a/api/api/ml.update_model_snapshot.js b/api/api/ml.update_model_snapshot.js deleted file mode 100644 index 98761c44e..000000000 --- a/api/api/ml.update_model_snapshot.js +++ /dev/null @@ -1,148 +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 buildMlUpdateModelSnapshot (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 - * - * @param {string} job_id - The ID of the job to fetch - * @param {string} snapshot_id - The ID of the snapshot to update - * @param {object} body - The model snapshot properties to update - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlUpdateModelSnapshot (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['job_id'] == null && params['jobId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: job_id or jobId'), - result - ) - } - if (params['snapshot_id'] == null && params['snapshotId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: snapshot_id or snapshotId'), - result - ) - } - if (params['body'] == null) { - return callback( - new ConfigurationError('Missing required parameter: body'), - result - ) - } - - // check required url components - if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null && params['jobId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: job_id'), - 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, jobId, job_id, snapshotId, snapshot_id } = params - var querystring = semicopy(params, ['method', 'body', 'jobId', 'job_id', 'snapshotId', 'snapshot_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_update' - - // 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, - querystring: options.querystring || 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 = buildMlUpdateModelSnapshot diff --git a/api/api/ml.validate.js b/api/api/ml.validate.js deleted file mode 100644 index 87a8e8806..000000000 --- a/api/api/ml.validate.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 buildMlValidate (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.validate](undefined) request - * - * @param {object} body - The job config - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlValidate (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_validate' - - // 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, - querystring: options.querystring || 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 = buildMlValidate diff --git a/api/api/ml.validate_detector.js b/api/api/ml.validate_detector.js deleted file mode 100644 index 430e2729a..000000000 --- a/api/api/ml.validate_detector.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 buildMlValidateDetector (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [ml.validate_detector](undefined) request - * - * @param {object} body - The detector - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function mlValidateDetector (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_validate' + '/' + 'detector' - - // 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, - querystring: options.querystring || 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 = buildMlValidateDetector diff --git a/api/api/monitoring.bulk.js b/api/api/monitoring.bulk.js deleted file mode 100644 index cb3e14ab6..000000000 --- a/api/api/monitoring.bulk.js +++ /dev/null @@ -1,138 +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 buildMonitoringBulk (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 - * - * @param {string} type - Default document type for items which don't provide one - * @param {string} system_id - Identifier of the monitored system - * @param {string} system_api_version - API Version of the monitored system - * @param {string} interval - Collection interval (e.g., '10s' or '10000ms') of the payload - * @param {object} body - The operation definition and data (action-data pairs), separated by newlines - */ - - const acceptedQuerystring = [ - 'system_id', - 'system_api_version', - 'interval' - ] - - const snakeCase = { - systemId: 'system_id', - systemApiVersion: 'system_api_version' - - } - - return function monitoringBulk (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, type } = params - var querystring = semicopy(params, ['method', 'body', 'type']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((type) != null) { - path = '/' + '_monitoring' + '/' + encodeURIComponent(type) + '/' + 'bulk' - } else { - path = '/' + '_monitoring' + '/' + 'bulk' - } - - // build request object - const request = { - method, - path, - bulkBody: body, - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildMonitoringBulk diff --git a/api/api/indices.unfreeze.js b/api/api/mpercolate.js similarity index 69% rename from api/api/indices.unfreeze.js rename to api/api/mpercolate.js index 74e77038a..c9f922c1f 100644 --- a/api/api/indices.unfreeze.js +++ b/api/api/mpercolate.js @@ -22,39 +22,40 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildIndicesUnfreeze (opts) { +function buildMpercolate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [indices.unfreeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request + * Perform a [mpercolate](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-percolate.html) request * - * @param {string} index - The name of the index to unfreeze - * @param {time} timeout - Explicit operation timeout - * @param {time} master_timeout - Specify timeout for connection to master + * @param {string} index - The index of the document being count percolated to use as default + * @param {string} type - The type of the document being percolated to use as default. * @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 {string} wait_for_active_shards - Sets the number of active shards to wait for before the operation returns. + * @param {object} body - The percolate request definitions (header & body pair), separated by newlines */ const acceptedQuerystring = [ - 'timeout', - 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'wait_for_active_shards' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ] const snakeCase = { - masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', - waitForActiveShards: 'wait_for_active_shards' + errorTrace: 'error_trace', + filterPath: 'filter_path' } - return function indicesUnfreeze (params, options, callback) { + return function mpercolate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -66,16 +67,27 @@ function buildIndicesUnfreeze (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + mpercolate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters - if (params['index'] == null) { + if (params['body'] == null) { return callback( - new ConfigurationError('Missing required parameter: index'), + new ConfigurationError('Missing required parameter: body'), result ) } - if (params.body != null) { + + // check required url components + if (params['type'] != null && (params['index'] == null)) { return callback( - new ConfigurationError('This API does not require a body'), + new ConfigurationError('Missing required parameter of the url: index'), result ) } @@ -89,11 +101,11 @@ function buildIndicesUnfreeze (opts) { } var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var { method, body, index, type } = params + var querystring = semicopy(params, ['method', 'body', 'index', 'type']) if (method == null) { - method = 'POST' + method = body == null ? 'GET' : 'POST' } var ignore = options.ignore || null @@ -103,13 +115,19 @@ function buildIndicesUnfreeze (opts) { var path = '' - path = '/' + encodeURIComponent(index) + '/' + '_unfreeze' + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_mpercolate' + } else if ((index) != null) { + path = '/' + encodeURIComponent(index) + '/' + '_mpercolate' + } else { + path = '/' + '_mpercolate' + } // build request object const request = { method, path, - body: '', + body: body || '', querystring } @@ -144,4 +162,4 @@ function buildIndicesUnfreeze (opts) { } } -module.exports = buildIndicesUnfreeze +module.exports = buildMpercolate diff --git a/api/api/msearch.js b/api/api/msearch.js index 964360fb1..cb0eebe85 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -26,7 +26,7 @@ function buildMsearch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [msearch](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html) request + * Perform a [msearch](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-multi-search.html) request * * @param {list} index - A comma-separated list of index names to use as default * @param {list} type - A comma-separated list of document types to use as default @@ -34,9 +34,6 @@ function buildMsearch (opts) { * @param {number} max_concurrent_searches - Controls the maximum number of concurrent searches the multi search api will execute * @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 {object} body - The request definitions (metadata-search request definition pairs), separated by newlines */ @@ -45,9 +42,6 @@ function buildMsearch (opts) { 'max_concurrent_searches', 'typed_keys', 'pre_filter_shard_size', - 'max_concurrent_shard_requests', - 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', @@ -60,9 +54,6 @@ function buildMsearch (opts) { maxConcurrentSearches: 'max_concurrent_searches', typedKeys: 'typed_keys', 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 +70,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 a208f5050..f7cb815fd 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -26,15 +26,13 @@ function buildMsearchTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [msearch_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) request + * Perform a [msearch_template](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * * @param {list} index - A comma-separated list of index names to use as default * @param {list} type - A comma-separated list of document types to use as default * @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 {object} body - The request definitions (metadata-search request definition pairs), separated by newlines */ @@ -42,8 +40,6 @@ function buildMsearchTemplate (opts) { 'search_type', 'typed_keys', 'max_concurrent_searches', - 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', @@ -55,8 +51,6 @@ function buildMsearchTemplate (opts) { searchType: 'search_type', 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 +67,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 2da66d164..661eb937b 100644 --- a/api/api/mtermvectors.js +++ b/api/api/mtermvectors.js @@ -26,7 +26,7 @@ function buildMtermvectors (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [mtermvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html) request + * Perform a [mtermvectors](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-multi-termvectors.html) request * * @param {string} index - The index in which the document resides. * @param {string} type - The type of the document. @@ -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 9db713c4f..6f00f132e 100644 --- a/api/api/nodes.hot_threads.js +++ b/api/api/nodes.hot_threads.js @@ -26,7 +26,7 @@ function buildNodesHotThreads (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [nodes.hot_threads](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html) request + * Perform a [nodes.hot_threads](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-nodes-hot-threads.html) request * * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {time} interval - The interval for the second sampling of threads @@ -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 acb7174e5..f9120fdec 100644 --- a/api/api/nodes.info.js +++ b/api/api/nodes.info.js @@ -26,7 +26,7 @@ function buildNodesInfo (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [nodes.info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html) request + * Perform a [nodes.info](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-nodes-info.html) request * * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {list} metric - A comma-separated list of metrics you wish returned. Leave empty to return all. @@ -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 deleted file mode 100644 index fdbdd3804..000000000 --- a/api/api/nodes.reload_secure_settings.js +++ /dev/null @@ -1,137 +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 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 - * - * @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 - */ - - const acceptedQuerystring = [ - 'timeout', - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ] - - const snakeCase = { - errorTrace: 'error_trace', - filterPath: 'filter_path' - } - - return function nodesReloadSecureSettings (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, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((node_id || nodeId) != null) { - path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'reload_secure_settings' - } else { - path = '/' + '_nodes' + '/' + 'reload_secure_settings' - } - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildNodesReloadSecureSettings diff --git a/api/api/nodes.stats.js b/api/api/nodes.stats.js index e41eed0ba..8c315580c 100644 --- a/api/api/nodes.stats.js +++ b/api/api/nodes.stats.js @@ -26,7 +26,7 @@ function buildNodesStats (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [nodes.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html) request + * Perform a [nodes.stats](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/cluster-nodes-stats.html) request * * @param {list} metric - Limit the information returned to the specified metrics * @param {list} index_metric - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. @@ -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 deleted file mode 100644 index 75c82ef94..000000000 --- a/api/api/nodes.usage.js +++ /dev/null @@ -1,142 +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 buildNodesUsage (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [nodes.usage](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html) request - * - * @param {list} metric - Limit the information returned to the specified metrics - * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * @param {time} timeout - Explicit operation timeout - */ - - const acceptedQuerystring = [ - 'timeout', - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ] - - const snakeCase = { - errorTrace: 'error_trace', - filterPath: 'filter_path' - } - - return function nodesUsage (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, metric, nodeId, node_id } = params - var querystring = semicopy(params, ['method', 'body', 'metric', 'nodeId', 'node_id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((node_id || nodeId) != null && (metric) != null) { - path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'usage' + '/' + encodeURIComponent(metric) - } else if ((node_id || nodeId) != null) { - path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'usage' - } else if ((metric) != null) { - path = '/' + '_nodes' + '/' + 'usage' + '/' + encodeURIComponent(metric) - } else { - path = '/' + '_nodes' + '/' + 'usage' - } - - // 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, - querystring: options.querystring || 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 = buildNodesUsage diff --git a/api/api/percolate.js b/api/api/percolate.js new file mode 100644 index 000000000..c3f274565 --- /dev/null +++ b/api/api/percolate.js @@ -0,0 +1,199 @@ +/* + * 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 buildPercolate (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [percolate](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-percolate.html) request + * + * @param {string} index - The index of the document being percolated. + * @param {string} type - The type of the document being percolated. + * @param {string} id - Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster. + * @param {list} routing - A comma-separated list of specific routing values + * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) + * @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 {string} percolate_index - The index to percolate the document into. Defaults to index. + * @param {string} percolate_type - The type to percolate document into. Defaults to type. + * @param {string} percolate_routing - The routing value to use when percolating the existing document. + * @param {string} percolate_preference - Which shard to prefer when executing the percolate request. + * @param {enum} percolate_format - Return an array of matching query IDs instead of objects + * @param {number} version - Explicit version number for concurrency control + * @param {enum} version_type - Specific version type + * @param {object} body - The percolator request definition using the percolate DSL + */ + + const acceptedQuerystring = [ + 'routing', + 'preference', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'percolate_index', + 'percolate_type', + 'percolate_routing', + 'percolate_preference', + 'percolate_format', + 'version', + 'version_type', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ] + + const snakeCase = { + ignoreUnavailable: 'ignore_unavailable', + allowNoIndices: 'allow_no_indices', + expandWildcards: 'expand_wildcards', + percolateIndex: 'percolate_index', + percolateType: 'percolate_type', + percolateRouting: 'percolate_routing', + percolatePreference: 'percolate_preference', + percolateFormat: 'percolate_format', + versionType: 'version_type', + errorTrace: 'error_trace', + filterPath: 'filter_path' + } + + return function percolate (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + percolate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['index'] == null) { + return callback( + new ConfigurationError('Missing required parameter: index'), + result + ) + } + if (params['type'] == null) { + return callback( + new ConfigurationError('Missing required parameter: type'), + result + ) + } + + // check required url components + 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 + ) + } + + // 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, type, id } = params + var querystring = semicopy(params, ['method', 'body', 'index', 'type', 'id']) + + if (method == null) { + method = body == null ? 'GET' : 'POST' + } + + var ignore = options.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + var path = '' + + if ((index) != null && (type) != null && (id) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_percolate' + } else { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_percolate' + } + + // 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, + querystring: options.querystring || 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 = buildPercolate diff --git a/api/api/ping.js b/api/api/ping.js index 1743acd4a..d35e10f08 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -26,7 +26,7 @@ function buildPing (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [ping](http://www.elastic.co/guide/) request + * Perform a [ping](https://www.elastic.co/guide/) request * */ @@ -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 68ddf90e4..6ee72e002 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -26,20 +26,18 @@ function buildPutScript (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [put_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request + * Perform a [put_script](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-scripting.html) request * * @param {string} id - Script ID - * @param {string} context - Script context + * @param {string} lang - Script language * @param {time} timeout - Explicit operation timeout * @param {time} master_timeout - Specify timeout for connection to master - * @param {string} context - Context name to compile script against * @param {object} body - The document */ const acceptedQuerystring = [ 'timeout', 'master_timeout', - 'context', 'pretty', 'human', 'error_trace', @@ -65,6 +63,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( @@ -72,6 +79,12 @@ function buildPutScript (opts) { result ) } + if (params['lang'] == null) { + return callback( + new ConfigurationError('Missing required parameter: lang'), + result + ) + } if (params['body'] == null) { return callback( new ConfigurationError('Missing required parameter: body'), @@ -80,9 +93,9 @@ function buildPutScript (opts) { } // check required url components - if (params['context'] != null && (params['id'] == null)) { + if (params['id'] != null && (params['lang'] == null)) { return callback( - new ConfigurationError('Missing required parameter of the url: id'), + new ConfigurationError('Missing required parameter of the url: lang'), result ) } @@ -96,8 +109,8 @@ function buildPutScript (opts) { } var warnings = null - var { method, body, id, context } = params - var querystring = semicopy(params, ['method', 'body', 'id', 'context']) + var { method, body, id, lang } = params + var querystring = semicopy(params, ['method', 'body', 'id', 'lang']) if (method == null) { method = 'PUT' @@ -110,10 +123,10 @@ function buildPutScript (opts) { var path = '' - if ((id) != null && (context) != null) { - path = '/' + '_scripts' + '/' + encodeURIComponent(id) + '/' + encodeURIComponent(context) + if ((lang) != null && (id) != null) { + path = '/' + '_scripts' + '/' + encodeURIComponent(lang) + '/' + encodeURIComponent(id) } else { - path = '/' + '_scripts' + '/' + encodeURIComponent(id) + path = '/' + '_scripts' + '/' + encodeURIComponent(lang) } // build request object diff --git a/api/api/xpack.rollup.put_job.js b/api/api/put_template.js similarity index 81% rename from api/api/xpack.rollup.put_job.js rename to api/api/put_template.js index a24e4e53d..42d748d17 100644 --- a/api/api/xpack.rollup.put_job.js +++ b/api/api/put_template.js @@ -22,25 +22,30 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildXpackRollupPutJob (opts) { +function buildPutTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [xpack.rollup.put_job]() request + * Perform a [put_template](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-template.html) request * - * @param {string} id - The ID of the job to create - * @param {object} body - The job configuration + * @param {string} id - Template ID + * @param {object} body - The document */ const acceptedQuerystring = [ - + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ] const snakeCase = { - + errorTrace: 'error_trace', + filterPath: 'filter_path' } - return function xpackRollupPutJob (params, options, callback) { + return function putTemplate (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -52,6 +57,15 @@ function buildXpackRollupPutJob (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + putTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['id'] == null) { return callback( @@ -89,7 +103,7 @@ function buildXpackRollupPutJob (opts) { var path = '' - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + path = '/' + '_search' + '/' + 'template' + '/' + encodeURIComponent(id) // build request object const request = { @@ -130,4 +144,4 @@ function buildXpackRollupPutJob (opts) { } } -module.exports = buildXpackRollupPutJob +module.exports = buildPutTemplate diff --git a/api/api/reindex.js b/api/api/reindex.js index 7e797517c..6060f3a3c 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -26,7 +26,7 @@ function buildReindex (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) request + * Perform a [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-reindex.html) request * * @param {boolean} refresh - Should the effected indexes be refreshed? * @param {time} timeout - Time each individual bulk request should wait for shards that are unavailable. @@ -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 0f57fb38a..6799d5547 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -26,7 +26,7 @@ function buildReindexRethrottle (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [reindex_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) request + * Perform a [reindex_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-reindex.html) request * * @param {string} task_id - The task id to rethrottle * @param {number} requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. @@ -59,13 +59,16 @@ function buildReindexRethrottle (opts) { options = {} } - // check required parameters - if (params['task_id'] == null && params['taskId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: task_id or taskId'), - result - ) + // 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['requests_per_second'] == null && params['requestsPerSecond'] == null) { return callback( new ConfigurationError('Missing required parameter: requests_per_second or requestsPerSecond'), @@ -102,7 +105,13 @@ function buildReindexRethrottle (opts) { var path = '' - path = '/' + '_reindex' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle' + if ((task_id || taskId) != null) { + path = '/' + '_reindex' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle' + } else if ((task_id || taskId) != null) { + path = '/' + '_update_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle' + } else { + path = '/' + '_delete_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle' + } // build request object const request = { diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index c9eab13bf..68f6bd8b3 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -26,7 +26,7 @@ function buildRenderSearchTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [render_search_template](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html) request + * Perform a [render_search_template](http://www.elasticsearch.org/guide/en/elasticsearch/reference/5.x/search-template.html) request * * @param {string} id - The id of the stored search template * @param {object} body - The search definition template and its params @@ -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 deleted file mode 100644 index 526bae884..000000000 --- a/api/api/scripts_painless_execute.js +++ /dev/null @@ -1,123 +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 buildScriptsPainlessExecute (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [scripts_painless_execute](https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html) request - * - * @param {object} body - The script to execute - */ - - const acceptedQuerystring = [ - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ] - - const snakeCase = { - errorTrace: 'error_trace', - filterPath: 'filter_path' - } - - return function scriptsPainlessExecute (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 } = params - var querystring = semicopy(params, ['method', 'body']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_scripts' + '/' + 'painless' + '/' + '_execute' - - // 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, - querystring: options.querystring || 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 = buildScriptsPainlessExecute diff --git a/api/api/scroll.js b/api/api/scroll.js index 8be7d558f..2175b7c06 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -26,19 +26,17 @@ function buildScroll (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request + * Perform a [scroll](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-request-scroll.html) request * * @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 {object} body - The scroll ID if not passed by URL or query parameter. */ const acceptedQuerystring = [ 'scroll', 'scroll_id', - 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', @@ -48,7 +46,6 @@ function buildScroll (opts) { const snakeCase = { scrollId: 'scroll_id', - restTotalHitsAsInt: 'rest_total_hits_as_int', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -65,6 +62,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 34d6f11c5..976772366 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -26,21 +26,20 @@ function buildSearch (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [search](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html) request + * Perform a [search](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-search.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @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 * @param {list} stored_fields - A comma-separated list of stored fields to return as part of a hit * @param {list} docvalue_fields - A comma-separated list of fields to return as the docvalue representation of a field for each hit + * @param {list} fielddata_fields - A comma-separated list of fields to return as the docvalue representation of a field for each hit * @param {number} from - Starting offset (default: 0) * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) - * @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled * @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} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored @@ -52,8 +51,8 @@ function buildSearch (opts) { * @param {number} size - Number of hits to return (default: 10) * @param {list} sort - A comma-separated list of : pairs * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} terminate_after - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. * @param {list} stats - Specific 'tag' of the request for logging and statistical purposes * @param {string} suggest_field - Specify which field to use for suggestions @@ -62,31 +61,26 @@ function buildSearch (opts) { * @param {string} suggest_text - The source text for which the suggestions should be returned * @param {time} timeout - Explicit operation timeout * @param {boolean} track_scores - Whether to calculate and return scores even if they are not used for sorting - * @param {boolean} track_total_hits - Indicate if the number of documents that match the query should be tracked - * @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 {object} body - The search definition using the Query DSL */ const acceptedQuerystring = [ 'analyzer', 'analyze_wildcard', - 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', + 'fielddata_fields', 'from', 'ignore_unavailable', - 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', @@ -98,8 +92,8 @@ function buildSearch (opts) { 'size', 'sort', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'terminate_after', 'stats', 'suggest_field', @@ -108,16 +102,12 @@ function buildSearch (opts) { 'suggest_text', 'timeout', 'track_scores', - 'track_total_hits', - 'allow_partial_search_results', 'typed_keys', 'version', - 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', - 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', @@ -127,32 +117,27 @@ function buildSearch (opts) { const snakeCase = { analyzeWildcard: 'analyze_wildcard', - ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', + fielddataFields: 'fielddata_fields', ignoreUnavailable: 'ignore_unavailable', - ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', suggestSize: 'suggest_size', suggestText: 'suggest_text', trackScores: 'track_scores', - 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', preFilterShardSize: 'pre_filter_shard_size', - restTotalHitsAsInt: 'rest_total_hits_as_int', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -169,6 +154,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 626362e0c..1664ecb04 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -26,9 +26,10 @@ function buildSearchShards (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [search_shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html) request + * Perform a [search_shards](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-shards.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) * @param {string} routing - Specific routing value * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) @@ -71,6 +72,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( @@ -79,6 +89,14 @@ function buildSearchShards (opts) { ) } + // check required url components + if (params['type'] != null && (params['index'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: index'), + result + ) + } + // validate headers object if (options.headers != null && typeof options.headers !== 'object') { return callback( @@ -88,8 +106,8 @@ function buildSearchShards (opts) { } var warnings = null - var { method, body, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) + var { method, body, index, type } = params + var querystring = semicopy(params, ['method', 'body', 'index', 'type']) if (method == null) { method = body == null ? 'GET' : 'POST' @@ -102,7 +120,9 @@ function buildSearchShards (opts) { var path = '' - if ((index) != null) { + if ((index) != null && (type) != null) { + path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search_shards' + } else if ((index) != null) { path = '/' + encodeURIComponent(index) + '/' + '_search_shards' } else { path = '/' + '_search_shards' diff --git a/api/api/search_template.js b/api/api/search_template.js index b2526111f..a221619f0 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -26,12 +26,11 @@ function buildSearchTemplate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [search_template](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request + * Perform a [search_template](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) - * @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled * @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 {string} preference - Specify the node or shard the operation should be performed on (default: random) @@ -41,14 +40,11 @@ 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 {object} body - The search definition template and its params */ const acceptedQuerystring = [ 'ignore_unavailable', - 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'preference', @@ -58,8 +54,6 @@ function buildSearchTemplate (opts) { 'explain', 'profile', 'typed_keys', - 'rest_total_hits_as_int', - 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', @@ -69,13 +63,10 @@ function buildSearchTemplate (opts) { const snakeCase = { ignoreUnavailable: 'ignore_unavailable', - ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', typedKeys: 'typed_keys', - restTotalHitsAsInt: 'rest_total_hits_as_int', - ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -92,12 +83,13 @@ function buildSearchTemplate (opts) { options = {} } - // check required parameters - if (params['body'] == null) { - return callback( - new ConfigurationError('Missing required parameter: body'), - result - ) + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + searchTemplate(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) } // check required url components diff --git a/api/api/security.authenticate.js b/api/api/security.authenticate.js deleted file mode 100644 index 059d53407..000000000 --- a/api/api/security.authenticate.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 buildSecurityAuthenticate (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 - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityAuthenticate (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' + '/' + '_authenticate' - - // 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, - querystring: options.querystring || 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 = buildSecurityAuthenticate diff --git a/api/api/security.change_password.js b/api/api/security.change_password.js deleted file mode 100644 index dc6821250..000000000 --- a/api/api/security.change_password.js +++ /dev/null @@ -1,132 +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 buildSecurityChangePassword (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 - * - * @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. - * @param {object} body - the new password for the user - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityChangePassword (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, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((username) != null) { - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_password' - } else { - path = '/' + '_security' + '/' + 'user' + '/' + '_password' - } - - // 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, - querystring: options.querystring || 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 = buildSecurityChangePassword diff --git a/api/api/security.clear_cached_realms.js b/api/api/security.clear_cached_realms.js deleted file mode 100644 index 2b582625d..000000000 --- a/api/api/security.clear_cached_realms.js +++ /dev/null @@ -1,133 +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 buildSecurityClearCachedRealms (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 - * - * @param {list} realms - Comma-separated list of realms to clear - * @param {list} usernames - Comma-separated list of usernames to clear from the cache - */ - - const acceptedQuerystring = [ - 'usernames' - ] - - const snakeCase = { - - } - - return function securityClearCachedRealms (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['realms'] == null) { - return callback( - new ConfigurationError('Missing required parameter: realms'), - result - ) - } - 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, realms } = params - var querystring = semicopy(params, ['method', 'body', 'realms']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'realm' + '/' + encodeURIComponent(realms) + '/' + '_clear_cache' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityClearCachedRealms diff --git a/api/api/security.clear_cached_roles.js b/api/api/security.clear_cached_roles.js deleted file mode 100644 index 83f0f2d13..000000000 --- a/api/api/security.clear_cached_roles.js +++ /dev/null @@ -1,132 +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 buildSecurityClearCachedRoles (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 - * - * @param {list} name - Role name - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityClearCachedRoles (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['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) - } - 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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) + '/' + '_clear_cache' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityClearCachedRoles diff --git a/api/api/security.create_api_key.js b/api/api/security.create_api_key.js deleted file mode 100644 index 02ea19cef..000000000 --- a/api/api/security.create_api_key.js +++ /dev/null @@ -1,127 +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, - querystring: options.querystring || 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.delete_privileges.js b/api/api/security.delete_privileges.js deleted file mode 100644 index eb723e919..000000000 --- a/api/api/security.delete_privileges.js +++ /dev/null @@ -1,148 +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 buildSecurityDeletePrivileges (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [security.delete_privileges](TODO) request - * - * @param {string} application - Application name - * @param {string} name - Privilege 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. - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityDeletePrivileges (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['application'] == null) { - return callback( - new ConfigurationError('Missing required parameter: application'), - result - ) - } - if (params['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) - } - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // check required url components - if (params['name'] != null && (params['application'] == null)) { - return callback( - new ConfigurationError('Missing required parameter of the url: application'), - 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, application, name } = params - var querystring = semicopy(params, ['method', 'body', 'application', 'name']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityDeletePrivileges diff --git a/api/api/security.delete_role.js b/api/api/security.delete_role.js deleted file mode 100644 index 614d657bb..000000000 --- a/api/api/security.delete_role.js +++ /dev/null @@ -1,133 +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 buildSecurityDeleteRole (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 - * - * @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. - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityDeleteRole (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['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) - } - 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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityDeleteRole diff --git a/api/api/security.delete_role_mapping.js b/api/api/security.delete_role_mapping.js deleted file mode 100644 index d082607b9..000000000 --- a/api/api/security.delete_role_mapping.js +++ /dev/null @@ -1,133 +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 buildSecurityDeleteRoleMapping (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 - * - * @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. - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityDeleteRoleMapping (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['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) - } - 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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityDeleteRoleMapping diff --git a/api/api/security.delete_user.js b/api/api/security.delete_user.js deleted file mode 100644 index 3f73bf54a..000000000 --- a/api/api/security.delete_user.js +++ /dev/null @@ -1,133 +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 buildSecurityDeleteUser (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 - * - * @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. - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityDeleteUser (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['username'] == null) { - return callback( - new ConfigurationError('Missing required parameter: username'), - result - ) - } - 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, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityDeleteUser diff --git a/api/api/security.disable_user.js b/api/api/security.disable_user.js deleted file mode 100644 index d674ba848..000000000 --- a/api/api/security.disable_user.js +++ /dev/null @@ -1,127 +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 buildSecurityDisableUser (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 - * - * @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. - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityDisableUser (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, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_disable' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityDisableUser diff --git a/api/api/security.enable_user.js b/api/api/security.enable_user.js deleted file mode 100644 index d5f647d9b..000000000 --- a/api/api/security.enable_user.js +++ /dev/null @@ -1,127 +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 buildSecurityEnableUser (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 - * - * @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. - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityEnableUser (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, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) + '/' + '_enable' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildSecurityEnableUser diff --git a/api/api/security.get_api_key.js b/api/api/security.get_api_key.js deleted file mode 100644 index f7de8f7dd..000000000 --- a/api/api/security.get_api_key.js +++ /dev/null @@ -1,132 +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, - querystring: options.querystring || 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.get_privileges.js b/api/api/security.get_privileges.js deleted file mode 100644 index 00c53e602..000000000 --- a/api/api/security.get_privileges.js +++ /dev/null @@ -1,141 +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 buildSecurityGetPrivileges (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [security.get_privileges](TODO) request - * - * @param {string} application - Application name - * @param {string} name - Privilege name - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityGetPrivileges (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 - ) - } - - // check required url components - if (params['name'] != null && (params['application'] == null)) { - return callback( - new ConfigurationError('Missing required parameter of the url: application'), - 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, application, name } = params - var querystring = semicopy(params, ['method', 'body', 'application', 'name']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if (application && name) { - path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) + '/' + encodeURIComponent(name) - } else if (application) { - path = '/' + '_security' + '/' + 'privilege' + '/' + encodeURIComponent(application) - } else { - path = '/' + '_security' + '/' + 'privilege' - } - - // 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, - querystring: options.querystring || 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 = buildSecurityGetPrivileges diff --git a/api/api/security.get_role.js b/api/api/security.get_role.js deleted file mode 100644 index a6cdc6c6e..000000000 --- a/api/api/security.get_role.js +++ /dev/null @@ -1,130 +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 buildSecurityGetRole (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 - * - * @param {string} name - Role name - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityGetRole (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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((name) != null) { - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) - } else { - path = '/' + '_security' + '/' + 'role' - } - - // 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, - querystring: options.querystring || 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 = buildSecurityGetRole diff --git a/api/api/security.get_role_mapping.js b/api/api/security.get_role_mapping.js deleted file mode 100644 index 075807d41..000000000 --- a/api/api/security.get_role_mapping.js +++ /dev/null @@ -1,130 +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 buildSecurityGetRoleMapping (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 - * - * @param {string} name - Role-Mapping name - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityGetRoleMapping (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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((name) != null) { - path = '/' + '_security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) - } else { - path = '/' + '_security' + '/' + 'role_mapping' - } - - // 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, - querystring: options.querystring || 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 = buildSecurityGetRoleMapping diff --git a/api/api/security.get_token.js b/api/api/security.get_token.js deleted file mode 100644 index b2959d182..000000000 --- a/api/api/security.get_token.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 buildSecurityGetToken (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 - * - * @param {object} body - The token request to get - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityGetToken (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'oauth2' + '/' + 'token' - - // 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, - querystring: options.querystring || 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 = buildSecurityGetToken diff --git a/api/api/security.get_user.js b/api/api/security.get_user.js deleted file mode 100644 index 0e37134c1..000000000 --- a/api/api/security.get_user.js +++ /dev/null @@ -1,130 +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 buildSecurityGetUser (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 - * - * @param {list} username - A comma-separated list of usernames - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityGetUser (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, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((username) != null) { - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) - } else { - path = '/' + '_security' + '/' + 'user' - } - - // 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, - querystring: options.querystring || 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 = buildSecurityGetUser diff --git a/api/api/security.get_user_privileges.js b/api/api/security.get_user_privileges.js deleted file mode 100644 index 2d60ce988..000000000 --- a/api/api/security.get_user_privileges.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 buildSecurityGetUserPrivileges (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 - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityGetUserPrivileges (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' + '/' + 'user' + '/' + '_privileges' - - // 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, - querystring: options.querystring || 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 = buildSecurityGetUserPrivileges diff --git a/api/api/security.has_privileges.js b/api/api/security.has_privileges.js deleted file mode 100644 index 79ef497f8..000000000 --- a/api/api/security.has_privileges.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 buildSecurityHasPrivileges (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 - * - * @param {string} user - Username - * @param {object} body - The privileges to test - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityHasPrivileges (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, user } = params - var querystring = semicopy(params, ['method', 'body', 'user']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((user) != null) { - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(user) + '/' + '_has_privileges' - } else { - path = '/' + '_security' + '/' + 'user' + '/' + '_has_privileges' - } - - // 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, - querystring: options.querystring || 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 = buildSecurityHasPrivileges diff --git a/api/api/security.invalidate_api_key.js b/api/api/security.invalidate_api_key.js deleted file mode 100644 index 89f972510..000000000 --- a/api/api/security.invalidate_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 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, - querystring: options.querystring || 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/security.invalidate_token.js b/api/api/security.invalidate_token.js deleted file mode 100644 index b5b89f17e..000000000 --- a/api/api/security.invalidate_token.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 buildSecurityInvalidateToken (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 - * - * @param {object} body - The token to invalidate - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function securityInvalidateToken (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' + '/' + 'oauth2' + '/' + 'token' - - // 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, - querystring: options.querystring || 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 = buildSecurityInvalidateToken diff --git a/api/api/security.put_privileges.js b/api/api/security.put_privileges.js deleted file mode 100644 index 53103ed5e..000000000 --- a/api/api/security.put_privileges.js +++ /dev/null @@ -1,127 +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 buildSecurityPutPrivileges (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [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 - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityPutPrivileges (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' + '/' + 'privilege' - - // 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, - querystring: options.querystring || 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 = buildSecurityPutPrivileges diff --git a/api/api/security.put_role.js b/api/api/security.put_role.js deleted file mode 100644 index 637a867f5..000000000 --- a/api/api/security.put_role.js +++ /dev/null @@ -1,134 +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 buildSecurityPutRole (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 - * - * @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. - * @param {object} body - The role to add - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityPutRole (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['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) - } - 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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'role' + '/' + encodeURIComponent(name) - - // 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, - querystring: options.querystring || 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 = buildSecurityPutRole diff --git a/api/api/security.put_role_mapping.js b/api/api/security.put_role_mapping.js deleted file mode 100644 index 38ec0a9b9..000000000 --- a/api/api/security.put_role_mapping.js +++ /dev/null @@ -1,134 +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 buildSecurityPutRoleMapping (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 - * - * @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. - * @param {object} body - The role to add - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityPutRoleMapping (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['name'] == null) { - return callback( - new ConfigurationError('Missing required parameter: name'), - result - ) - } - 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, name } = params - var querystring = semicopy(params, ['method', 'body', 'name']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'role_mapping' + '/' + encodeURIComponent(name) - - // 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, - querystring: options.querystring || 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 = buildSecurityPutRoleMapping diff --git a/api/api/security.put_user.js b/api/api/security.put_user.js deleted file mode 100644 index ff5302995..000000000 --- a/api/api/security.put_user.js +++ /dev/null @@ -1,134 +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 buildSecurityPutUser (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 - * - * @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. - * @param {object} body - The user to add - */ - - const acceptedQuerystring = [ - 'refresh' - ] - - const snakeCase = { - - } - - return function securityPutUser (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['username'] == null) { - return callback( - new ConfigurationError('Missing required parameter: username'), - result - ) - } - 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, username } = params - var querystring = semicopy(params, ['method', 'body', 'username']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_security' + '/' + 'user' + '/' + encodeURIComponent(username) - - // 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, - querystring: options.querystring || 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 = buildSecurityPutUser diff --git a/api/api/snapshot.create.js b/api/api/snapshot.create.js index 9e97940e1..c18011b3b 100644 --- a/api/api/snapshot.create.js +++ b/api/api/snapshot.create.js @@ -26,7 +26,7 @@ function buildSnapshotCreate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.create](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {string} repository - A repository name * @param {string} snapshot - A snapshot name @@ -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 0f8116a23..0febaf2fd 100644 --- a/api/api/snapshot.create_repository.js +++ b/api/api/snapshot.create_repository.js @@ -26,7 +26,7 @@ function buildSnapshotCreateRepository (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.create_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.create_repository](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {string} repository - A repository name * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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 147ad9b91..f83012bd4 100644 --- a/api/api/snapshot.delete.js +++ b/api/api/snapshot.delete.js @@ -26,7 +26,7 @@ function buildSnapshotDelete (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.delete](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {string} repository - A repository name * @param {string} snapshot - A snapshot name @@ -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 44d404291..bd189c720 100644 --- a/api/api/snapshot.delete_repository.js +++ b/api/api/snapshot.delete_repository.js @@ -26,7 +26,7 @@ function buildSnapshotDeleteRepository (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.delete_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.delete_repository](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {list} repository - A comma-separated list of repository names * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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 6a5fcbd91..f207cf377 100644 --- a/api/api/snapshot.get.js +++ b/api/api/snapshot.get.js @@ -26,7 +26,7 @@ function buildSnapshotGet (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.get](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {string} repository - A repository name * @param {list} snapshot - A comma-separated list of snapshot names @@ -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 1a44e9e95..227771291 100644 --- a/api/api/snapshot.get_repository.js +++ b/api/api/snapshot.get_repository.js @@ -26,7 +26,7 @@ function buildSnapshotGetRepository (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.get_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.get_repository](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {list} repository - A comma-separated list of repository names * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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 42e17b74a..d7939c9a4 100644 --- a/api/api/snapshot.restore.js +++ b/api/api/snapshot.restore.js @@ -26,7 +26,7 @@ function buildSnapshotRestore (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.restore](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.restore](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {string} repository - A repository name * @param {string} snapshot - A snapshot name @@ -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 2bccc42c7..343b9e5fc 100644 --- a/api/api/snapshot.status.js +++ b/api/api/snapshot.status.js @@ -26,7 +26,7 @@ function buildSnapshotStatus (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.status](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.status](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {string} repository - A repository name * @param {list} snapshot - A comma-separated list of snapshot names @@ -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 84809ca55..657515f86 100644 --- a/api/api/snapshot.verify_repository.js +++ b/api/api/snapshot.verify_repository.js @@ -26,7 +26,7 @@ function buildSnapshotVerifyRepository (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [snapshot.verify_repository](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html) request + * Perform a [snapshot.verify_repository](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/modules-snapshots.html) request * * @param {string} repository - A repository name * @param {time} master_timeout - Explicit operation timeout for connection to master node @@ -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/ssl.certificates.js b/api/api/ssl.certificates.js deleted file mode 100644 index f0db7f494..000000000 --- a/api/api/ssl.certificates.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 buildSslCertificates (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 - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function sslCertificates (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 = '/' + '_ssl' + '/' + 'certificates' - - // 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, - querystring: options.querystring || 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 = buildSslCertificates diff --git a/api/api/rank_eval.js b/api/api/suggest.js similarity index 81% rename from api/api/rank_eval.js rename to api/api/suggest.js index c2960ad33..6b482d605 100644 --- a/api/api/rank_eval.js +++ b/api/api/suggest.js @@ -22,23 +22,27 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildRankEval (opts) { +function buildSuggest (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [rank_eval](https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html) request + * Perform a [suggest](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/search-suggesters.html) request * - * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {list} index - A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices * @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 - The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. + * @param {string} preference - Specify the node or shard the operation should be performed on (default: random) + * @param {string} routing - Specific routing value + * @param {object} body - The request definition */ const acceptedQuerystring = [ 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'preference', + 'routing', 'pretty', 'human', 'error_trace', @@ -54,7 +58,7 @@ function buildRankEval (opts) { filterPath: 'filter_path' } - return function rankEval (params, options, callback) { + return function suggest (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -66,6 +70,15 @@ function buildRankEval (opts) { options = {} } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + suggest(params, options, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + // check required parameters if (params['body'] == null) { return callback( @@ -87,7 +100,7 @@ function buildRankEval (opts) { var querystring = semicopy(params, ['method', 'body', 'index']) if (method == null) { - method = body == null ? 'GET' : 'POST' + method = 'POST' } var ignore = options.ignore || null @@ -98,9 +111,9 @@ function buildRankEval (opts) { var path = '' if ((index) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_rank_eval' + path = '/' + encodeURIComponent(index) + '/' + '_suggest' } else { - path = '/' + '_rank_eval' + path = '/' + '_suggest' } // build request object @@ -142,4 +155,4 @@ function buildRankEval (opts) { } } -module.exports = buildRankEval +module.exports = buildSuggest diff --git a/api/api/tasks.cancel.js b/api/api/tasks.cancel.js index 1b9591b8b..5dec64c62 100644 --- a/api/api/tasks.cancel.js +++ b/api/api/tasks.cancel.js @@ -26,17 +26,19 @@ function buildTasksCancel (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [tasks.cancel](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request + * Perform a [tasks.cancel](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tasks.html) request * * @param {string} task_id - Cancel the task with specified task id (node_id:task_number) * @param {list} nodes - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {list} actions - A comma-separated list of actions that should be cancelled. Leave empty to cancel all. + * @param {string} parent_node - Cancel tasks with specified parent node. * @param {string} parent_task_id - Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. */ const acceptedQuerystring = [ 'nodes', 'actions', + 'parent_node', 'parent_task_id', 'pretty', 'human', @@ -46,6 +48,7 @@ function buildTasksCancel (opts) { ] const snakeCase = { + parentNode: 'parent_node', parentTaskId: 'parent_task_id', errorTrace: 'error_trace', filterPath: 'filter_path' @@ -63,6 +66,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 317b8a1ad..ac8cba2a6 100644 --- a/api/api/tasks.get.js +++ b/api/api/tasks.get.js @@ -26,16 +26,14 @@ function buildTasksGet (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [tasks.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request + * Perform a [tasks.get](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tasks.html) request * * @param {string} task_id - Return the task with specified id (node_id:task_number) * @param {boolean} wait_for_completion - Wait for the matching tasks to complete (default: false) - * @param {time} timeout - Explicit operation timeout */ const acceptedQuerystring = [ 'wait_for_completion', - 'timeout', 'pretty', 'human', 'error_trace', @@ -61,13 +59,16 @@ function buildTasksGet (opts) { options = {} } - // check required parameters - if (params['task_id'] == null && params['taskId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: task_id or taskId'), - result - ) + // 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.body != null) { return callback( new ConfigurationError('This API does not require a body'), diff --git a/api/api/tasks.list.js b/api/api/tasks.list.js index 9b4f74c2a..8c833ba66 100644 --- a/api/api/tasks.list.js +++ b/api/api/tasks.list.js @@ -26,25 +26,25 @@ function buildTasksList (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [tasks.list](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request + * Perform a [tasks.list](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/tasks.html) request * * @param {list} nodes - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes * @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all. * @param {boolean} detailed - Return detailed task information (default: false) + * @param {string} parent_node - Return tasks with specified parent node. * @param {string} parent_task_id - Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. * @param {boolean} wait_for_completion - Wait for the matching tasks to complete (default: false) * @param {enum} group_by - Group tasks by nodes or parent/child relationships - * @param {time} timeout - Explicit operation timeout */ const acceptedQuerystring = [ 'nodes', 'actions', 'detailed', + 'parent_node', 'parent_task_id', 'wait_for_completion', 'group_by', - 'timeout', 'pretty', 'human', 'error_trace', @@ -53,6 +53,7 @@ function buildTasksList (opts) { ] const snakeCase = { + parentNode: 'parent_node', parentTaskId: 'parent_task_id', waitForCompletion: 'wait_for_completion', groupBy: 'group_by', @@ -72,6 +73,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 af6aaac5d..0a756d965 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -26,7 +26,7 @@ function buildTermvectors (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [termvectors](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html) request + * Perform a [termvectors](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-termvectors.html) request * * @param {string} index - The index in which the document resides. * @param {string} type - The type of the document. @@ -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 93953cc4f..9bbabc04c 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -26,39 +26,45 @@ function buildUpdate (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [update](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html) request + * Perform a [update](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-update.html) request * * @param {string} id - Document ID * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {string} lang - The script language (default: painless) * @param {string} parent - ID of the parent document. Is is only used for routing and when for the upsert request * @param {enum} refresh - If `true` then refresh the effected 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` (the default) then do nothing with refreshes. * @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 {object} body - The request definition requires either `script` or partial `doc` + * @param {time} timestamp - Explicit timestamp for the document + * @param {time} ttl - Expiration time for the document + * @param {number} version - Explicit version number for concurrency control + * @param {enum} version_type - Specific version type + * @param {object} body - The request definition using either `script` or partial `doc` */ const acceptedQuerystring = [ 'wait_for_active_shards', + 'fields', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'lang', 'parent', 'refresh', 'retry_on_conflict', 'routing', 'timeout', - 'if_seq_no', - 'if_primary_term', + 'timestamp', + 'ttl', + 'version', + 'version_type', 'pretty', 'human', 'error_trace', @@ -68,11 +74,10 @@ function buildUpdate (opts) { const snakeCase = { waitForActiveShards: 'wait_for_active_shards', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', retryOnConflict: 'retry_on_conflict', - ifSeqNo: 'if_seq_no', - ifPrimaryTerm: 'if_primary_term', + versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } @@ -89,6 +94,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,9 +116,9 @@ function buildUpdate (opts) { result ) } - if (params['body'] == null) { + if (params['type'] == null) { return callback( - new ConfigurationError('Missing required parameter: body'), + new ConfigurationError('Missing required parameter: type'), result ) } @@ -132,11 +146,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 9d8a35cfb..e0119a956 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -26,7 +26,7 @@ function buildUpdateByQuery (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, result } = opts /** - * Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html) request + * Perform a [update_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-update-by-query.html) request * * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types @@ -50,8 +50,8 @@ function buildUpdateByQuery (opts) { * @param {number} size - Number of hits to return (default: 10) * @param {list} sort - A comma-separated list of : pairs * @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 + * @param {list} _source_exclude - A list of fields to exclude from the returned _source field + * @param {list} _source_include - A list of fields to extract and return from the _source field * @param {number} terminate_after - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. * @param {list} stats - Specific 'tag' of the request for logging and statistical purposes * @param {boolean} version - Specify whether to return document version as part of a hit @@ -60,7 +60,7 @@ function buildUpdateByQuery (opts) { * @param {boolean} refresh - Should the effected indexes be refreshed? * @param {time} timeout - Time each individual bulk request should wait for shards that are unavailable. * @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the update by query 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 {number} scroll_size - Size on the scroll request powering the update by query + * @param {number} scroll_size - Size on the scroll request powering the update_by_query * @param {boolean} wait_for_completion - Should the request should block until the update by query operation is complete. * @param {number} requests_per_second - The throttle to set on this request in sub-requests per second. -1 means no throttle. * @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. @@ -88,8 +88,8 @@ function buildUpdateByQuery (opts) { 'size', 'sort', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'terminate_after', 'stats', 'version', @@ -117,8 +117,8 @@ function buildUpdateByQuery (opts) { expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', - _sourceExcludes: '_source_excludes', - _sourceIncludes: '_source_includes', + _sourceExclude: '_source_exclude', + _sourceInclude: '_source_include', terminateAfter: 'terminate_after', versionType: 'version_type', requestCache: 'request_cache', @@ -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 deleted file mode 100644 index a145cad85..000000000 --- a/api/api/update_by_query_rethrottle.js +++ /dev/null @@ -1,146 +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 buildUpdateByQueryRethrottle (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [update_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html) request - * - * @param {string} task_id - The task id to rethrottle - * @param {number} requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. - */ - - const acceptedQuerystring = [ - 'requests_per_second', - 'pretty', - 'human', - 'error_trace', - 'source', - 'filter_path' - ] - - const snakeCase = { - requestsPerSecond: 'requests_per_second', - errorTrace: 'error_trace', - filterPath: 'filter_path' - } - - return function updateByQueryRethrottle (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['task_id'] == null && params['taskId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: task_id or taskId'), - result - ) - } - if (params['requests_per_second'] == null && params['requestsPerSecond'] == null) { - return callback( - new ConfigurationError('Missing required parameter: requests_per_second or requestsPerSecond'), - result - ) - } - 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, taskId, task_id } = params - var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_update_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildUpdateByQueryRethrottle diff --git a/api/api/xpack.graph.explore.js b/api/api/xpack.graph.explore.js deleted file mode 100644 index f7caa9c62..000000000 --- a/api/api/xpack.graph.explore.js +++ /dev/null @@ -1,135 +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 buildXpackGraphExplore (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request - * - * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types - * @param {string} routing - Specific routing value - * @param {time} timeout - Explicit operation timeout - * @param {object} body - Graph Query DSL - */ - - const acceptedQuerystring = [ - 'routing', - 'timeout' - ] - - const snakeCase = { - - } - - return function xpackGraphExplore (params, options, callback) { - options = options || {} - if (typeof options === 'function') { - callback = options - options = {} - } - if (typeof params === 'function' || params == null) { - callback = params - params = {} - options = {} - } - - // check required url components - if (params['type'] != null && (params['index'] == null)) { - return callback( - new ConfigurationError('Missing required parameter of the url: index'), - 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, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_graph' + '/' + 'explore' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_graph' + '/' + 'explore' - } - - // 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, - querystring: options.querystring || 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 = buildXpackGraphExplore diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js deleted file mode 100644 index 4deabca16..000000000 --- a/api/api/xpack.info.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 buildXpackInfo (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.info](https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html) request - * - * @param {list} categories - Comma-separated list of info categories. Can be any of: build, license, features - */ - - const acceptedQuerystring = [ - 'categories' - ] - - const snakeCase = { - - } - - return function xpackInfo (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 = '/' + '_xpack' - - // 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, - querystring: options.querystring || 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 = buildXpackInfo diff --git a/api/api/xpack.license.delete.js b/api/api/xpack.license.delete.js deleted file mode 100644 index c7366ebf4..000000000 --- a/api/api/xpack.license.delete.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 buildXpackLicenseDelete (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackLicenseDelete (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 = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_license' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackLicenseDelete diff --git a/api/api/xpack.license.get.js b/api/api/xpack.license.get.js deleted file mode 100644 index 7e24b49e2..000000000 --- a/api/api/xpack.license.get.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 buildXpackLicenseGet (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request - * - * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) - */ - - const acceptedQuerystring = [ - 'local' - ] - - const snakeCase = { - - } - - return function xpackLicenseGet (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 = '/' + '_license' - - // 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, - querystring: options.querystring || 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 = buildXpackLicenseGet diff --git a/api/api/xpack.license.get_basic_status.js b/api/api/xpack.license.get_basic_status.js deleted file mode 100644 index e7895c6aa..000000000 --- a/api/api/xpack.license.get_basic_status.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 buildXpackLicenseGetBasicStatus (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackLicenseGetBasicStatus (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 = '/' + '_license' + '/' + 'basic_status' - - // 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, - querystring: options.querystring || 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 = buildXpackLicenseGetBasicStatus diff --git a/api/api/xpack.license.get_trial_status.js b/api/api/xpack.license.get_trial_status.js deleted file mode 100644 index d1033f4b1..000000000 --- a/api/api/xpack.license.get_trial_status.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 buildXpackLicenseGetTrialStatus (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackLicenseGetTrialStatus (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 = '/' + '_license' + '/' + 'trial_status' - - // 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, - querystring: options.querystring || 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 = buildXpackLicenseGetTrialStatus diff --git a/api/api/xpack.license.post.js b/api/api/xpack.license.post.js deleted file mode 100644 index 1387d62eb..000000000 --- a/api/api/xpack.license.post.js +++ /dev/null @@ -1,119 +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 buildXpackLicensePost (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request - * - * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) - * @param {object} body - licenses to be installed - */ - - const acceptedQuerystring = [ - 'acknowledge' - ] - - const snakeCase = { - - } - - return function xpackLicensePost (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 } = 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 = '/' + '_license' - - // 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, - querystring: options.querystring || 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 = buildXpackLicensePost diff --git a/api/api/xpack.license.post_start_basic.js b/api/api/xpack.license.post_start_basic.js deleted file mode 100644 index 8d238a767..000000000 --- a/api/api/xpack.license.post_start_basic.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 buildXpackLicensePostStartBasic (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request - * - * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) - */ - - const acceptedQuerystring = [ - 'acknowledge' - ] - - const snakeCase = { - - } - - return function xpackLicensePostStartBasic (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_license' + '/' + 'start_basic' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackLicensePostStartBasic diff --git a/api/api/xpack.license.post_start_trial.js b/api/api/xpack.license.post_start_trial.js deleted file mode 100644 index de7464523..000000000 --- a/api/api/xpack.license.post_start_trial.js +++ /dev/null @@ -1,128 +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 buildXpackLicensePostStartTrial (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request - * - * @param {string} type - The type of trial license to generate (default: "trial") - * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) - */ - - const acceptedQuerystring = [ - 'type', - 'acknowledge' - ] - - const snakeCase = { - - } - - return function xpackLicensePostStartTrial (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_license' + '/' + 'start_trial' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackLicensePostStartTrial diff --git a/api/api/xpack.migration.deprecations.js b/api/api/xpack.migration.deprecations.js deleted file mode 100644 index e327d423f..000000000 --- a/api/api/xpack.migration.deprecations.js +++ /dev/null @@ -1,130 +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 buildXpackMigrationDeprecations (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request - * - * @param {string} index - Index pattern - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackMigrationDeprecations (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, 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 = '' - - if ((index) != null) { - path = '/' + encodeURIComponent(index) + '/' + '_migration' + '/' + 'deprecations' - } else { - path = '/' + '_migration' + '/' + 'deprecations' - } - - // 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, - querystring: options.querystring || 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 = buildXpackMigrationDeprecations diff --git a/api/api/xpack.migration.upgrade.js b/api/api/xpack.migration.upgrade.js deleted file mode 100644 index dc2a60df4..000000000 --- a/api/api/xpack.migration.upgrade.js +++ /dev/null @@ -1,127 +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 buildXpackMigrationUpgrade (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.migration.upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html) request - * - * @param {string} index - The name of the index - * @param {boolean} wait_for_completion - Should the request block until the upgrade operation is completed - */ - - const acceptedQuerystring = [ - 'wait_for_completion' - ] - - const snakeCase = { - waitForCompletion: 'wait_for_completion' - } - - return function xpackMigrationUpgrade (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['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - 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, index } = params - var querystring = semicopy(params, ['method', 'body', 'index']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_migration' + '/' + 'upgrade' + '/' + encodeURIComponent(index) - - // 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, - querystring: options.querystring || 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 = buildXpackMigrationUpgrade diff --git a/api/api/xpack.rollup.delete_job.js b/api/api/xpack.rollup.delete_job.js deleted file mode 100644 index 3d77ee8c7..000000000 --- a/api/api/xpack.rollup.delete_job.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 buildXpackRollupDeleteJob (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.rollup.delete_job]() request - * - * @param {string} id - The ID of the job to delete - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackRollupDeleteJob (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['id'] == null) { - return callback( - new ConfigurationError('Missing required parameter: id'), - 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, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) - - if (method == null) { - method = 'DELETE' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) - - // 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, - querystring: options.querystring || 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 = buildXpackRollupDeleteJob diff --git a/api/api/xpack.rollup.get_jobs.js b/api/api/xpack.rollup.get_jobs.js deleted file mode 100644 index fb5114caa..000000000 --- a/api/api/xpack.rollup.get_jobs.js +++ /dev/null @@ -1,122 +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 buildXpackRollupGetJobs (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.rollup.get_jobs]() request - * - * @param {string} id - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackRollupGetJobs (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, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((id) != null) { - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) - } else { - path = '/' + '_rollup' + '/' + 'job' - } - - // 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, - querystring: options.querystring || 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 = buildXpackRollupGetJobs diff --git a/api/api/xpack.rollup.get_rollup_caps.js b/api/api/xpack.rollup.get_rollup_caps.js deleted file mode 100644 index bef13c957..000000000 --- a/api/api/xpack.rollup.get_rollup_caps.js +++ /dev/null @@ -1,122 +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 buildXpackRollupGetRollupCaps (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.rollup.get_rollup_caps]() request - * - * @param {string} id - The ID of the index to check rollup capabilities on, or left blank for all jobs - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackRollupGetRollupCaps (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, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((id) != null) { - path = '/' + '_rollup' + '/' + 'data' + '/' + encodeURIComponent(id) - } else { - path = '/' + '_rollup' + '/' + 'data' - } - - // 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, - querystring: options.querystring || 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 = buildXpackRollupGetRollupCaps diff --git a/api/api/xpack.rollup.get_rollup_index_caps.js b/api/api/xpack.rollup.get_rollup_index_caps.js deleted file mode 100644 index 2f077fb0b..000000000 --- a/api/api/xpack.rollup.get_rollup_index_caps.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 buildXpackRollupGetRollupIndexCaps (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.rollup.get_rollup_index_caps]() request - * - * @param {string} index - The rollup index or index pattern to obtain rollup capabilities from. - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackRollupGetRollupIndexCaps (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['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - 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, 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) + '/' + '_rollup' + '/' + 'data' - - // 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, - querystring: options.querystring || 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 = buildXpackRollupGetRollupIndexCaps diff --git a/api/api/xpack.rollup.rollup_search.js b/api/api/xpack.rollup.rollup_search.js deleted file mode 100644 index bc6f2d6f4..000000000 --- a/api/api/xpack.rollup.rollup_search.js +++ /dev/null @@ -1,150 +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 buildXpackRollupRollupSearch (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.rollup.rollup_search]() request - * - * @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' - ] - - const snakeCase = { - typedKeys: 'typed_keys', - restTotalHitsAsInt: 'rest_total_hits_as_int' - } - - return function xpackRollupRollupSearch (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['index'] == null) { - return callback( - new ConfigurationError('Missing required parameter: index'), - result - ) - } - if (params['body'] == null) { - return callback( - new ConfigurationError('Missing required parameter: body'), - result - ) - } - - // check required url components - if (params['type'] != null && (params['index'] == null)) { - return callback( - new ConfigurationError('Missing required parameter of the url: index'), - 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, index, type } = params - var querystring = semicopy(params, ['method', 'body', 'index', 'type']) - - if (method == null) { - method = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((index) != null && (type) != null) { - path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_rollup_search' - } else { - path = '/' + encodeURIComponent(index) + '/' + '_rollup_search' - } - - // 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, - querystring: options.querystring || 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 = buildXpackRollupRollupSearch diff --git a/api/api/xpack.rollup.start_job.js b/api/api/xpack.rollup.start_job.js deleted file mode 100644 index afb962c18..000000000 --- a/api/api/xpack.rollup.start_job.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 buildXpackRollupStartJob (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.rollup.start_job]() request - * - * @param {string} id - The ID of the job to start - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackRollupStartJob (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['id'] == null) { - return callback( - new ConfigurationError('Missing required parameter: id'), - 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, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_start' - - // 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, - querystring: options.querystring || 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 = buildXpackRollupStartJob diff --git a/api/api/xpack.rollup.stop_job.js b/api/api/xpack.rollup.stop_job.js deleted file mode 100644 index 480a7f7a5..000000000 --- a/api/api/xpack.rollup.stop_job.js +++ /dev/null @@ -1,130 +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 buildXpackRollupStopJob (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.rollup.stop_job]() request - * - * @param {string} id - The ID of the job to stop - * @param {boolean} wait_for_completion - True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false. - * @param {time} timeout - Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. - */ - - const acceptedQuerystring = [ - 'wait_for_completion', - 'timeout' - ] - - const snakeCase = { - waitForCompletion: 'wait_for_completion' - - } - - return function xpackRollupStopJob (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['id'] == null) { - return callback( - new ConfigurationError('Missing required parameter: id'), - 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, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) - - if (method == null) { - method = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_stop' - - // 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, - querystring: options.querystring || 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 = buildXpackRollupStopJob diff --git a/api/api/xpack.sql.clear_cursor.js b/api/api/xpack.sql.clear_cursor.js deleted file mode 100644 index 791290054..000000000 --- a/api/api/xpack.sql.clear_cursor.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 buildXpackSqlClearCursor (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.sql.clear_cursor](Clear SQL cursor) request - * - * @param {object} body - Specify the cursor value in the `cursor` element to clean the cursor. - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackSqlClearCursor (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_sql' + '/' + 'close' - - // 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, - querystring: options.querystring || 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 = buildXpackSqlClearCursor diff --git a/api/api/xpack.sql.query.js b/api/api/xpack.sql.query.js deleted file mode 100644 index 00a1e8fbc..000000000 --- a/api/api/xpack.sql.query.js +++ /dev/null @@ -1,127 +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 buildXpackSqlQuery (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.sql.query](Execute SQL) request - * - * @param {string} format - a short version of the Accept header, e.g. json, yaml - * @param {object} body - Use the `query` element to start a query. Use the `cursor` element to continue a query. - */ - - const acceptedQuerystring = [ - 'format' - ] - - const snakeCase = { - - } - - return function xpackSqlQuery (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 = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_sql' - - // 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, - querystring: options.querystring || 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 = buildXpackSqlQuery diff --git a/api/api/xpack.sql.translate.js b/api/api/xpack.sql.translate.js deleted file mode 100644 index 72ad0a9dd..000000000 --- a/api/api/xpack.sql.translate.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 buildXpackSqlTranslate (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.sql.translate](Translate SQL into Elasticsearch queries) request - * - * @param {object} body - Specify the query in the `query` element. - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackSqlTranslate (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 = body == null ? 'GET' : 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_sql' + '/' + 'translate' - - // 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, - querystring: options.querystring || 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 = buildXpackSqlTranslate diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js deleted file mode 100644 index 6a7b19ca7..000000000 --- a/api/api/xpack.usage.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 buildXpackUsage (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.usage](Retrieve information about xpack features usage) request - * - * @param {time} master_timeout - Specify timeout for watch write operation - */ - - const acceptedQuerystring = [ - 'master_timeout' - ] - - const snakeCase = { - masterTimeout: 'master_timeout' - } - - return function xpackUsage (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 = '/' + '_xpack' + '/' + 'usage' - - // 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, - querystring: options.querystring || 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 = buildXpackUsage diff --git a/api/api/xpack.watcher.ack_watch.js b/api/api/xpack.watcher.ack_watch.js deleted file mode 100644 index eeaa468b1..000000000 --- a/api/api/xpack.watcher.ack_watch.js +++ /dev/null @@ -1,145 +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 buildXpackWatcherAckWatch (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request - * - * @param {string} watch_id - Watch ID - * @param {list} action_id - A comma-separated list of the action ids to be acked - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackWatcherAckWatch (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['watch_id'] == null && params['watchId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: watch_id or watchId'), - result - ) - } - if (params.body != null) { - return callback( - new ConfigurationError('This API does not require a body'), - result - ) - } - - // check required url components - if ((params['action_id'] != null || params['actionId'] != null) && ((params['watch_id'] == null && params['watchId'] == null))) { - return callback( - new ConfigurationError('Missing required parameter of the url: watch_id'), - 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, watchId, watch_id, actionId, action_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id', 'actionId', 'action_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((watch_id || watchId) != null && (action_id || actionId) != null) { - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack' + '/' + encodeURIComponent(action_id || actionId) - } else { - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack' - } - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackWatcherAckWatch diff --git a/api/api/xpack.watcher.activate_watch.js b/api/api/xpack.watcher.activate_watch.js deleted file mode 100644 index 9b8f38920..000000000 --- a/api/api/xpack.watcher.activate_watch.js +++ /dev/null @@ -1,132 +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 buildXpackWatcherActivateWatch (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = 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 - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackWatcherActivateWatch (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['watch_id'] == null && params['watchId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: watch_id or watchId'), - result - ) - } - 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, watchId, watch_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_activate' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackWatcherActivateWatch diff --git a/api/api/xpack.watcher.deactivate_watch.js b/api/api/xpack.watcher.deactivate_watch.js deleted file mode 100644 index 802afa22d..000000000 --- a/api/api/xpack.watcher.deactivate_watch.js +++ /dev/null @@ -1,132 +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 buildXpackWatcherDeactivateWatch (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = 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 - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackWatcherDeactivateWatch (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['watch_id'] == null && params['watchId'] == null) { - return callback( - new ConfigurationError('Missing required parameter: watch_id or watchId'), - result - ) - } - 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, watchId, watch_id } = params - var querystring = semicopy(params, ['method', 'body', 'watchId', 'watch_id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_deactivate' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackWatcherDeactivateWatch diff --git a/api/api/xpack.watcher.execute_watch.js b/api/api/xpack.watcher.execute_watch.js deleted file mode 100644 index 72834af21..000000000 --- a/api/api/xpack.watcher.execute_watch.js +++ /dev/null @@ -1,124 +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 buildXpackWatcherExecuteWatch (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request - * - * @param {string} id - Watch ID - * @param {boolean} debug - indicates whether the watch should execute in debug mode - * @param {object} body - Execution control - */ - - const acceptedQuerystring = [ - 'debug' - ] - - const snakeCase = { - - } - - return function xpackWatcherExecuteWatch (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, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((id) != null) { - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + '/' + '_execute' - } else { - path = '/' + '_watcher' + '/' + 'watch' + '/' + '_execute' - } - - // 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, - querystring: options.querystring || 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 = buildXpackWatcherExecuteWatch diff --git a/api/api/xpack.watcher.put_watch.js b/api/api/xpack.watcher.put_watch.js deleted file mode 100644 index 11b610f48..000000000 --- a/api/api/xpack.watcher.put_watch.js +++ /dev/null @@ -1,135 +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 buildXpackWatcherPutWatch (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = 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 {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 = [ - 'active', - 'version', - 'if_seq_no', - 'if_primary_term' - ] - - const snakeCase = { - ifSeqNo: 'if_seq_no', - ifPrimaryTerm: 'if_primary_term' - } - - return function xpackWatcherPutWatch (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['id'] == null) { - return callback( - new ConfigurationError('Missing required parameter: id'), - 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, id } = params - var querystring = semicopy(params, ['method', 'body', 'id']) - - if (method == null) { - method = 'PUT' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) - - // 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, - querystring: options.querystring || 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 = buildXpackWatcherPutWatch diff --git a/api/api/xpack.watcher.start.js b/api/api/xpack.watcher.start.js deleted file mode 100644 index c41a36d2d..000000000 --- a/api/api/xpack.watcher.start.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 buildXpackWatcherStart (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackWatcherStart (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_watcher' + '/' + '_start' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackWatcherStart diff --git a/api/api/xpack.watcher.stats.js b/api/api/xpack.watcher.stats.js deleted file mode 100644 index 3d9b63373..000000000 --- a/api/api/xpack.watcher.stats.js +++ /dev/null @@ -1,133 +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 buildXpackWatcherStats (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request - * - * @param {enum} metric - Controls what additional stat metrics should be include in the response - * @param {enum} metric - Controls what additional stat metrics should be include in the response - * @param {boolean} emit_stacktraces - Emits stack traces of currently running watches - */ - - const acceptedQuerystring = [ - 'metric', - 'emit_stacktraces' - ] - - const snakeCase = { - emitStacktraces: 'emit_stacktraces' - } - - return function xpackWatcherStats (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, metric } = params - var querystring = semicopy(params, ['method', 'body', 'metric']) - - if (method == null) { - method = 'GET' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - if ((metric) != null) { - path = '/' + '_watcher' + '/' + 'stats' + '/' + encodeURIComponent(metric) - } else { - path = '/' + '_watcher' + '/' + 'stats' - } - - // 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, - querystring: options.querystring || 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 = buildXpackWatcherStats diff --git a/api/api/xpack.watcher.stop.js b/api/api/xpack.watcher.stop.js deleted file mode 100644 index ffe797922..000000000 --- a/api/api/xpack.watcher.stop.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 buildXpackWatcherStop (opts) { - // eslint-disable-next-line no-unused-vars - const { makeRequest, ConfigurationError, result } = opts - /** - * Perform a [xpack.watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request - * - */ - - const acceptedQuerystring = [ - - ] - - const snakeCase = { - - } - - return function xpackWatcherStop (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 = 'POST' - } - - var ignore = options.ignore || null - if (typeof ignore === 'number') { - ignore = [ignore] - } - - var path = '' - - path = '/' + '_watcher' + '/' + '_stop' - - // build request object - const request = { - method, - path, - body: '', - querystring - } - - const requestOptions = { - ignore, - requestTimeout: options.requestTimeout || null, - maxRetries: options.maxRetries || null, - asStream: options.asStream || false, - headers: options.headers || null, - querystring: options.querystring || 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 = buildXpackWatcherStop diff --git a/api/index.js b/api/index.js index f45a8ccdb..d3e9259e1 100644 --- a/api/index.js +++ b/api/index.js @@ -52,25 +52,6 @@ function ESAPI (opts) { thread_pool: lazyLoad('cat.thread_pool', opts), threadPool: lazyLoad('cat.thread_pool', opts) }, - ccr: { - delete_auto_follow_pattern: lazyLoad('ccr.delete_auto_follow_pattern', opts), - deleteAutoFollowPattern: lazyLoad('ccr.delete_auto_follow_pattern', opts), - follow: lazyLoad('ccr.follow', opts), - follow_info: lazyLoad('ccr.follow_info', opts), - followInfo: lazyLoad('ccr.follow_info', opts), - follow_stats: lazyLoad('ccr.follow_stats', opts), - followStats: lazyLoad('ccr.follow_stats', opts), - get_auto_follow_pattern: lazyLoad('ccr.get_auto_follow_pattern', opts), - getAutoFollowPattern: lazyLoad('ccr.get_auto_follow_pattern', opts), - pause_follow: lazyLoad('ccr.pause_follow', opts), - pauseFollow: lazyLoad('ccr.pause_follow', opts), - put_auto_follow_pattern: lazyLoad('ccr.put_auto_follow_pattern', opts), - putAutoFollowPattern: lazyLoad('ccr.put_auto_follow_pattern', opts), - resume_follow: lazyLoad('ccr.resume_follow', opts), - resumeFollow: lazyLoad('ccr.resume_follow', opts), - stats: lazyLoad('ccr.stats', opts), - unfollow: lazyLoad('ccr.unfollow', opts) - }, clear_scroll: lazyLoad('clear_scroll', opts), clearScroll: lazyLoad('clear_scroll', opts), cluster: { @@ -90,44 +71,31 @@ function ESAPI (opts) { stats: lazyLoad('cluster.stats', opts) }, count: lazyLoad('count', opts), + count_percolate: lazyLoad('count_percolate', opts), + countPercolate: lazyLoad('count_percolate', opts), create: lazyLoad('create', opts), delete: lazyLoad('delete', opts), delete_by_query: lazyLoad('delete_by_query', opts), deleteByQuery: lazyLoad('delete_by_query', opts), - delete_by_query_rethrottle: lazyLoad('delete_by_query_rethrottle', opts), - deleteByQueryRethrottle: lazyLoad('delete_by_query_rethrottle', opts), delete_script: lazyLoad('delete_script', opts), deleteScript: lazyLoad('delete_script', opts), + delete_template: lazyLoad('delete_template', opts), + deleteTemplate: lazyLoad('delete_template', opts), exists: lazyLoad('exists', opts), exists_source: lazyLoad('exists_source', opts), existsSource: lazyLoad('exists_source', opts), explain: lazyLoad('explain', opts), field_caps: lazyLoad('field_caps', opts), fieldCaps: lazyLoad('field_caps', opts), + field_stats: lazyLoad('field_stats', opts), + fieldStats: lazyLoad('field_stats', opts), get: lazyLoad('get', opts), get_script: lazyLoad('get_script', opts), getScript: lazyLoad('get_script', opts), get_source: lazyLoad('get_source', opts), getSource: lazyLoad('get_source', opts), - ilm: { - delete_lifecycle: lazyLoad('ilm.delete_lifecycle', opts), - deleteLifecycle: lazyLoad('ilm.delete_lifecycle', opts), - explain_lifecycle: lazyLoad('ilm.explain_lifecycle', opts), - explainLifecycle: lazyLoad('ilm.explain_lifecycle', opts), - get_lifecycle: lazyLoad('ilm.get_lifecycle', opts), - getLifecycle: lazyLoad('ilm.get_lifecycle', opts), - get_status: lazyLoad('ilm.get_status', opts), - getStatus: lazyLoad('ilm.get_status', opts), - move_to_step: lazyLoad('ilm.move_to_step', opts), - moveToStep: lazyLoad('ilm.move_to_step', opts), - put_lifecycle: lazyLoad('ilm.put_lifecycle', opts), - putLifecycle: lazyLoad('ilm.put_lifecycle', opts), - remove_policy: lazyLoad('ilm.remove_policy', opts), - removePolicy: lazyLoad('ilm.remove_policy', opts), - retry: lazyLoad('ilm.retry', opts), - start: lazyLoad('ilm.start', opts), - stop: lazyLoad('ilm.stop', opts) - }, + get_template: lazyLoad('get_template', opts), + getTemplate: lazyLoad('get_template', opts), index: lazyLoad('index', opts), indices: { analyze: lazyLoad('indices.analyze', opts), @@ -151,7 +119,6 @@ function ESAPI (opts) { flush_synced: lazyLoad('indices.flush_synced', opts), flushSynced: lazyLoad('indices.flush_synced', opts), forcemerge: lazyLoad('indices.forcemerge', opts), - freeze: lazyLoad('indices.freeze', opts), get: lazyLoad('indices.get', opts), get_alias: lazyLoad('indices.get_alias', opts), getAlias: lazyLoad('indices.get_alias', opts), @@ -181,9 +148,7 @@ function ESAPI (opts) { shard_stores: lazyLoad('indices.shard_stores', opts), shardStores: lazyLoad('indices.shard_stores', opts), shrink: lazyLoad('indices.shrink', opts), - split: lazyLoad('indices.split', opts), stats: lazyLoad('indices.stats', opts), - unfreeze: lazyLoad('indices.unfreeze', opts), update_aliases: lazyLoad('indices.update_aliases', opts), updateAliases: lazyLoad('indices.update_aliases', opts), upgrade: lazyLoad('indices.upgrade', opts), @@ -203,100 +168,7 @@ function ESAPI (opts) { simulate: lazyLoad('ingest.simulate', opts) }, mget: lazyLoad('mget', opts), - ml: { - close_job: lazyLoad('ml.close_job', opts), - closeJob: lazyLoad('ml.close_job', opts), - delete_calendar: lazyLoad('ml.delete_calendar', opts), - deleteCalendar: lazyLoad('ml.delete_calendar', opts), - delete_calendar_event: lazyLoad('ml.delete_calendar_event', opts), - deleteCalendarEvent: lazyLoad('ml.delete_calendar_event', opts), - delete_calendar_job: lazyLoad('ml.delete_calendar_job', opts), - deleteCalendarJob: lazyLoad('ml.delete_calendar_job', opts), - delete_datafeed: lazyLoad('ml.delete_datafeed', opts), - deleteDatafeed: lazyLoad('ml.delete_datafeed', opts), - delete_expired_data: lazyLoad('ml.delete_expired_data', opts), - deleteExpiredData: lazyLoad('ml.delete_expired_data', opts), - delete_filter: lazyLoad('ml.delete_filter', opts), - deleteFilter: lazyLoad('ml.delete_filter', opts), - delete_forecast: lazyLoad('ml.delete_forecast', opts), - deleteForecast: lazyLoad('ml.delete_forecast', opts), - delete_job: lazyLoad('ml.delete_job', opts), - deleteJob: lazyLoad('ml.delete_job', opts), - delete_model_snapshot: lazyLoad('ml.delete_model_snapshot', opts), - deleteModelSnapshot: lazyLoad('ml.delete_model_snapshot', opts), - find_file_structure: lazyLoad('ml.find_file_structure', opts), - findFileStructure: lazyLoad('ml.find_file_structure', opts), - flush_job: lazyLoad('ml.flush_job', opts), - flushJob: lazyLoad('ml.flush_job', opts), - forecast: lazyLoad('ml.forecast', opts), - get_buckets: lazyLoad('ml.get_buckets', opts), - getBuckets: lazyLoad('ml.get_buckets', opts), - get_calendar_events: lazyLoad('ml.get_calendar_events', opts), - getCalendarEvents: lazyLoad('ml.get_calendar_events', opts), - get_calendars: lazyLoad('ml.get_calendars', opts), - getCalendars: lazyLoad('ml.get_calendars', opts), - get_categories: lazyLoad('ml.get_categories', opts), - getCategories: lazyLoad('ml.get_categories', opts), - get_datafeed_stats: lazyLoad('ml.get_datafeed_stats', opts), - getDatafeedStats: lazyLoad('ml.get_datafeed_stats', opts), - get_datafeeds: lazyLoad('ml.get_datafeeds', opts), - getDatafeeds: lazyLoad('ml.get_datafeeds', opts), - get_filters: lazyLoad('ml.get_filters', opts), - getFilters: lazyLoad('ml.get_filters', opts), - get_influencers: lazyLoad('ml.get_influencers', opts), - getInfluencers: lazyLoad('ml.get_influencers', opts), - get_job_stats: lazyLoad('ml.get_job_stats', opts), - getJobStats: lazyLoad('ml.get_job_stats', opts), - get_jobs: lazyLoad('ml.get_jobs', opts), - getJobs: lazyLoad('ml.get_jobs', opts), - get_model_snapshots: lazyLoad('ml.get_model_snapshots', opts), - getModelSnapshots: lazyLoad('ml.get_model_snapshots', opts), - get_overall_buckets: lazyLoad('ml.get_overall_buckets', opts), - getOverallBuckets: lazyLoad('ml.get_overall_buckets', opts), - get_records: lazyLoad('ml.get_records', opts), - getRecords: lazyLoad('ml.get_records', opts), - info: lazyLoad('ml.info', opts), - open_job: lazyLoad('ml.open_job', opts), - openJob: lazyLoad('ml.open_job', opts), - post_calendar_events: lazyLoad('ml.post_calendar_events', opts), - postCalendarEvents: lazyLoad('ml.post_calendar_events', opts), - post_data: lazyLoad('ml.post_data', opts), - postData: lazyLoad('ml.post_data', opts), - preview_datafeed: lazyLoad('ml.preview_datafeed', opts), - previewDatafeed: lazyLoad('ml.preview_datafeed', opts), - put_calendar: lazyLoad('ml.put_calendar', opts), - putCalendar: lazyLoad('ml.put_calendar', opts), - put_calendar_job: lazyLoad('ml.put_calendar_job', opts), - putCalendarJob: lazyLoad('ml.put_calendar_job', opts), - put_datafeed: lazyLoad('ml.put_datafeed', opts), - putDatafeed: lazyLoad('ml.put_datafeed', opts), - put_filter: lazyLoad('ml.put_filter', opts), - putFilter: lazyLoad('ml.put_filter', opts), - put_job: lazyLoad('ml.put_job', opts), - putJob: lazyLoad('ml.put_job', opts), - revert_model_snapshot: lazyLoad('ml.revert_model_snapshot', opts), - revertModelSnapshot: lazyLoad('ml.revert_model_snapshot', opts), - set_upgrade_mode: lazyLoad('ml.set_upgrade_mode', opts), - setUpgradeMode: lazyLoad('ml.set_upgrade_mode', opts), - start_datafeed: lazyLoad('ml.start_datafeed', opts), - startDatafeed: lazyLoad('ml.start_datafeed', opts), - stop_datafeed: lazyLoad('ml.stop_datafeed', opts), - stopDatafeed: lazyLoad('ml.stop_datafeed', opts), - update_datafeed: lazyLoad('ml.update_datafeed', opts), - updateDatafeed: lazyLoad('ml.update_datafeed', opts), - update_filter: lazyLoad('ml.update_filter', opts), - updateFilter: lazyLoad('ml.update_filter', opts), - update_job: lazyLoad('ml.update_job', opts), - updateJob: lazyLoad('ml.update_job', opts), - update_model_snapshot: lazyLoad('ml.update_model_snapshot', opts), - updateModelSnapshot: lazyLoad('ml.update_model_snapshot', opts), - validate: lazyLoad('ml.validate', opts), - validate_detector: lazyLoad('ml.validate_detector', opts), - validateDetector: lazyLoad('ml.validate_detector', opts) - }, - monitoring: { - bulk: lazyLoad('monitoring.bulk', opts) - }, + mpercolate: lazyLoad('mpercolate', opts), msearch: lazyLoad('msearch', opts), msearch_template: lazyLoad('msearch_template', opts), msearchTemplate: lazyLoad('msearch_template', opts), @@ -305,80 +177,25 @@ function ESAPI (opts) { hot_threads: lazyLoad('nodes.hot_threads', opts), hotThreads: lazyLoad('nodes.hot_threads', opts), info: lazyLoad('nodes.info', opts), - reload_secure_settings: lazyLoad('nodes.reload_secure_settings', opts), - reloadSecureSettings: lazyLoad('nodes.reload_secure_settings', opts), - stats: lazyLoad('nodes.stats', opts), - usage: lazyLoad('nodes.usage', opts) + stats: lazyLoad('nodes.stats', opts) }, + percolate: lazyLoad('percolate', opts), ping: lazyLoad('ping', opts), put_script: lazyLoad('put_script', opts), putScript: lazyLoad('put_script', opts), - rank_eval: lazyLoad('rank_eval', opts), - rankEval: lazyLoad('rank_eval', opts), + put_template: lazyLoad('put_template', opts), + putTemplate: lazyLoad('put_template', opts), reindex: lazyLoad('reindex', opts), reindex_rethrottle: lazyLoad('reindex_rethrottle', opts), reindexRethrottle: lazyLoad('reindex_rethrottle', opts), render_search_template: lazyLoad('render_search_template', opts), renderSearchTemplate: lazyLoad('render_search_template', opts), - scripts_painless_execute: lazyLoad('scripts_painless_execute', opts), - scriptsPainlessExecute: lazyLoad('scripts_painless_execute', opts), scroll: lazyLoad('scroll', opts), search: lazyLoad('search', opts), search_shards: lazyLoad('search_shards', opts), searchShards: lazyLoad('search_shards', opts), search_template: lazyLoad('search_template', opts), searchTemplate: lazyLoad('search_template', opts), - security: { - authenticate: lazyLoad('security.authenticate', opts), - change_password: lazyLoad('security.change_password', opts), - changePassword: lazyLoad('security.change_password', opts), - clear_cached_realms: lazyLoad('security.clear_cached_realms', opts), - clearCachedRealms: lazyLoad('security.clear_cached_realms', opts), - clear_cached_roles: lazyLoad('security.clear_cached_roles', opts), - clearCachedRoles: lazyLoad('security.clear_cached_roles', opts), - create_api_key: lazyLoad('security.create_api_key', opts), - createApiKey: lazyLoad('security.create_api_key', opts), - delete_privileges: lazyLoad('security.delete_privileges', opts), - deletePrivileges: lazyLoad('security.delete_privileges', opts), - delete_role: lazyLoad('security.delete_role', opts), - deleteRole: lazyLoad('security.delete_role', opts), - delete_role_mapping: lazyLoad('security.delete_role_mapping', opts), - deleteRoleMapping: lazyLoad('security.delete_role_mapping', opts), - delete_user: lazyLoad('security.delete_user', opts), - deleteUser: lazyLoad('security.delete_user', opts), - disable_user: lazyLoad('security.disable_user', opts), - disableUser: lazyLoad('security.disable_user', opts), - enable_user: lazyLoad('security.enable_user', opts), - enableUser: lazyLoad('security.enable_user', opts), - get_api_key: lazyLoad('security.get_api_key', opts), - getApiKey: lazyLoad('security.get_api_key', opts), - get_privileges: lazyLoad('security.get_privileges', opts), - getPrivileges: lazyLoad('security.get_privileges', opts), - get_role: lazyLoad('security.get_role', opts), - getRole: lazyLoad('security.get_role', opts), - get_role_mapping: lazyLoad('security.get_role_mapping', opts), - getRoleMapping: lazyLoad('security.get_role_mapping', opts), - get_token: lazyLoad('security.get_token', opts), - getToken: lazyLoad('security.get_token', opts), - get_user: lazyLoad('security.get_user', opts), - getUser: lazyLoad('security.get_user', opts), - get_user_privileges: lazyLoad('security.get_user_privileges', opts), - getUserPrivileges: lazyLoad('security.get_user_privileges', opts), - has_privileges: lazyLoad('security.has_privileges', opts), - hasPrivileges: lazyLoad('security.has_privileges', opts), - invalidate_api_key: lazyLoad('security.invalidate_api_key', opts), - invalidateApiKey: lazyLoad('security.invalidate_api_key', opts), - invalidate_token: lazyLoad('security.invalidate_token', opts), - invalidateToken: lazyLoad('security.invalidate_token', opts), - put_privileges: lazyLoad('security.put_privileges', opts), - putPrivileges: lazyLoad('security.put_privileges', opts), - put_role: lazyLoad('security.put_role', opts), - putRole: lazyLoad('security.put_role', opts), - put_role_mapping: lazyLoad('security.put_role_mapping', opts), - putRoleMapping: lazyLoad('security.put_role_mapping', opts), - put_user: lazyLoad('security.put_user', opts), - putUser: lazyLoad('security.put_user', opts) - }, snapshot: { create: lazyLoad('snapshot.create', opts), create_repository: lazyLoad('snapshot.create_repository', opts), @@ -394,9 +211,7 @@ function ESAPI (opts) { verify_repository: lazyLoad('snapshot.verify_repository', opts), verifyRepository: lazyLoad('snapshot.verify_repository', opts) }, - ssl: { - certificates: lazyLoad('ssl.certificates', opts) - }, + suggest: lazyLoad('suggest', opts), tasks: { cancel: lazyLoad('tasks.cancel', opts), get: lazyLoad('tasks.get', opts), @@ -405,78 +220,7 @@ function ESAPI (opts) { termvectors: lazyLoad('termvectors', opts), update: lazyLoad('update', opts), update_by_query: lazyLoad('update_by_query', opts), - updateByQuery: lazyLoad('update_by_query', opts), - update_by_query_rethrottle: lazyLoad('update_by_query_rethrottle', opts), - updateByQueryRethrottle: lazyLoad('update_by_query_rethrottle', opts), - xpack: { - graph: { - explore: lazyLoad('xpack.graph.explore', opts) - }, - info: lazyLoad('xpack.info', opts), - license: { - delete: lazyLoad('xpack.license.delete', opts), - get: lazyLoad('xpack.license.get', opts), - get_basic_status: lazyLoad('xpack.license.get_basic_status', opts), - getBasicStatus: lazyLoad('xpack.license.get_basic_status', opts), - get_trial_status: lazyLoad('xpack.license.get_trial_status', opts), - getTrialStatus: lazyLoad('xpack.license.get_trial_status', opts), - post: lazyLoad('xpack.license.post', opts), - post_start_basic: lazyLoad('xpack.license.post_start_basic', opts), - postStartBasic: lazyLoad('xpack.license.post_start_basic', opts), - post_start_trial: lazyLoad('xpack.license.post_start_trial', opts), - postStartTrial: lazyLoad('xpack.license.post_start_trial', opts) - }, - migration: { - deprecations: lazyLoad('xpack.migration.deprecations', opts), - get_assistance: lazyLoad('xpack.migration.get_assistance', opts), - getAssistance: lazyLoad('xpack.migration.get_assistance', opts), - upgrade: lazyLoad('xpack.migration.upgrade', opts) - }, - rollup: { - delete_job: lazyLoad('xpack.rollup.delete_job', opts), - deleteJob: lazyLoad('xpack.rollup.delete_job', opts), - get_jobs: lazyLoad('xpack.rollup.get_jobs', opts), - getJobs: lazyLoad('xpack.rollup.get_jobs', opts), - get_rollup_caps: lazyLoad('xpack.rollup.get_rollup_caps', opts), - getRollupCaps: lazyLoad('xpack.rollup.get_rollup_caps', opts), - get_rollup_index_caps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts), - getRollupIndexCaps: lazyLoad('xpack.rollup.get_rollup_index_caps', opts), - put_job: lazyLoad('xpack.rollup.put_job', opts), - putJob: lazyLoad('xpack.rollup.put_job', opts), - rollup_search: lazyLoad('xpack.rollup.rollup_search', opts), - rollupSearch: lazyLoad('xpack.rollup.rollup_search', opts), - start_job: lazyLoad('xpack.rollup.start_job', opts), - startJob: lazyLoad('xpack.rollup.start_job', opts), - stop_job: lazyLoad('xpack.rollup.stop_job', opts), - stopJob: lazyLoad('xpack.rollup.stop_job', opts) - }, - sql: { - clear_cursor: lazyLoad('xpack.sql.clear_cursor', opts), - clearCursor: lazyLoad('xpack.sql.clear_cursor', opts), - query: lazyLoad('xpack.sql.query', opts), - translate: lazyLoad('xpack.sql.translate', opts) - }, - usage: lazyLoad('xpack.usage', opts), - watcher: { - ack_watch: lazyLoad('xpack.watcher.ack_watch', opts), - ackWatch: lazyLoad('xpack.watcher.ack_watch', opts), - activate_watch: lazyLoad('xpack.watcher.activate_watch', opts), - activateWatch: lazyLoad('xpack.watcher.activate_watch', opts), - deactivate_watch: lazyLoad('xpack.watcher.deactivate_watch', opts), - deactivateWatch: lazyLoad('xpack.watcher.deactivate_watch', opts), - delete_watch: lazyLoad('xpack.watcher.delete_watch', opts), - deleteWatch: lazyLoad('xpack.watcher.delete_watch', opts), - execute_watch: lazyLoad('xpack.watcher.execute_watch', opts), - executeWatch: lazyLoad('xpack.watcher.execute_watch', opts), - get_watch: lazyLoad('xpack.watcher.get_watch', opts), - getWatch: lazyLoad('xpack.watcher.get_watch', opts), - put_watch: lazyLoad('xpack.watcher.put_watch', opts), - putWatch: lazyLoad('xpack.watcher.put_watch', opts), - start: lazyLoad('xpack.watcher.start', opts), - stats: lazyLoad('xpack.watcher.stats', opts), - stop: lazyLoad('xpack.watcher.stop', opts) - } - } + updateByQuery: lazyLoad('update_by_query', opts) } return apis diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 755fddf88..98410b4a5 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -34,9 +34,10 @@ 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[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; pipeline?: string; body: any; } @@ -212,7 +213,7 @@ export interface CatShards extends Generic { } export interface CatSnapshots extends Generic { - repository?: string | string[]; + repository: string | string[]; format?: string; ignore_unavailable?: boolean; master_timeout?: string; @@ -227,6 +228,7 @@ export interface CatTasks extends Generic { node_id?: string | string[]; actions?: string | string[]; detailed?: boolean; + parent_node?: string; parent_task?: number; h?: string | string[]; help?: boolean; @@ -285,7 +287,6 @@ export interface ClusterHealth extends Generic { wait_for_nodes?: string; wait_for_events?: 'immediate' | 'urgent' | 'high' | 'normal' | 'low' | 'languid'; wait_for_no_relocating_shards?: boolean; - wait_for_no_initializing_shards?: boolean; wait_for_status?: 'green' | 'yellow' | 'red'; } @@ -298,7 +299,7 @@ export interface ClusterPutSettings extends Generic { flat_settings?: boolean; master_timeout?: string; timeout?: string; - body: any; + body?: any; } export interface ClusterRemoteInfo extends Generic { @@ -320,8 +321,6 @@ export interface ClusterState extends Generic { local?: boolean; master_timeout?: string; flat_settings?: boolean; - wait_for_metadata_version?: number; - wait_for_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; @@ -337,7 +336,6 @@ export interface Count extends Generic { index?: string | string[]; type?: string | string[]; ignore_unavailable?: boolean; - ignore_throttled?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; min_score?: number; @@ -353,15 +351,33 @@ export interface Count extends Generic { body?: any; } +export interface CountPercolate extends Generic { + index: string; + type: string; + id?: string; + routing?: string | string[]; + preference?: string; + ignore_unavailable?: boolean; + allow_no_indices?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + percolate_index?: string; + percolate_type?: string; + version?: number; + version_type?: 'internal' | 'external' | 'external_gte' | 'force'; + body?: any; +} + 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'; routing?: string; timeout?: string; + timestamp?: string; + ttl?: string; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; pipeline?: string; @@ -371,14 +387,12 @@ 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'; routing?: string; timeout?: string; - if_seq_no?: number; - if_primary_term?: number; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } @@ -405,8 +419,8 @@ export interface DeleteByQuery extends Generic { size?: number; sort?: string | string[]; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; terminate_after?: number; stats?: string | string[]; version?: boolean; @@ -421,21 +435,21 @@ export interface DeleteByQuery extends Generic { body: any; } -export interface DeleteByQueryRethrottle extends Generic { - task_id: string; - requests_per_second: number; -} - export interface DeleteScript extends Generic { id: string; + lang: string; timeout?: string; master_timeout?: string; } +export interface DeleteTemplate extends Generic { + id: string; +} + export interface Exists extends Generic { id: string; index: string; - type?: string; + type: string; stored_fields?: string | string[]; parent?: string; preference?: string; @@ -443,8 +457,8 @@ export interface Exists extends Generic { refresh?: boolean; routing?: string; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } @@ -452,15 +466,15 @@ export interface Exists extends Generic { export interface ExistsSource extends Generic { id: string; index: string; - type?: string; + type: string; parent?: string; preference?: string; realtime?: boolean; refresh?: boolean; routing?: string; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } @@ -468,7 +482,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'; @@ -480,8 +494,8 @@ export interface Explain extends Generic { q?: string; routing?: string; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; body?: any; } @@ -491,12 +505,23 @@ export interface FieldCaps extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + body?: any; +} + +export interface FieldStats extends Generic { + index?: string | string[]; + fields?: string | string[]; + level?: 'indices' | 'cluster'; + 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; @@ -504,8 +529,6 @@ export interface Get extends Generic { refresh?: boolean; routing?: string; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; _source_exclude?: string | string[]; _source_include?: string | string[]; version?: number; @@ -514,56 +537,73 @@ export interface Get extends Generic { export interface GetScript extends Generic { id: string; - master_timeout?: string; + lang: string; } export interface GetSource extends Generic { id: string; index: string; - type?: string; + type: string; parent?: string; preference?: string; realtime?: boolean; refresh?: boolean; routing?: string; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; } +export interface GetTemplate extends Generic { + id: string; +} + export interface Index extends Generic { id?: string; index: string; - type?: string; + type: string; wait_for_active_shards?: string; op_type?: 'index' | 'create'; parent?: string; refresh?: 'true' | 'false' | 'wait_for'; routing?: string; timeout?: string; + timestamp?: string; + ttl?: string; version?: number; version_type?: 'internal' | 'external' | 'external_gte' | 'force'; - if_seq_no?: number; - if_primary_term?: number; pipeline?: string; body: any; } export interface IndicesAnalyze extends Generic { index?: string; + analyzer?: string; + char_filter?: string | string[]; + field?: string; + filter?: string | string[]; + prefer_local?: boolean; + text?: string | string[]; + tokenizer?: string; + explain?: boolean; + attributes?: string | string[]; + format?: 'detailed' | 'text'; body?: any; } 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'; + recycler?: boolean; + request_cache?: boolean; request?: boolean; } @@ -578,10 +618,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; } @@ -589,9 +629,6 @@ export interface IndicesDelete extends Generic { index: string | string[]; timeout?: string; master_timeout?: string; - ignore_unavailable?: boolean; - allow_no_indices?: boolean; - expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; } export interface IndicesDeleteAlias extends Generic { @@ -619,7 +656,7 @@ export interface IndicesExists extends Generic { export interface IndicesExistsAlias extends Generic { index?: string | string[]; - name: string | string[]; + name?: string | string[]; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; @@ -666,18 +703,19 @@ export interface IndicesForcemerge extends Generic { expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; max_num_segments?: number; only_expunge_deletes?: boolean; + operation_threading?: undefined; + wait_for_merge?: boolean; } export interface IndicesGet extends Generic { index: string | string[]; - include_type_name?: boolean; + feature?: string | string[]; local?: boolean; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; flat_settings?: boolean; include_defaults?: boolean; - master_timeout?: string; } export interface IndicesGetAlias extends Generic { @@ -693,7 +731,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,18 +741,15 @@ 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'; - master_timeout?: string; local?: boolean; } export interface IndicesGetSettings extends Generic { index?: string | string[]; name?: string | string[]; - master_timeout?: string; ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; @@ -726,7 +760,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; @@ -746,7 +779,6 @@ export interface IndicesOpen extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - wait_for_active_shards?: string; } export interface IndicesPutAlias extends Generic { @@ -759,20 +791,19 @@ 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; } export interface IndicesPutSettings extends Generic { index?: string | string[]; master_timeout?: string; - timeout?: string; preserve_existing?: boolean; ignore_unavailable?: boolean; allow_no_indices?: boolean; @@ -783,7 +814,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 +838,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; @@ -821,6 +850,7 @@ export interface IndicesSegments extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + operation_threading?: undefined; verbose?: boolean; } @@ -830,22 +860,12 @@ export interface IndicesShardStores extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + operation_threading?: undefined; } export interface IndicesShrink extends Generic { index: string; target: string; - copy_settings?: boolean; - timeout?: string; - master_timeout?: string; - wait_for_active_shards?: string; - body?: any; -} - -export interface IndicesSplit extends Generic { - index: string; - target: string; - copy_settings?: boolean; timeout?: string; master_timeout?: string; wait_for_active_shards?: string; @@ -886,6 +906,7 @@ export interface IndicesValidateQuery extends Generic { ignore_unavailable?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + operation_threading?: undefined; q?: string; analyzer?: string; analyze_wildcard?: boolean; @@ -936,8 +957,17 @@ export interface Mget extends Generic { refresh?: boolean; routing?: string; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; + body: any; +} + +export interface Mpercolate extends Generic { + index?: string; + type?: string; + ignore_unavailable?: boolean; + allow_no_indices?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; body: any; } @@ -948,9 +978,6 @@ export interface Msearch extends Generic { max_concurrent_searches?: number; typed_keys?: boolean; pre_filter_shard_size?: number; - max_concurrent_shard_requests?: number; - rest_total_hits_as_int?: boolean; - ccs_minimize_roundtrips?: boolean; body: any; } @@ -960,8 +987,6 @@ export interface MsearchTemplate extends Generic { search_type?: 'query_then_fetch' | 'query_and_fetch' | 'dfs_query_then_fetch' | 'dfs_query_and_fetch'; typed_keys?: boolean; max_concurrent_searches?: number; - rest_total_hits_as_int?: boolean; - ccs_minimize_roundtrips?: boolean; body: any; } @@ -1001,11 +1026,6 @@ export interface NodesInfo extends Generic { timeout?: string; } -export interface NodesReloadSecureSettings extends Generic { - node_id?: string | string[]; - timeout?: string; -} - export interface NodesStats extends Generic { metric?: string | string[]; index_metric?: string | string[]; @@ -1020,10 +1040,23 @@ export interface NodesStats extends Generic { include_segment_file_sizes?: boolean; } -export interface NodesUsage extends Generic { - metric?: string | string[]; - node_id?: string | string[]; - timeout?: string; +export interface Percolate extends Generic { + index: string; + type: string; + id?: string; + routing?: string | string[]; + preference?: string; + ignore_unavailable?: boolean; + allow_no_indices?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + percolate_index?: string; + percolate_type?: string; + percolate_routing?: string; + percolate_preference?: string; + percolate_format?: 'ids'; + version?: number; + version_type?: 'internal' | 'external' | 'external_gte' | 'force'; + body?: any; } export interface Ping extends Generic { @@ -1031,17 +1064,14 @@ export interface Ping extends Generic { export interface PutScript extends Generic { id: string; - context?: string; + lang: string; timeout?: string; master_timeout?: string; body: any; } -export interface RankEval extends Generic { - index?: string | string[]; - ignore_unavailable?: boolean; - allow_no_indices?: boolean; - expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; +export interface PutTemplate extends Generic { + id: string; body: any; } @@ -1056,7 +1086,7 @@ export interface Reindex extends Generic { } export interface ReindexRethrottle extends Generic { - task_id: string; + task_id?: string; requests_per_second: number; } @@ -1065,14 +1095,9 @@ export interface RenderSearchTemplate extends Generic { body?: any; } -export interface ScriptsPainlessExecute extends Generic { - body?: any; -} - export interface Scroll extends Generic { scroll_id?: string; scroll?: string; - rest_total_hits_as_int?: boolean; body?: any; } @@ -1081,15 +1106,14 @@ 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; stored_fields?: string | string[]; docvalue_fields?: string | string[]; + fielddata_fields?: string | string[]; from?: number; ignore_unavailable?: boolean; - ignore_throttled?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; lenient?: boolean; @@ -1101,8 +1125,8 @@ export interface Search extends Generic { size?: number; sort?: string | string[]; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; terminate_after?: number; stats?: string | string[]; suggest_field?: string; @@ -1111,21 +1135,18 @@ export interface Search extends Generic { suggest_text?: string; timeout?: string; track_scores?: boolean; - track_total_hits?: boolean; - 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; pre_filter_shard_size?: number; - rest_total_hits_as_int?: boolean; body?: any; } export interface SearchShards extends Generic { index?: string | string[]; + type?: string | string[]; preference?: string; routing?: string; local?: boolean; @@ -1138,7 +1159,6 @@ export interface SearchTemplate extends Generic { index?: string | string[]; type?: string | string[]; ignore_unavailable?: boolean; - ignore_throttled?: boolean; allow_no_indices?: boolean; expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; preference?: string; @@ -1148,9 +1168,7 @@ export interface SearchTemplate extends Generic { explain?: boolean; profile?: boolean; typed_keys?: boolean; - rest_total_hits_as_int?: boolean; - ccs_minimize_roundtrips?: boolean; - body: any; + body?: any; } export interface SnapshotCreate extends Generic { @@ -1216,32 +1234,42 @@ export interface SnapshotVerifyRepository extends Generic { timeout?: string; } +export interface Suggest extends Generic { + index?: string | string[]; + ignore_unavailable?: boolean; + allow_no_indices?: boolean; + expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; + preference?: string; + routing?: string; + body: any; +} + export interface TasksCancel extends Generic { task_id?: string; nodes?: string | string[]; actions?: string | string[]; + parent_node?: string; parent_task_id?: string; } export interface TasksGet extends Generic { - task_id: string; + task_id?: string; wait_for_completion?: boolean; - timeout?: string; } export interface TasksList extends Generic { nodes?: string | string[]; actions?: string | string[]; detailed?: boolean; + parent_node?: string; parent_task_id?: string; wait_for_completion?: boolean; - group_by?: 'nodes' | 'parents' | 'none'; - timeout?: string; + group_by?: 'nodes' | 'parents'; } export interface Termvectors extends Generic { index: string; - type?: string; + type: string; id?: string; term_statistics?: boolean; field_statistics?: boolean; @@ -1261,20 +1289,23 @@ 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[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; lang?: string; parent?: string; refresh?: 'true' | 'false' | 'wait_for'; retry_on_conflict?: number; routing?: string; timeout?: string; - if_seq_no?: number; - if_primary_term?: number; - body: any; + timestamp?: string; + ttl?: string; + version?: number; + version_type?: 'internal' | 'force'; + body?: any; } export interface UpdateByQuery extends Generic { @@ -1300,8 +1331,8 @@ export interface UpdateByQuery extends Generic { size?: number; sort?: string | string[]; _source?: string | string[]; - _source_excludes?: string | string[]; - _source_includes?: string | string[]; + _source_exclude?: string | string[]; + _source_include?: string | string[]; terminate_after?: number; stats?: string | string[]; version?: boolean; @@ -1316,706 +1347,3 @@ export interface UpdateByQuery extends Generic { slices?: number; body?: any; } - -export interface UpdateByQueryRethrottle extends Generic { - task_id: string; - requests_per_second: number; -} - -export interface CcrDeleteAutoFollowPattern extends Generic { - name: string; -} - -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[]; -} - -export interface CcrGetAutoFollowPattern extends Generic { - name?: string; -} - -export interface CcrPauseFollow extends Generic { - index: string; -} - -export interface CcrPutAutoFollowPattern extends Generic { - name: string; - body: any; -} - -export interface CcrResumeFollow extends Generic { - index: string; - body?: any; -} - -export interface CcrStats extends Generic { -} - -export interface CcrUnfollow extends Generic { - index: string; -} - -export interface IlmDeleteLifecycle extends Generic { - policy?: string; -} - -export interface IlmExplainLifecycle extends Generic { - index?: string; - human?: boolean; -} - -export interface IlmGetLifecycle extends Generic { - policy?: string; -} - -export interface IlmGetStatus extends Generic { -} - -export interface IlmMoveToStep extends Generic { - index?: string; - body?: any; -} - -export interface IlmPutLifecycle extends Generic { - policy?: string; - body?: any; -} - -export interface IlmRemovePolicy extends Generic { - index?: string; -} - -export interface IlmRetry extends Generic { - index?: string; -} - -export interface IlmStart extends Generic { -} - -export interface IlmStop extends Generic { -} - -export interface IndicesFreeze extends Generic { - index: string; - timeout?: string; - master_timeout?: string; - ignore_unavailable?: boolean; - allow_no_indices?: boolean; - expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - wait_for_active_shards?: string; -} - -export interface IndicesUnfreeze extends Generic { - index: string; - timeout?: string; - master_timeout?: string; - ignore_unavailable?: boolean; - allow_no_indices?: boolean; - expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - 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[]; - routing?: string; - timeout?: string; - body?: any; -} - -export interface XpackInfo extends Generic { - categories?: string | string[]; -} - -export interface XpackLicenseDelete extends Generic { -} - -export interface XpackLicenseGet extends Generic { - local?: boolean; -} - -export interface XpackLicenseGetBasicStatus extends Generic { -} - -export interface XpackLicenseGetTrialStatus extends Generic { -} - -export interface XpackLicensePost extends Generic { - acknowledge?: boolean; - body?: any; -} - -export interface XpackLicensePostStartBasic extends Generic { - acknowledge?: boolean; -} - -export interface XpackLicensePostStartTrial extends Generic { - type?: string; - acknowledge?: boolean; -} - -export interface XpackMigrationDeprecations extends Generic { - index?: string; -} - -export interface XpackMigrationGetAssistance extends Generic { - index?: string | string[]; - allow_no_indices?: boolean; - expand_wildcards?: 'open' | 'closed' | 'none' | 'all'; - ignore_unavailable?: boolean; -} - -export interface XpackMigrationUpgrade extends Generic { - index: string; - wait_for_completion?: boolean; -} - -export interface XpackRollupDeleteJob extends Generic { - id: string; -} - -export interface XpackRollupGetJobs extends Generic { - id?: string; -} - -export interface XpackRollupGetRollupCaps extends Generic { - id?: string; -} - -export interface XpackRollupGetRollupIndexCaps extends Generic { - index: string; -} - -export interface XpackRollupPutJob extends Generic { - id: string; - body: any; -} - -export interface XpackRollupRollupSearch extends Generic { - index: string; - type?: string; - typed_keys?: boolean; - rest_total_hits_as_int?: boolean; - body: any; -} - -export interface XpackRollupStartJob extends Generic { - id: string; -} - -export interface XpackRollupStopJob extends Generic { - id: string; - wait_for_completion?: boolean; - timeout?: string; -} - -export interface XpackSqlClearCursor extends Generic { - body: any; -} - -export interface XpackSqlQuery extends Generic { - format?: string; - body: any; -} - -export interface XpackSqlTranslate extends Generic { - body: any; -} - -export interface XpackUsage extends Generic { - master_timeout?: string; -} - -export interface XpackWatcherAckWatch extends Generic { - watch_id: string; - action_id?: string | string[]; -} - -export interface XpackWatcherActivateWatch extends Generic { - watch_id: string; -} - -export interface XpackWatcherDeactivateWatch extends Generic { - watch_id: string; -} - -export interface XpackWatcherDeleteWatch extends Generic { - id: string; -} - -export interface XpackWatcherExecuteWatch extends Generic { - id?: string; - debug?: boolean; - body?: any; -} - -export interface XpackWatcherGetWatch extends Generic { - id: string; -} - -export interface XpackWatcherPutWatch extends Generic { - id: string; - active?: boolean; - version?: number; - if_seq_no?: number; - if_primary_term?: number; - body?: any; -} - -export interface XpackWatcherStart extends Generic { -} - -export interface XpackWatcherStats extends Generic { - metric?: '_all' | 'queued_watches' | 'current_watches' | 'pending_watches'; - emit_stacktraces?: boolean; -} - -export interface XpackWatcherStop extends Generic { -}