Skip to content

Commit ce00241

Browse files
Auto-generated API code (#3257)
1 parent 567b9e6 commit ce00241

9 files changed

Lines changed: 576 additions & 9 deletions

File tree

docs/reference/api-reference.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12558,6 +12558,36 @@ client.security.clearCachedServiceTokens({ namespace, service, name })
1255812558
Use a wildcard (`*`) to evict all tokens that belong to a service account.
1255912559
It does not support other wildcard patterns.
1256012560

12561+
## client.security.cloneApiKey [_security.clone_api_key]
12562+
Clone an API key.
12563+
12564+
Create a copy of an existing API key with a new ID.
12565+
The cloned key inherits the role descriptors of the source key.
12566+
This is intended for applications (such as Kibana) that need to
12567+
create API keys on behalf of a user using an existing API key credential,
12568+
since derived API keys (API keys created by API keys) are not otherwise supported.
12569+
12570+
[Endpoint documentation](https://www.elastic.co/docs/api/doc/elasticsearch#TODO)
12571+
12572+
```ts
12573+
client.security.cloneApiKey({ api_key })
12574+
```
12575+
12576+
### Arguments [_arguments_security.clone_api_key]
12577+
12578+
#### Request (object) [_request_security.clone_api_key]
12579+
- **`api_key` (string)**: The credentials of the API key to clone.
12580+
This is the secret value returned when the key was originally created.
12581+
- **`name` (Optional, string)**: A name for the cloned API key.
12582+
If not provided, the name of the source key is used.
12583+
- **`expiration` (Optional, string \| -1 \| 0)**: The expiration time for the cloned API key.
12584+
By default, API keys never expire.
12585+
Set to `null` to explicitly create a key with no expiration.
12586+
- **`metadata` (Optional, Record<string, User-defined value>)**: Arbitrary metadata to associate with the cloned API key.
12587+
It supports nested data structure.
12588+
Within the metadata object, keys beginning with `_` are reserved for system usage.
12589+
- **`refresh` (Optional, Enum(true \| false \| "wait_for"))**: 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.
12590+
1256112591
## client.security.createApiKey [_security.create_api_key]
1256212592
Create an API key.
1256312593

@@ -15391,6 +15421,7 @@ client.tasks.get({ task_id })
1539115421
- **`timeout` (Optional, string \| -1 \| 0)**: The period to wait for a response.
1539215422
If no response is received before the timeout expires, the request fails and returns an error.
1539315423
- **`wait_for_completion` (Optional, boolean)**: If `true`, the request blocks until the task has completed.
15424+
- **`follow_relocations` (Optional, boolean)**: Internal use only
1539415425

1539515426
## client.tasks.list [_tasks.list]
1539615427
Get all tasks.
@@ -16082,6 +16113,9 @@ client.transform.scheduleNowTransform({ transform_id })
1608216113
#### Request (object) [_request_transform.schedule_now_transform]
1608316114
- **`transform_id` (string)**: Identifier for the transform.
1608416115
- **`timeout` (Optional, string \| -1 \| 0)**: Controls the time to wait for the scheduling to take place
16116+
- **`defer` (Optional, boolean)**: When true, defers the scheduling by the transform's configured sync delay
16117+
instead of triggering immediately. The transform will process new data after
16118+
the delay elapses rather than right away.
1608516119

1608616120
## client.transform.setUpgradeMode [_transform.set_upgrade_mode]
1608716121
Set upgrade_mode for transform indices.

src/api/api/cancel_reindex.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
// This file was automatically generated by elastic/elastic-client-generator-js
7+
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
8+
// and elastic/elastic-client-generator-js to regenerate this file again.
9+
10+
import {
11+
Transport,
12+
TransportRequestMetadata,
13+
TransportRequestOptions,
14+
TransportRequestOptionsWithMeta,
15+
TransportRequestOptionsWithOutMeta,
16+
TransportResult
17+
} from '@elastic/transport'
18+
import * as T from '../types'
19+
20+
interface That {
21+
transport: Transport
22+
}
23+
24+
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
25+
cancel_reindex: {
26+
path: [
27+
'task_id'
28+
],
29+
body: [],
30+
query: [
31+
'wait_for_completion'
32+
]
33+
}
34+
}
35+
36+
/**
37+
* Cancel a reindex task. Cancel an ongoing reindex task. If `wait_for_completion` is `true` (the default), the response contains the final task state after cancellation. If `wait_for_completion` is `false`, the response contains only `acknowledged: true`.
38+
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch#TODO | Elasticsearch API documentation}
39+
*/
40+
export default async function CancelReindexApi (this: That, params: T.CancelReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.CancelReindexResponse>
41+
export default async function CancelReindexApi (this: That, params: T.CancelReindexRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.CancelReindexResponse, unknown>>
42+
export default async function CancelReindexApi (this: That, params: T.CancelReindexRequest, options?: TransportRequestOptions): Promise<T.CancelReindexResponse>
43+
export default async function CancelReindexApi (this: That, params: T.CancelReindexRequest, options?: TransportRequestOptions): Promise<any> {
44+
const {
45+
path: acceptedPath
46+
} = acceptedParams.cancel_reindex
47+
48+
const userQuery = params?.querystring
49+
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
50+
51+
let body: Record<string, any> | string | undefined
52+
const userBody = params?.body
53+
if (userBody != null) {
54+
if (typeof userBody === 'string') {
55+
body = userBody
56+
} else {
57+
body = { ...userBody }
58+
}
59+
}
60+
61+
for (const key in params) {
62+
if (acceptedPath.includes(key)) {
63+
continue
64+
} else if (key !== 'body' && key !== 'querystring') {
65+
// @ts-expect-error
66+
querystring[key] = params[key]
67+
}
68+
}
69+
70+
const method = 'POST'
71+
const path = `/_reindex/${encodeURIComponent(params.task_id.toString())}/_cancel`
72+
const meta: TransportRequestMetadata = {
73+
name: 'cancel_reindex',
74+
pathParts: {
75+
task_id: params.task_id
76+
},
77+
acceptedParams: {
78+
path: ['task_id'],
79+
body: [],
80+
query: ['wait_for_completion']
81+
}
82+
}
83+
return await this.transport.request({ path, method, querystring, body, meta }, options)
84+
}

src/api/api/get_reindex.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
// This file was automatically generated by elastic/elastic-client-generator-js
7+
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
8+
// and elastic/elastic-client-generator-js to regenerate this file again.
9+
10+
import {
11+
Transport,
12+
TransportRequestMetadata,
13+
TransportRequestOptions,
14+
TransportRequestOptionsWithMeta,
15+
TransportRequestOptionsWithOutMeta,
16+
TransportResult
17+
} from '@elastic/transport'
18+
import * as T from '../types'
19+
20+
interface That {
21+
transport: Transport
22+
}
23+
24+
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
25+
get_reindex: {
26+
path: [
27+
'task_id'
28+
],
29+
body: [],
30+
query: [
31+
'wait_for_completion',
32+
'timeout'
33+
]
34+
}
35+
}
36+
37+
/**
38+
* Get a reindex task. Get the status and progress of a specific reindex task.
39+
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch#TODO | Elasticsearch API documentation}
40+
*/
41+
export default async function GetReindexApi (this: That, params: T.GetReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.GetReindexResponse>
42+
export default async function GetReindexApi (this: That, params: T.GetReindexRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.GetReindexResponse, unknown>>
43+
export default async function GetReindexApi (this: That, params: T.GetReindexRequest, options?: TransportRequestOptions): Promise<T.GetReindexResponse>
44+
export default async function GetReindexApi (this: That, params: T.GetReindexRequest, options?: TransportRequestOptions): Promise<any> {
45+
const {
46+
path: acceptedPath
47+
} = acceptedParams.get_reindex
48+
49+
const userQuery = params?.querystring
50+
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
51+
52+
let body: Record<string, any> | string | undefined
53+
const userBody = params?.body
54+
if (userBody != null) {
55+
if (typeof userBody === 'string') {
56+
body = userBody
57+
} else {
58+
body = { ...userBody }
59+
}
60+
}
61+
62+
for (const key in params) {
63+
if (acceptedPath.includes(key)) {
64+
continue
65+
} else if (key !== 'body' && key !== 'querystring') {
66+
// @ts-expect-error
67+
querystring[key] = params[key]
68+
}
69+
}
70+
71+
const method = 'GET'
72+
const path = `/_reindex/${encodeURIComponent(params.task_id.toString())}`
73+
const meta: TransportRequestMetadata = {
74+
name: 'get_reindex',
75+
pathParts: {
76+
task_id: params.task_id
77+
},
78+
acceptedParams: {
79+
path: ['task_id'],
80+
body: [],
81+
query: ['wait_for_completion', 'timeout']
82+
}
83+
}
84+
return await this.transport.request({ path, method, querystring, body, meta }, options)
85+
}

src/api/api/list_reindex.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
// This file was automatically generated by elastic/elastic-client-generator-js
7+
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
8+
// and elastic/elastic-client-generator-js to regenerate this file again.
9+
10+
import {
11+
Transport,
12+
TransportRequestMetadata,
13+
TransportRequestOptions,
14+
TransportRequestOptionsWithMeta,
15+
TransportRequestOptionsWithOutMeta,
16+
TransportResult
17+
} from '@elastic/transport'
18+
import * as T from '../types'
19+
20+
interface That {
21+
transport: Transport
22+
}
23+
24+
const acceptedParams: Record<string, { path: string[], body: string[], query: string[] }> = {
25+
list_reindex: {
26+
path: [],
27+
body: [],
28+
query: [
29+
'detailed'
30+
]
31+
}
32+
}
33+
34+
/**
35+
* List active reindex tasks. Get information about all currently running reindex tasks.
36+
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch#TODO | Elasticsearch API documentation}
37+
*/
38+
export default async function ListReindexApi (this: That, params?: T.ListReindexRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.ListReindexResponse>
39+
export default async function ListReindexApi (this: That, params?: T.ListReindexRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.ListReindexResponse, unknown>>
40+
export default async function ListReindexApi (this: That, params?: T.ListReindexRequest, options?: TransportRequestOptions): Promise<T.ListReindexResponse>
41+
export default async function ListReindexApi (this: That, params?: T.ListReindexRequest, options?: TransportRequestOptions): Promise<any> {
42+
const {
43+
path: acceptedPath
44+
} = acceptedParams.list_reindex
45+
46+
const userQuery = params?.querystring
47+
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
48+
49+
let body: Record<string, any> | string | undefined
50+
const userBody = params?.body
51+
if (userBody != null) {
52+
if (typeof userBody === 'string') {
53+
body = userBody
54+
} else {
55+
body = { ...userBody }
56+
}
57+
}
58+
59+
params = params ?? {}
60+
for (const key in params) {
61+
if (acceptedPath.includes(key)) {
62+
continue
63+
} else if (key !== 'body' && key !== 'querystring') {
64+
// @ts-expect-error
65+
querystring[key] = params[key]
66+
}
67+
}
68+
69+
const method = 'GET'
70+
const path = '/_reindex'
71+
const meta: TransportRequestMetadata = {
72+
name: 'list_reindex',
73+
acceptedParams: {
74+
path: [],
75+
body: [],
76+
query: ['detailed']
77+
}
78+
}
79+
return await this.transport.request({ path, method, querystring, body, meta }, options)
80+
}

src/api/api/security.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ export default class Security {
125125
body: [],
126126
query: []
127127
},
128+
'security.clone_api_key': {
129+
path: [],
130+
body: [
131+
'api_key',
132+
'name',
133+
'expiration',
134+
'metadata'
135+
],
136+
query: [
137+
'refresh'
138+
]
139+
},
128140
'security.create_api_key': {
129141
path: [],
130142
body: [
@@ -1273,6 +1285,65 @@ export default class Security {
12731285
return await this.transport.request({ path, method, querystring, body, meta }, options)
12741286
}
12751287

1288+
/**
1289+
* Clone an API key. Create a copy of an existing API key with a new ID. The cloned key inherits the role descriptors of the source key. This is intended for applications (such as Kibana) that need to create API keys on behalf of a user using an existing API key credential, since derived API keys (API keys created by API keys) are not otherwise supported.
1290+
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch#TODO | Elasticsearch API documentation}
1291+
*/
1292+
async cloneApiKey (this: That, params: T.SecurityCloneApiKeyRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SecurityCloneApiKeyResponse>
1293+
async cloneApiKey (this: That, params: T.SecurityCloneApiKeyRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SecurityCloneApiKeyResponse, unknown>>
1294+
async cloneApiKey (this: That, params: T.SecurityCloneApiKeyRequest, options?: TransportRequestOptions): Promise<T.SecurityCloneApiKeyResponse>
1295+
async cloneApiKey (this: That, params: T.SecurityCloneApiKeyRequest, options?: TransportRequestOptions): Promise<any> {
1296+
const {
1297+
path: acceptedPath,
1298+
body: acceptedBody,
1299+
query: acceptedQuery
1300+
} = this[kAcceptedParams]['security.clone_api_key']
1301+
1302+
const userQuery = params?.querystring
1303+
const querystring: Record<string, any> = userQuery != null ? { ...userQuery } : {}
1304+
1305+
let body: Record<string, any> | string | undefined
1306+
const userBody = params?.body
1307+
if (userBody != null) {
1308+
if (typeof userBody === 'string') {
1309+
body = userBody
1310+
} else {
1311+
body = { ...userBody }
1312+
}
1313+
}
1314+
1315+
for (const key in params) {
1316+
if (acceptedBody.includes(key)) {
1317+
body = body ?? {}
1318+
// @ts-expect-error
1319+
body[key] = params[key]
1320+
} else if (acceptedPath.includes(key)) {
1321+
continue
1322+
} else if (key !== 'body' && key !== 'querystring') {
1323+
if (acceptedQuery.includes(key) || commonQueryParams.includes(key)) {
1324+
// @ts-expect-error
1325+
querystring[key] = params[key]
1326+
} else {
1327+
body = body ?? {}
1328+
// @ts-expect-error
1329+
body[key] = params[key]
1330+
}
1331+
}
1332+
}
1333+
1334+
const method = 'POST'
1335+
const path = '/_security/api_key/clone'
1336+
const meta: TransportRequestMetadata = {
1337+
name: 'security.clone_api_key',
1338+
acceptedParams: {
1339+
path: [],
1340+
body: ['api_key', 'name', 'expiration', 'metadata'],
1341+
query: ['refresh']
1342+
}
1343+
}
1344+
return await this.transport.request({ path, method, querystring, body, meta }, options)
1345+
}
1346+
12761347
/**
12771348
* Create an API key. Create an API key for access without requiring basic authentication. IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. If you specify privileges, the API returns an error. A successful request returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds. NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. The API keys are created by the Elasticsearch API key service, which is automatically enabled. To configure or turn off the API key service, refer to API key service setting documentation.
12781349
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-create-api-key | Elasticsearch API documentation}

0 commit comments

Comments
 (0)