Skip to content

Commit 4a1860b

Browse files
committed
Update APIs to 8.8.0
1 parent 26e0499 commit 4a1860b

File tree

6 files changed

+381
-72
lines changed

6 files changed

+381
-72
lines changed

docs/reference.asciidoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,6 +4119,16 @@ Forces the execution of a stored watch.
41194119
client.watcher.executeWatch(...)
41204120
----
41214121

4122+
[discrete]
4123+
==== get_settings
4124+
Retrieve settings for the watcher system index
4125+
4126+
{ref}/watcher-api-get-settings.html[Endpoint documentation]
4127+
[source,ts]
4128+
----
4129+
client.watcher.getSettings(...)
4130+
----
4131+
41224132
[discrete]
41234133
==== get_watch
41244134
Retrieves a watch by its ID.
@@ -4179,6 +4189,16 @@ Stops Watcher if it is running.
41794189
client.watcher.stop(...)
41804190
----
41814191

4192+
[discrete]
4193+
==== update_settings
4194+
Update settings for the watcher system index
4195+
4196+
{ref}/watcher-api-update-settings.html[Endpoint documentation]
4197+
[source,ts]
4198+
----
4199+
client.watcher.updateSettings(...)
4200+
----
4201+
41824202
[discrete]
41834203
=== xpack
41844204
[discrete]

src/api/api/indices.ts

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -330,32 +330,25 @@ export default class Indices {
330330
return await this.transport.request({ path, method, querystring, body }, options)
331331
}
332332

333-
async deleteDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
334-
async deleteDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
335-
async deleteDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
336-
async deleteDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
333+
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesDeleteDataLifecycleResponse>
334+
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesDeleteDataLifecycleResponse, unknown>>
335+
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesDeleteDataLifecycleResponse>
336+
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
337337
const acceptedPath: string[] = ['name']
338338
const querystring: Record<string, any> = {}
339339
const body = undefined
340340

341-
params = params ?? {}
342341
for (const key in params) {
343342
if (acceptedPath.includes(key)) {
344343
continue
345344
} else if (key !== 'body') {
345+
// @ts-expect-error
346346
querystring[key] = params[key]
347347
}
348348
}
349349

350-
let method = ''
351-
let path = ''
352-
if (params.name != null) {
353-
method = 'DELETE'
354-
path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
355-
} else {
356-
method = 'DELETE'
357-
path = '/_data_stream/_lifecycle'
358-
}
350+
const method = 'DELETE'
351+
const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
359352
return await this.transport.request({ path, method, querystring, body }, options)
360353
}
361354

@@ -569,24 +562,24 @@ export default class Indices {
569562
return await this.transport.request({ path, method, querystring, body }, options)
570563
}
571564

572-
async explainDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
573-
async explainDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
574-
async explainDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
575-
async explainDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
565+
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesExplainDataLifecycleResponse>
566+
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesExplainDataLifecycleResponse, unknown>>
567+
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesExplainDataLifecycleResponse>
568+
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
576569
const acceptedPath: string[] = ['index']
577570
const querystring: Record<string, any> = {}
578571
const body = undefined
579572

580-
params = params ?? {}
581573
for (const key in params) {
582574
if (acceptedPath.includes(key)) {
583575
continue
584576
} else if (key !== 'body') {
577+
// @ts-expect-error
585578
querystring[key] = params[key]
586579
}
587580
}
588581

589-
const method = 'POST'
582+
const method = 'GET'
590583
const path = `/${encodeURIComponent(params.index.toString())}/_lifecycle/explain`
591584
return await this.transport.request({ path, method, querystring, body }, options)
592585
}
@@ -731,32 +724,25 @@ export default class Indices {
731724
return await this.transport.request({ path, method, querystring, body }, options)
732725
}
733726

734-
async getDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
735-
async getDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
736-
async getDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
737-
async getDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
727+
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesGetDataLifecycleResponse>
728+
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesGetDataLifecycleResponse, unknown>>
729+
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesGetDataLifecycleResponse>
730+
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
738731
const acceptedPath: string[] = ['name']
739732
const querystring: Record<string, any> = {}
740733
const body = undefined
741734

742-
params = params ?? {}
743735
for (const key in params) {
744736
if (acceptedPath.includes(key)) {
745737
continue
746738
} else if (key !== 'body') {
739+
// @ts-expect-error
747740
querystring[key] = params[key]
748741
}
749742
}
750743

751-
let method = ''
752-
let path = ''
753-
if (params.name != null) {
754-
method = 'GET'
755-
path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
756-
} else {
757-
method = 'GET'
758-
path = '/_data_stream/_lifecycle'
759-
}
744+
const method = 'GET'
745+
const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
760746
return await this.transport.request({ path, method, querystring, body }, options)
761747
}
762748

@@ -1086,32 +1072,37 @@ export default class Indices {
10861072
return await this.transport.request({ path, method, querystring, body }, options)
10871073
}
10881074

