Skip to content

Commit 720b5b4

Browse files
committed
API generation
1 parent a298517 commit 720b5b4

File tree

9 files changed

+858
-546
lines changed

9 files changed

+858
-546
lines changed

docs/reference.asciidoc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,14 @@ https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.ht
524524
client.cat.allocation(...)
525525
----
526526

527+
[discrete]
528+
==== component_templates
529+
Returns information about existing component_templates templates.
530+
[source,ts]
531+
----
532+
client.cat.componentTemplates(...)
533+
----
534+
527535
[discrete]
528536
==== count
529537
Provides quick access to the document count of the entire cluster, or individual indices.
@@ -3127,6 +3135,16 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-dis
31273135
client.security.disableUser(...)
31283136
----
31293137

3138+
[discrete]
3139+
==== disable_user_profile
3140+
Disables a user profile so it's not visible in user profile searches.
3141+
3142+
https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-disable-user-profile.html[Endpoint documentation]
3143+
[source,ts]
3144+
----
3145+
client.security.disableUserProfile(...)
3146+
----
3147+
31303148
[discrete]
31313149
==== enable_user
31323150
Enables users in the native realm.
@@ -3137,6 +3155,16 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ena
31373155
client.security.enableUser(...)
31383156
----
31393157

3158+
[discrete]
3159+
==== enable_user_profile
3160+
Enables a user profile so it's visible in user profile searches.
3161+
3162+
https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enable-user-profile.html[Endpoint documentation]
3163+
[source,ts]
3164+
----
3165+
client.security.enableUserProfile(...)
3166+
----
3167+
31403168
[discrete]
31413169
==== enroll_kibana
31423170
Allows a kibana instance to configure itself to communicate with a secured elasticsearch cluster.
@@ -3445,6 +3473,16 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-sam
34453473
client.security.samlServiceProviderMetadata(...)
34463474
----
34473475

3476+
[discrete]
3477+
==== search_user_profiles
3478+
Searches for user profiles that match specified criteria.
3479+
3480+
https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-search-user-profile.html[Endpoint documentation]
3481+
[source,ts]
3482+
----
3483+
client.security.searchUserProfiles(...)
3484+
----
3485+
34483486
[discrete]
34493487
==== update_user_profile_data
34503488
Update application specific data for the user profile of the given unique ID.
@@ -3840,6 +3878,8 @@ client.transform.putTransform(...)
38403878
[discrete]
38413879
==== reset_transform
38423880
Resets an existing transform.
3881+
3882+
https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-transform.html[Endpoint documentation]
38433883
[source,ts]
38443884
----
38453885
client.transform.resetTransform(...)

src/api/api/cat.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,35 @@ export default class Cat {
103103
return await this.transport.request({ path, method, querystring, body }, options)
104104
}
105105

