API generation

This commit is contained in:
delvedor
2021-04-07 14:15:29 +02:00
parent 7fdfa4834f
commit 4102a28a0b
10 changed files with 1041 additions and 620 deletions

View File

@ -19,9 +19,13 @@
'use strict'
const AsyncSearchApi = require('./api/async_search')
const AutoscalingApi = require('./api/autoscaling')
const bulkApi = require('./api/bulk')
const CatApi = require('./api/cat')
const CcrApi = require('./api/ccr')
const clearScrollApi = require('./api/clear_scroll')
const closePointInTimeApi = require('./api/close_point_in_time')
const ClusterApi = require('./api/cluster')
const countApi = require('./api/count')
const createApi = require('./api/create')
@ -30,6 +34,8 @@ const deleteApi = require('./api/delete')
const deleteByQueryApi = require('./api/delete_by_query')
const deleteByQueryRethrottleApi = require('./api/delete_by_query_rethrottle')
const deleteScriptApi = require('./api/delete_script')
const EnrichApi = require('./api/enrich')
const EqlApi = require('./api/eql')
const existsApi = require('./api/exists')
const existsSourceApi = require('./api/exists_source')
const explainApi = require('./api/explain')
@ -40,85 +46,81 @@ const getScriptApi = require('./api/get_script')
const getScriptContextApi = require('./api/get_script_context')
const getScriptLanguagesApi = require('./api/get_script_languages')
const getSourceApi = require('./api/get_source')
const GraphApi = require('./api/graph')
const IlmApi = require('./api/ilm')
const indexApi = require('./api/index')
const IndicesApi = require('./api/indices')
const infoApi = require('./api/info')
const IngestApi = require('./api/ingest')
const LicenseApi = require('./api/license')
const LogstashApi = require('./api/logstash')
const mgetApi = require('./api/mget')
const MigrationApi = require('./api/migration')
const MlApi = require('./api/ml')
const MonitoringApi = require('./api/monitoring')
const msearchApi = require('./api/msearch')
const msearchTemplateApi = require('./api/msearch_template')
const mtermvectorsApi = require('./api/mtermvectors')
const NodesApi = require('./api/nodes')
const openPointInTimeApi = require('./api/open_point_in_time')
const pingApi = require('./api/ping')
const putScriptApi = require('./api/put_script')
const rankEvalApi = require('./api/rank_eval')
const reindexApi = require('./api/reindex')
const reindexRethrottleApi = require('./api/reindex_rethrottle')
const renderSearchTemplateApi = require('./api/render_search_template')
const RollupApi = require('./api/rollup')
const scriptsPainlessExecuteApi = require('./api/scripts_painless_execute')
const scrollApi = require('./api/scroll')
const searchApi = require('./api/search')
const searchShardsApi = require('./api/search_shards')
const searchTemplateApi = require('./api/search_template')
const SearchableSnapshotsApi = require('./api/searchable_snapshots')
const SecurityApi = require('./api/security')
const ShutdownApi = require('./api/shutdown')
const SlmApi = require('./api/slm')
const SnapshotApi = require('./api/snapshot')
const SqlApi = require('./api/sql')
const SslApi = require('./api/ssl')
const TasksApi = require('./api/tasks')
const termvectorsApi = require('./api/termvectors')
const TextStructureApi = require('./api/text_structure')
const TransformApi = require('./api/transform')
const updateApi = require('./api/update')
const updateByQueryApi = require('./api/update_by_query')
const updateByQueryRethrottleApi = require('./api/update_by_query_rethrottle')
const AsyncSearchApi = require('./api/async_search')
const AutoscalingApi = require('./api/autoscaling')
const CcrApi = require('./api/ccr')
const closePointInTimeApi = require('./api/close_point_in_time')
const EnrichApi = require('./api/enrich')
const EqlApi = require('./api/eql')
const GraphApi = require('./api/graph')
const IlmApi = require('./api/ilm')
const LicenseApi = require('./api/license')
const LogstashApi = require('./api/logstash')
const MigrationApi = require('./api/migration')
const MlApi = require('./api/ml')
const MonitoringApi = require('./api/monitoring')
const openPointInTimeApi = require('./api/open_point_in_time')
const RollupApi = require('./api/rollup')
const SearchableSnapshotsApi = require('./api/searchable_snapshots')
const SecurityApi = require('./api/security')
const SlmApi = require('./api/slm')
const SqlApi = require('./api/sql')
const SslApi = require('./api/ssl')
const TextStructureApi = require('./api/text_structure')
const TransformApi = require('./api/transform')
const WatcherApi = require('./api/watcher')
const XpackApi = require('./api/xpack')
const { kConfigurationError } = require('./utils')
const kCat = Symbol('Cat')
const kCluster = Symbol('Cluster')
const kDanglingIndices = Symbol('DanglingIndices')
const kFeatures = Symbol('Features')
const kIndices = Symbol('Indices')
const kIngest = Symbol('Ingest')
const kNodes = Symbol('Nodes')
const kSnapshot = Symbol('Snapshot')
const kTasks = Symbol('Tasks')
const kAsyncSearch = Symbol('AsyncSearch')
const kAutoscaling = Symbol('Autoscaling')
const kCat = Symbol('Cat')
const kCcr = Symbol('Ccr')
const kCluster = Symbol('Cluster')
const kDanglingIndices = Symbol('DanglingIndices')
const kEnrich = Symbol('Enrich')
const kEql = Symbol('Eql')
const kFeatures = Symbol('Features')
const kGraph = Symbol('Graph')
const kIlm = Symbol('Ilm')
const kIndices = Symbol('Indices')
const kIngest = Symbol('Ingest')
const kLicense = Symbol('License')
const kLogstash = Symbol('Logstash')
const kMigration = Symbol('Migration')
const kMl = Symbol('Ml')
const kMonitoring = Symbol('Monitoring')
const kNodes = Symbol('Nodes')
const kRollup = Symbol('Rollup')
const kSearchableSnapshots = Symbol('SearchableSnapshots')
const kSecurity = Symbol('Security')
const kShutdown = Symbol('Shutdown')
const kSlm = Symbol('Slm')
const kSnapshot = Symbol('Snapshot')
const kSql = Symbol('Sql')
const kSsl = Symbol('Ssl')
const kTasks = Symbol('Tasks')
const kTextStructure = Symbol('TextStructure')
const kTransform = Symbol('Transform')
const kWatcher = Symbol('Watcher')
@ -126,33 +128,34 @@ const kXpack = Symbol('Xpack')
function ESAPI (opts) {
this[kConfigurationError] = opts.ConfigurationError
this[kCat] = null
this[kCluster] = null
this[kDanglingIndices] = null
this[kFeatures] = null
this[kIndices] = null
this[kIngest] = null
this[kNodes] = null
this[kSnapshot] = null
this[kTasks] = null
this[kAsyncSearch] = null
this[kAutoscaling] = null
this[kCat] = null
this[kCcr] = null
this[kCluster] = null
this[kDanglingIndices] = null
this[kEnrich] = null
this[kEql] = null
this[kFeatures] = null
this[kGraph] = null
this[kIlm] = null
this[kIndices] = null
this[kIngest] = null
this[kLicense] = null
this[kLogstash] = null
this[kMigration] = null
this[kMl] = null
this[kMonitoring] = null
this[kNodes] = null
this[kRollup] = null
this[kSearchableSnapshots] = null
this[kSecurity] = null
this[kShutdown] = null
this[kSlm] = null
this[kSnapshot] = null
this[kSql] = null
this[kSsl] = null
this[kTasks] = null
this[kTextStructure] = null
this[kTransform] = null
this[kWatcher] = null
@ -161,6 +164,7 @@ function ESAPI (opts) {
ESAPI.prototype.bulk = bulkApi
ESAPI.prototype.clearScroll = clearScrollApi
ESAPI.prototype.closePointInTime = closePointInTimeApi
ESAPI.prototype.count = countApi
ESAPI.prototype.create = createApi
ESAPI.prototype.delete = deleteApi
@ -182,6 +186,7 @@ ESAPI.prototype.mget = mgetApi
ESAPI.prototype.msearch = msearchApi
ESAPI.prototype.msearchTemplate = msearchTemplateApi
ESAPI.prototype.mtermvectors = mtermvectorsApi
ESAPI.prototype.openPointInTime = openPointInTimeApi
ESAPI.prototype.ping = pingApi
ESAPI.prototype.putScript = putScriptApi
ESAPI.prototype.rankEval = rankEvalApi
@ -197,10 +202,25 @@ ESAPI.prototype.termvectors = termvectorsApi
ESAPI.prototype.update = updateApi
ESAPI.prototype.updateByQuery = updateByQueryApi
ESAPI.prototype.updateByQueryRethrottle = updateByQueryRethrottleApi
ESAPI.prototype.closePointInTime = closePointInTimeApi
ESAPI.prototype.openPointInTime = openPointInTimeApi
Object.defineProperties(ESAPI.prototype, {
asyncSearch: {
get () {
if (this[kAsyncSearch] === null) {
this[kAsyncSearch] = new AsyncSearchApi(this.transport, this[kConfigurationError])
}
return this[kAsyncSearch]
}
},
async_search: { get () { return this.asyncSearch } },
autoscaling: {
get () {
if (this[kAutoscaling] === null) {
this[kAutoscaling] = new AutoscalingApi(this.transport, this[kConfigurationError])
}
return this[kAutoscaling]
}
},
cat: {
get () {
if (this[kCat] === null) {
@ -209,7 +229,16 @@ Object.defineProperties(ESAPI.prototype, {
return this[kCat]
}
},
ccr: {
get () {
if (this[kCcr] === null) {
this[kCcr] = new CcrApi(this.transport, this[kConfigurationError])
}
return this[kCcr]
}
},
clear_scroll: { get () { return this.clearScroll } },
close_point_in_time: { get () { return this.closePointInTime } },
cluster: {
get () {
if (this[kCluster] === null) {
@ -230,96 +259,6 @@ Object.defineProperties(ESAPI.prototype, {
delete_by_query: { get () { return this.deleteByQuery } },
delete_by_query_rethrottle: { get () { return this.deleteByQueryRethrottle } },
delete_script: { get () { return this.deleteScript } },
exists_source: { get () { return this.existsSource } },
features: {
get () {
if (this[kFeatures] === null) {
this[kFeatures] = new FeaturesApi(this.transport, this[kConfigurationError])
}
return this[kFeatures]
}
},
field_caps: { get () { return this.fieldCaps } },
get_script: { get () { return this.getScript } },
get_script_context: { get () { return this.getScriptContext } },
get_script_languages: { get () { return this.getScriptLanguages } },
get_source: { get () { return this.getSource } },
indices: {
get () {
if (this[kIndices] === null) {
this[kIndices] = new IndicesApi(this.transport, this[kConfigurationError])
}
return this[kIndices]
}
},
ingest: {
get () {
if (this[kIngest] === null) {
this[kIngest] = new IngestApi(this.transport, this[kConfigurationError])
}
return this[kIngest]
}
},
msearch_template: { get () { return this.msearchTemplate } },
nodes: {
get () {
if (this[kNodes] === null) {
this[kNodes] = new NodesApi(this.transport, this[kConfigurationError])
}
return this[kNodes]
}
},
put_script: { get () { return this.putScript } },
rank_eval: { get () { return this.rankEval } },
reindex_rethrottle: { get () { return this.reindexRethrottle } },
render_search_template: { get () { return this.renderSearchTemplate } },
scripts_painless_execute: { get () { return this.scriptsPainlessExecute } },
search_shards: { get () { return this.searchShards } },
search_template: { get () { return this.searchTemplate } },
snapshot: {
get () {
if (this[kSnapshot] === null) {
this[kSnapshot] = new SnapshotApi(this.transport, this[kConfigurationError])
}
return this[kSnapshot]
}
},
tasks: {
get () {
if (this[kTasks] === null) {
this[kTasks] = new TasksApi(this.transport, this[kConfigurationError])
}
return this[kTasks]
}
},
update_by_query: { get () { return this.updateByQuery } },
update_by_query_rethrottle: { get () { return this.updateByQueryRethrottle } },
asyncSearch: {
get () {
if (this[kAsyncSearch] === null) {
this[kAsyncSearch] = new AsyncSearchApi(this.transport, this[kConfigurationError])
}
return this[kAsyncSearch]
}
},
async_search: { get () { return this.asyncSearch } },
autoscaling: {
get () {
if (this[kAutoscaling] === null) {
this[kAutoscaling] = new AutoscalingApi(this.transport, this[kConfigurationError])
}
return this[kAutoscaling]
}
},
ccr: {
get () {
if (this[kCcr] === null) {
this[kCcr] = new CcrApi(this.transport, this[kConfigurationError])
}
return this[kCcr]
}
},
close_point_in_time: { get () { return this.closePointInTime } },
enrich: {
get () {
if (this[kEnrich] === null) {
@ -336,6 +275,20 @@ Object.defineProperties(ESAPI.prototype, {
return this[kEql]
}
},
exists_source: { get () { return this.existsSource } },
features: {
get () {
if (this[kFeatures] === null) {
this[kFeatures] = new FeaturesApi(this.transport, this[kConfigurationError])
}
return this[kFeatures]
}
},
field_caps: { get () { return this.fieldCaps } },
get_script: { get () { return this.getScript } },
get_script_context: { get () { return this.getScriptContext } },
get_script_languages: { get () { return this.getScriptLanguages } },
get_source: { get () { return this.getSource } },
graph: {
get () {
if (this[kGraph] === null) {
@ -352,6 +305,22 @@ Object.defineProperties(ESAPI.prototype, {
return this[kIlm]
}
},
indices: {
get () {
if (this[kIndices] === null) {
this[kIndices] = new IndicesApi(this.transport, this[kConfigurationError])
}
return this[kIndices]
}
},
ingest: {
get () {
if (this[kIngest] === null) {
this[kIngest] = new IngestApi(this.transport, this[kConfigurationError])
}
return this[kIngest]
}
},
license: {
get () {
if (this[kLicense] === null) {
@ -392,7 +361,20 @@ Object.defineProperties(ESAPI.prototype, {
return this[kMonitoring]
}
},
msearch_template: { get () { return this.msearchTemplate } },
nodes: {
get () {
if (this[kNodes] === null) {
this[kNodes] = new NodesApi(this.transport, this[kConfigurationError])
}
return this[kNodes]
}
},
open_point_in_time: { get () { return this.openPointInTime } },
put_script: { get () { return this.putScript } },
rank_eval: { get () { return this.rankEval } },
reindex_rethrottle: { get () { return this.reindexRethrottle } },
render_search_template: { get () { return this.renderSearchTemplate } },
rollup: {
get () {
if (this[kRollup] === null) {
@ -401,6 +383,9 @@ Object.defineProperties(ESAPI.prototype, {
return this[kRollup]
}
},
scripts_painless_execute: { get () { return this.scriptsPainlessExecute } },
search_shards: { get () { return this.searchShards } },
search_template: { get () { return this.searchTemplate } },
searchableSnapshots: {
get () {
if (this[kSearchableSnapshots] === null) {
@ -418,6 +403,14 @@ Object.defineProperties(ESAPI.prototype, {
return this[kSecurity]
}
},
shutdown: {
get () {
if (this[kShutdown] === null) {
this[kShutdown] = new ShutdownApi(this.transport, this[kConfigurationError])
}
return this[kShutdown]
}
},
slm: {
get () {
if (this[kSlm] === null) {
@ -426,6 +419,14 @@ Object.defineProperties(ESAPI.prototype, {
return this[kSlm]
}
},
snapshot: {
get () {
if (this[kSnapshot] === null) {
this[kSnapshot] = new SnapshotApi(this.transport, this[kConfigurationError])
}
return this[kSnapshot]
}
},
sql: {
get () {
if (this[kSql] === null) {
@ -442,6 +443,14 @@ Object.defineProperties(ESAPI.prototype, {
return this[kSsl]
}
},
tasks: {
get () {
if (this[kTasks] === null) {
this[kTasks] = new TasksApi(this.transport, this[kConfigurationError])
}
return this[kTasks]
}
},
textStructure: {
get () {
if (this[kTextStructure] === null) {
@ -459,6 +468,8 @@ Object.defineProperties(ESAPI.prototype, {
return this[kTransform]
}
},
update_by_query: { get () { return this.updateByQuery } },
update_by_query_rethrottle: { get () { return this.updateByQueryRethrottle } },
watcher: {
get () {
if (this[kWatcher] === null) {