1089-
async putDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
1090-
async putDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
1091-
async putDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
1092-
async putDataLifecycle (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
1075+
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesPutDataLifecycleResponse>
1076+
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesPutDataLifecycleResponse, unknown>>
1077+
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesPutDataLifecycleResponse>
1078+
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
10931079
const acceptedPath: string[] = ['name']
1080+
const acceptedBody: string[] = ['data_retention']
10941081
const querystring: Record<string, any> = {}
1095-
const body = undefined
1082+
// @ts-expect-error
1083+
const userBody: any = params?.body
1084+
let body: Record<string, any> | string
1085+
if (typeof userBody === 'string') {
1086+
body = userBody
1087+
} else {
1088+
body = userBody != null ? { ...userBody } : undefined
1089+
}
10961090

1097-
params = params ?? {}
10981091
for (const key in params) {
1099-
if (acceptedPath.includes(key)) {
1092+
if (acceptedBody.includes(key)) {
1093+
body = body ?? {}
1094+
// @ts-expect-error
1095+
body[key] = params[key]
1096+
} else if (acceptedPath.includes(key)) {
11001097
continue
11011098
} else if (key !== 'body') {
1099+
// @ts-expect-error
11021100
querystring[key] = params[key]
11031101
}
11041102
}
11051103

1106-
let method = ''
1107-
let path = ''
1108-
if (params.name != null) {
1109-
method = 'PUT'
1110-
path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
1111-
} else {
1112-
method = 'PUT'
1113-
path = '/_data_stream/_lifecycle'
1114-
}
1104+
const method = 'PUT'
1105+
const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
11151106
return await this.transport.request({ path, method, querystring, body }, options)
11161107
}
11171108

src/api/api/search_application.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ export default class SearchApplication {
6565
return await this.transport.request({ path, method, querystring, body }, options)
6666
}
6767

68-
async deleteBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
69-
async deleteBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
70-
async deleteBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
71-
async deleteBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
68+
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationDeleteBehavioralAnalyticsResponse>
69+
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationDeleteBehavioralAnalyticsResponse, unknown>>
70+
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationDeleteBehavioralAnalyticsResponse>
71+
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
7272
const acceptedPath: string[] = ['name']
7373
const querystring: Record<string, any> = {}
7474
const body = undefined
7575

76-
params = params ?? {}
7776
for (const key in params) {
7877
if (acceptedPath.includes(key)) {
7978
continue
8079
} else if (key !== 'body') {
80+
// @ts-expect-error
8181
querystring[key] = params[key]
8282
}
8383
}
@@ -109,10 +109,10 @@ export default class SearchApplication {
109109
return await this.transport.request({ path, method, querystring, body }, options)
110110
}
111111

112-
async getBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
113-
async getBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
114-
async getBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
115-
async getBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
112+
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationGetBehavioralAnalyticsResponse>
113+
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationGetBehavioralAnalyticsResponse, unknown>>
114+
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationGetBehavioralAnalyticsResponse>
115+
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
116116
const acceptedPath: string[] = ['name']
117117
const querystring: Record<string, any> = {}
118118
const body = undefined
@@ -122,6 +122,7 @@ export default class SearchApplication {
122122
if (acceptedPath.includes(key)) {
123123
continue
124124
} else if (key !== 'body') {
125+
// @ts-expect-error
125126
querystring[key] = params[key]
126127
}
127128
}
@@ -210,19 +211,19 @@ export default class SearchApplication {
210211
return await this.transport.request({ path, method, querystring, body }, options)
211212
}
212213

213-
async putBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
214-
async putBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
215-
async putBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
216-
async putBehavioralAnalytics (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
214+
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationPutBehavioralAnalyticsResponse>
215+
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationPutBehavioralAnalyticsResponse, unknown>>
216+
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationPutBehavioralAnalyticsResponse>
217+
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
217218
const acceptedPath: string[] = ['name']
218219
const querystring: Record<string, any> = {}
219220
const body = undefined
220221

221-
params = params ?? {}
222222
for (const key in params) {
223223
if (acceptedPath.includes(key)) {
224224
continue
225225
} else if (key !== 'body') {
226+
// @ts-expect-error
226227
querystring[key] = params[key]
227228
}
228229
}

src/api/api/watcher.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,28 @@ export default class Watcher {
180180
return await this.transport.request({ path, method, querystring, body }, options)
181181
}
182182

183+
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
184+
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
185+
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
186+
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
187+
const acceptedPath: string[] = []
188+
const querystring: Record<string, any> = {}
189+
const body = undefined
190+
191+
params = params ?? {}
192+
for (const key in params) {
193+
if (acceptedPath.includes(key)) {
194+
continue
195+
} else if (key !== 'body') {
196+
querystring[key] = params[key]
197+
}
198+
}
199+
200+
const method = 'GET'
201+
const path = '/_watcher/settings'
202+
return await this.transport.request({ path, method, querystring, body }, options)
203+
}
204+
183205
async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.WatcherGetWatchResponse>
184206
async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherGetWatchResponse, unknown>>
185207
async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherGetWatchResponse>
@@ -346,4 +368,26 @@ export default class Watcher {
346368
const path = '/_watcher/_stop'
347369
return await this.transport.request({ path, method, querystring, body }, options)
348370
}
371+
372+
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
373+
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
374+
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
375+
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
376+
const acceptedPath: string[] = []
377+
const querystring: Record<string, any> = {}
378+
const body = undefined
379+
380+
params = params ?? {}
381+
for (const key in params) {
382+
if (acceptedPath.includes(key)) {
383+
continue
384+
} else if (key !== 'body') {
385+
querystring[key] = params[key]
386+
}
387+
}
388+
389+
const method = 'PUT'
390+
const path = '/_watcher/settings'
391+
return await this.transport.request({ path, method, querystring, body }, options)
392+
}
349393
}

0 commit comments

Comments
 (0)