106+
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
107+
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
108+
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
109+
async componentTemplates (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
110+
const acceptedPath: string[] = ['name']
111+
const querystring: Record<string, any> = {}
112+
const body = undefined
113+
114+
params = params ?? {}
115+
for (const key in params) {
116+
if (acceptedPath.includes(key)) {
117+
continue
118+
} else if (key !== 'body') {
119+
querystring[key] = params[key]
120+
}
121+
}
122+
123+
let method = ''
124+
let path = ''
125+
if (params.name != null) {
126+
method = 'GET'
127+
path = `/_cat/component_templates/${encodeURIComponent(params.name.toString())}`
128+
} else {
129+
method = 'GET'
130+
path = '/_cat/component_templates'
131+
}
132+
return await this.transport.request({ path, method, querystring, body }, options)
133+
}
134+
106135
async count (this: That, params?: T.CatCountRequest | TB.CatCountRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.CatCountResponse>
107136
async count (this: That, params?: T.CatCountRequest | TB.CatCountRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CatCountResponse, unknown>>
108137
async count (this: That, params?: T.CatCountRequest | TB.CatCountRequest, options?: TransportRequestOptions): Promise<T.CatCountResponse>

src/api/api/field_caps.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ import * as T from '../types'
3737
import * as TB from '../typesWithBodyKey'
3838
interface That { transport: Transport }
3939

40-
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.FieldCapsResponse>
41-
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FieldCapsResponse, unknown>>
42-
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<T.FieldCapsResponse>
43-
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<any> {
40+
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.FieldCapsResponse>
41+
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FieldCapsResponse, unknown>>
42+
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<T.FieldCapsResponse>
43+
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<any> {
4444
const acceptedPath: string[] = ['index']
4545
const acceptedBody: string[] = ['index_filter', 'runtime_mappings']
4646
const querystring: Record<string, any> = {}
@@ -53,7 +53,6 @@ export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequ
5353
body = userBody != null ? { ...userBody } : undefined
5454
}
5555

56-
params = params ?? {}
5756
for (const key in params) {
5857
if (acceptedBody.includes(key)) {
5958
body = body ?? {}

src/api/api/knn_search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default async function KnnSearchApi<TDocument = unknown> (this: That, par
4242
export default async function KnnSearchApi<TDocument = unknown> (this: That, params: T.KnnSearchRequest | TB.KnnSearchRequest, options?: TransportRequestOptions): Promise<T.KnnSearchResponse<TDocument>>
4343
export default async function KnnSearchApi<TDocument = unknown> (this: That, params: T.KnnSearchRequest | TB.KnnSearchRequest, options?: TransportRequestOptions): Promise<any> {
4444
const acceptedPath: string[] = ['index']
45-
const acceptedBody: string[] = ['_source', 'docvalue_fields', 'stored_fields', 'fields', 'knn']
45+
const acceptedBody: string[] = ['_source', 'docvalue_fields', 'stored_fields', 'fields', 'filter', 'knn']
4646
const querystring: Record<string, any> = {}
4747
// @ts-expect-error
4848
const userBody: any = params?.body

src/api/api/ml.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -937,10 +937,10 @@ export default class Ml {
937937
return await this.transport.request({ path, method, querystring, body }, options)
938938
}
939939

940-
async getMemoryStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
941-
async getMemoryStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
942-
async getMemoryStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
943-
async getMemoryStats (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
940+
async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest | TB.MlGetMemoryStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.MlGetMemoryStatsResponse>
941+
async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest | TB.MlGetMemoryStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MlGetMemoryStatsResponse, unknown>>
942+
async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest | TB.MlGetMemoryStatsRequest, options?: TransportRequestOptions): Promise<T.MlGetMemoryStatsResponse>
943+
async getMemoryStats (this: That, params?: T.MlGetMemoryStatsRequest | TB.MlGetMemoryStatsRequest, options?: TransportRequestOptions): Promise<any> {
944944
const acceptedPath: string[] = ['node_id']
945945
const querystring: Record<string, any> = {}
946946
const body = undefined
@@ -950,6 +950,7 @@ export default class Ml {
950950
if (acceptedPath.includes(key)) {
951951
continue
952952
} else if (key !== 'body') {
953+
// @ts-expect-error
953954
querystring[key] = params[key]
954955
}
955956
}
@@ -1680,7 +1681,7 @@ export default class Ml {
16801681
async putTrainedModelVocabulary (this: That, params: T.MlPutTrainedModelVocabularyRequest | TB.MlPutTrainedModelVocabularyRequest, options?: TransportRequestOptions): Promise<T.MlPutTrainedModelVocabularyResponse>
16811682
async putTrainedModelVocabulary (this: That, params: T.MlPutTrainedModelVocabularyRequest | TB.MlPutTrainedModelVocabularyRequest, options?: TransportRequestOptions): Promise<any> {
16821683
const acceptedPath: string[] = ['model_id']
1683-
const acceptedBody: string[] = ['vocabulary']
1684+
const acceptedBody: string[] = ['vocabulary', 'merges']
16841685
const querystring: Record<string, any> = {}
16851686
// @ts-expect-error
16861687
const userBody: any = params?.body

src/api/api/reindex.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ import * as T from '../types'
3737
import * as TB from '../typesWithBodyKey'
3838
interface That { transport: Transport }
3939

40-
export default async function ReindexApi (this: That, params?: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.ReindexResponse>
41-
export default async function ReindexApi (this: That, params?: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ReindexResponse, unknown>>
42-
export default async function ReindexApi (this: That, params?: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptions): Promise<T.ReindexResponse>
43-
export default async function ReindexApi (this: That, params?: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptions): Promise<any> {
40+
export default async function ReindexApi (this: That, params: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.ReindexResponse>
41+
export default async function ReindexApi (this: That, params: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ReindexResponse, unknown>>
42+
export default async function ReindexApi (this: That, params: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptions): Promise<T.ReindexResponse>
43+
export default async function ReindexApi (this: That, params: T.ReindexRequest | TB.ReindexRequest, options?: TransportRequestOptions): Promise<any> {
4444
const acceptedPath: string[] = []
4545
const acceptedBody: string[] = ['conflicts', 'dest', 'max_docs', 'script', 'size', 'source']
4646
const querystring: Record<string, any> = {}
@@ -53,7 +53,6 @@ export default async function ReindexApi (this: That, params?: T.ReindexRequest
5353
body = userBody != null ? { ...userBody } : undefined
5454
}
5555

56-
params = params ?? {}
5756
for (const key in params) {
5857
if (acceptedBody.includes(key)) {
5958
body = body ?? {}

src/api/api/security.ts

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,28 @@ export default class Security {
436436
return await this.transport.request({ path, method, querystring, body }, options)
437437
}
438438

439+
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
440+
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
441+
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
442+
async disableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
443+
const acceptedPath: string[] = ['uid']
444+
const querystring: Record<string, any> = {}
445+
const body = undefined
446+
447+
params = params ?? {}
448+
for (const key in params) {
449+
if (acceptedPath.includes(key)) {
450+
continue
451+
} else if (key !== 'body') {
452+
querystring[key] = params[key]
453+
}
454+
}
455+
456+
const method = 'PUT'
457+
const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_disable`
458+
return await this.transport.request({ path, method, querystring, body }, options)
459+
}
460+
439461
async enableUser (this: That, params: T.SecurityEnableUserRequest | TB.SecurityEnableUserRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityEnableUserResponse>
440462
async enableUser (this: That, params: T.SecurityEnableUserRequest | TB.SecurityEnableUserRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityEnableUserResponse, unknown>>
441463
async enableUser (this: That, params: T.SecurityEnableUserRequest | TB.SecurityEnableUserRequest, options?: TransportRequestOptions): Promise<T.SecurityEnableUserResponse>
@@ -458,6 +480,28 @@ export default class Security {
458480
return await this.transport.request({ path, method, querystring, body }, options)
459481
}
460482

483+
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
484+
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
485+
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
486+
async enableUserProfile (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
487+
const acceptedPath: string[] = ['uid']
488+
const querystring: Record<string, any> = {}
489+
const body = undefined
490+
491+
params = params ?? {}
492+
for (const key in params) {
493+
if (acceptedPath.includes(key)) {
494+
continue
495+
} else if (key !== 'body') {
496+
querystring[key] = params[key]
497+
}
498+
}
499+
500+
const method = 'PUT'
501+
const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_enable`
502+
return await this.transport.request({ path, method, querystring, body }, options)
503+
}
504+
461505
async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest | TB.SecurityEnrollKibanaRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityEnrollKibanaResponse>
462506
async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest | TB.SecurityEnrollKibanaRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityEnrollKibanaResponse, unknown>>
463507
async enrollKibana (this: That, params?: T.SecurityEnrollKibanaRequest | TB.SecurityEnrollKibanaRequest, options?: TransportRequestOptions): Promise<T.SecurityEnrollKibanaResponse>
@@ -1377,6 +1421,28 @@ export default class Security {
13771421
return await this.transport.request({ path, method, querystring, body }, options)
13781422
}
13791423

1424+
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
1425+
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
1426+
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
1427+
async searchUserProfiles (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
1428+
const acceptedPath: string[] = []
1429+
const querystring: Record<string, any> = {}
1430+
const body = undefined
1431+
1432+
params = params ?? {}
1433+
for (const key in params) {
1434+
if (acceptedPath.includes(key)) {
1435+
continue
1436+
} else if (key !== 'body') {
1437+
querystring[key] = params[key]
1438+
}
1439+
}
1440+
1441+
const method = body != null ? 'POST' : 'GET'
1442+
const path = '/_security/profile/_search'
1443+
return await this.transport.request({ path, method, querystring, body }, options)
1444+
}
1445+
13801446
async updateUserProfileData (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
13811447
async updateUserProfileData (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
13821448
async updateUserProfileData (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
@@ -1394,8 +1460,8 @@ export default class Security {
13941460
}
13951461
}
13961462

1397-
const method = 'POST'
1398-
const path = `/_security/profile/_data/${encodeURIComponent(params.uid.toString())}`
1463+
const method = 'PUT'
1464+
const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_data`
13991465
return await this.transport.request({ path, method, querystring, body }, options)
14001466
}
14011467
}

0 commit comments

Comments
 (0)