diff --git a/api/OpenSearchApi.d.ts b/api/OpenSearchApi.d.ts index ade3c01fb..42eb79c91 100644 --- a/api/OpenSearchApi.d.ts +++ b/api/OpenSearchApi.d.ts @@ -673,6 +673,24 @@ export default class OpenSearchAPI { }; + list: { + help (params?: API.List_Help_Request, options?: TransportRequestOptions): TransportRequestPromise; + help (callback: callbackFn): TransportRequestCallback; + help (params: API.List_Help_Request, callback: callbackFn): TransportRequestCallback; + help (params: API.List_Help_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + indices (params?: API.List_Indices_Request, options?: TransportRequestOptions): TransportRequestPromise; + indices (callback: callbackFn): TransportRequestCallback; + indices (params: API.List_Indices_Request, callback: callbackFn): TransportRequestCallback; + indices (params: API.List_Indices_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + shards (params?: API.List_Shards_Request, options?: TransportRequestOptions): TransportRequestPromise; + shards (callback: callbackFn): TransportRequestCallback; + shards (params: API.List_Shards_Request, callback: callbackFn): TransportRequestCallback; + shards (params: API.List_Shards_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + }; + ml: { registerAgents (params?: API.Ml_RegisterAgents_Request, options?: TransportRequestOptions): TransportRequestPromise; registerAgents (callback: callbackFn): TransportRequestCallback; @@ -1326,19 +1344,23 @@ export default class OpenSearchAPI { }; sql: { - settings (params: API.Sql_Settings_Request, options?: TransportRequestOptions): TransportRequestPromise; + settings (params?: API.Sql_Settings_Request, options?: TransportRequestOptions): TransportRequestPromise; + settings (callback: callbackFn): TransportRequestCallback; settings (params: API.Sql_Settings_Request, callback: callbackFn): TransportRequestCallback; settings (params: API.Sql_Settings_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; - query (params: API.Sql_Query_Request, options?: TransportRequestOptions): TransportRequestPromise; + query (params?: API.Sql_Query_Request, options?: TransportRequestOptions): TransportRequestPromise; + query (callback: callbackFn): TransportRequestCallback; query (params: API.Sql_Query_Request, callback: callbackFn): TransportRequestCallback; query (params: API.Sql_Query_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; - explain (params: API.Sql_Explain_Request, options?: TransportRequestOptions): TransportRequestPromise; + explain (params?: API.Sql_Explain_Request, options?: TransportRequestOptions): TransportRequestPromise; + explain (callback: callbackFn): TransportRequestCallback; explain (params: API.Sql_Explain_Request, callback: callbackFn): TransportRequestCallback; explain (params: API.Sql_Explain_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; - close (params: API.Sql_Close_Request, options?: TransportRequestOptions): TransportRequestPromise; + close (params?: API.Sql_Close_Request, options?: TransportRequestOptions): TransportRequestPromise; + close (callback: callbackFn): TransportRequestCallback; close (params: API.Sql_Close_Request, callback: callbackFn): TransportRequestCallback; close (params: API.Sql_Close_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; @@ -1347,7 +1369,8 @@ export default class OpenSearchAPI { getStats (params: API.Sql_GetStats_Request, callback: callbackFn): TransportRequestCallback; getStats (params: API.Sql_GetStats_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; - postStats (params: API.Sql_PostStats_Request, options?: TransportRequestOptions): TransportRequestPromise; + postStats (params?: API.Sql_PostStats_Request, options?: TransportRequestOptions): TransportRequestPromise; + postStats (callback: callbackFn): TransportRequestCallback; postStats (params: API.Sql_PostStats_Request, callback: callbackFn): TransportRequestCallback; postStats (params: API.Sql_PostStats_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; diff --git a/api/OpenSearchApi.js b/api/OpenSearchApi.js index 4ca4e5f7e..6eb8a2556 100644 --- a/api/OpenSearchApi.js +++ b/api/OpenSearchApi.js @@ -34,6 +34,7 @@ class OpenSearchAPI { insights: new(require('./insights/_api'))(this), ism: new(require('./ism/_api'))(this), knn: new(require('./knn/_api'))(this), + list: new(require('./list/_api'))(this), ml: new(require('./ml/_api'))(this), nodes: new(require('./nodes/_api'))(this), notifications: new(require('./notifications/_api'))(this), @@ -161,6 +162,7 @@ class OpenSearchAPI { insights: { get() { return this[kApiModules].insights } }, ism: { get() { return this[kApiModules].ism } }, knn: { get() { return this[kApiModules].knn } }, + list: { get() { return this[kApiModules].list } }, ml: { get() { return this[kApiModules].ml } }, nodes: { get() { return this[kApiModules].nodes } }, notifications: { get() { return this[kApiModules].notifications } }, diff --git a/api/_types/_common.d.ts b/api/_types/_common.d.ts index e9256d354..3dbaf6aab 100644 --- a/api/_types/_common.d.ts +++ b/api/_types/_common.d.ts @@ -204,6 +204,8 @@ export type FieldSizeUsage = { export type FieldValue = boolean | undefined | number | Record | string +export type FieldWithDirection = Record + export type FieldWithOrder = Record export type FlushStats = { @@ -770,7 +772,7 @@ export type SlicesCalculation = 'auto' export type Sort = SortCombinations | SortCombinations[] -export type SortCombinations = Field | FieldWithOrder | SortOptions +export type SortCombinations = Field | FieldWithDirection | FieldWithOrder | SortOptions export type SortMode = 'avg' | 'max' | 'median' | 'min' | 'sum' diff --git a/api/_types/_common.mapping.d.ts b/api/_types/_common.mapping.d.ts index 832981f9c..3a32ec4c1 100644 --- a/api/_types/_common.mapping.d.ts +++ b/api/_types/_common.mapping.d.ts @@ -159,6 +159,12 @@ export type FieldNamesField = { enabled: boolean; } +export type FlatObjectProperty = PropertyBase & { + aggregatable?: boolean; + searchable?: boolean; + type: 'flat_object'; +} + export type FlattenedProperty = PropertyBase & { boost?: number; depth_limit?: number; @@ -331,7 +337,7 @@ export type PercolatorProperty = PropertyBase & { type: 'percolator'; } -export type Property = BinaryProperty | BooleanProperty | JoinProperty | KeywordProperty | MatchOnlyTextProperty | PercolatorProperty | RankFeatureProperty | RankFeaturesProperty | SearchAsYouTypeProperty | TextProperty | VersionProperty | WildcardProperty | DateNanosProperty | DateProperty | AggregateMetricDoubleProperty | DenseVectorProperty | SparseVectorProperty | FlattenedProperty | NestedProperty | ObjectProperty | CompletionProperty | ConstantKeywordProperty | FieldAliasProperty | HistogramProperty | IpProperty | Murmur3HashProperty | TokenCountProperty | GeoPointProperty | GeoShapeProperty | XyPointProperty | XyShapeProperty | ByteNumberProperty | DoubleNumberProperty | FloatNumberProperty | HalfFloatNumberProperty | IntegerNumberProperty | LongNumberProperty | ScaledFloatNumberProperty | ShortNumberProperty | UnsignedLongNumberProperty | DateRangeProperty | DoubleRangeProperty | FloatRangeProperty | IntegerRangeProperty | IpRangeProperty | LongRangeProperty | KnnVectorProperty +export type Property = BinaryProperty | BooleanProperty | JoinProperty | KeywordProperty | MatchOnlyTextProperty | PercolatorProperty | RankFeatureProperty | RankFeaturesProperty | SearchAsYouTypeProperty | TextProperty | VersionProperty | WildcardProperty | DateNanosProperty | DateProperty | AggregateMetricDoubleProperty | DenseVectorProperty | SparseVectorProperty | FlattenedProperty | FlatObjectProperty | NestedProperty | ObjectProperty | CompletionProperty | ConstantKeywordProperty | FieldAliasProperty | HistogramProperty | IpProperty | Murmur3HashProperty | TokenCountProperty | GeoPointProperty | GeoShapeProperty | XyPointProperty | XyShapeProperty | ByteNumberProperty | DoubleNumberProperty | FloatNumberProperty | HalfFloatNumberProperty | IntegerNumberProperty | LongNumberProperty | ScaledFloatNumberProperty | ShortNumberProperty | UnsignedLongNumberProperty | DateRangeProperty | DoubleRangeProperty | FloatRangeProperty | IntegerRangeProperty | IpRangeProperty | LongRangeProperty | KnnVectorProperty export type PropertyBase = { dynamic?: DynamicMapping; diff --git a/api/_types/cluster.allocation_explain.d.ts b/api/_types/cluster.allocation_explain.d.ts index 31555a22e..7d4d1c444 100644 --- a/api/_types/cluster.allocation_explain.d.ts +++ b/api/_types/cluster.allocation_explain.d.ts @@ -71,7 +71,7 @@ export type NodeAllocationExplanation = { node_name: Common.Name; store?: AllocationStore; transport_address: Common.TransportAddress; - weight_ranking: number; + weight_ranking?: number; } export type NodeDiskUsage = { diff --git a/api/_types/flow_framework.common.d.ts b/api/_types/flow_framework.common.d.ts index 16576ccb3..521780490 100644 --- a/api/_types/flow_framework.common.d.ts +++ b/api/_types/flow_framework.common.d.ts @@ -14,6 +14,7 @@ * modify the API generator. */ +import * as Common from './_common' export type All = boolean @@ -40,10 +41,12 @@ export type FlowFrameworkDeleteResponse = { export type FlowFrameworkGetResponse = { created_time?: number; description?: string; + last_provisioned_time?: number; last_updated_time?: number; name?: string; use_case?: string; user?: user; + version?: version; workflows?: Record; } @@ -57,7 +60,7 @@ export type FlowFrameworkUpdate = { export type hits = { hits?: itemsObject[]; - max_score?: number; + max_score?: undefined | number; total?: total; } @@ -93,13 +96,14 @@ export type SearchWorkflowRequest = { export type shards = { failed?: number; + skipped?: number; successful?: number; total?: number; } export type StateHits = { hits?: StateItems[]; - max_score?: number; + max_score?: undefined | number; total?: total; } @@ -141,6 +145,10 @@ export type version = { export type WorkflowID = string +export type WorkflowIDResponse = { + workflow_id?: string; +} + export type WorkflowSearchResponse = { _shards?: shards; hits?: hits; @@ -178,7 +186,10 @@ export type WorkflowStep = { inputs?: string[]; outputs?: string[]; required_plugins?: string[]; + timeout?: Common.Duration; } export type WorkflowStepName = string +export type WorkflowSteps = Record + diff --git a/api/_types/flow_framework.errors.d.ts b/api/_types/flow_framework.errors.d.ts index 5eda51732..7f9be3f61 100644 --- a/api/_types/flow_framework.errors.d.ts +++ b/api/_types/flow_framework.errors.d.ts @@ -20,7 +20,10 @@ export type BadRequestError = { status?: number; } -export type ConflictError = Record +export type ConflictError = { + error?: string; + status?: number; +} export type DeprovisioningError = { error: string; @@ -35,22 +38,39 @@ export type DuplicateKeyError = { status?: number; } -export type FlowFrameworkAPIDisabledError = Record +export type FlowFrameworkAPIDisabledError = { + error?: string; + status?: number; +} -export type InvalidParameterError = Record +export type InvalidParameterError = { + error?: string; + status?: number; +} export type InvalidRequestBodyFieldError = { error?: string; status?: number; } -export type InvalidTemplateVersionError = Record +export type InvalidTemplateVersionError = { + error?: string; +} -export type MaxWorkflowsLimitError = Record +export type MaxWorkflowsLimitError = { + code?: number; + error?: string; +} -export type MissingParameterError = Record +export type MissingParameterError = { + error?: string; + status?: number; +} -export type ParameterConflictError = Record +export type ParameterConflictError = { + error?: string; + status?: number; +} export type RequestBodyParsingFailedError = { error?: string; @@ -66,15 +86,31 @@ export type TemplateNameRequiredError = { error?: string; } -export type TemplateNotFoundError = Record +export type TemplateNotFoundError = { + code?: number; + error?: string; +} -export type UnsupportedFieldUpdateError = Record +export type UnsupportedFieldUpdateError = { + error?: string; +} -export type WorkFlowIdNullError = Record +export type WorkFlowIdNullError = { + error?: string; + status?: number; +} -export type WorkflowParsingError = Record +export type WorkflowParsingError = { + error?: string; +} -export type WorkflowSaveError = Record +export type WorkflowSaveError = { + error?: string; + status?: number; +} -export type WorkflowStepsRetrieveError = Record +export type WorkflowStepsRetrieveError = { + code?: number; + error?: string; +} diff --git a/api/_types/indices._common.d.ts b/api/_types/indices._common.d.ts index 42a5c0091..c70a0323d 100644 --- a/api/_types/indices._common.d.ts +++ b/api/_types/indices._common.d.ts @@ -74,6 +74,11 @@ export type FielddataFrequencyFilter = { export type IndexCheckOnStartup = 'checksum' | 'false' | 'true' +export type IndexError = { + error?: IndexErrorCause; + status?: number; +} + export type IndexErrorCause = { index?: Common.IndexName; index_uuid?: Common.Uuid; diff --git a/api/_types/query._common.d.ts b/api/_types/query._common.d.ts index 49b0582d9..c9540bd2a 100644 --- a/api/_types/query._common.d.ts +++ b/api/_types/query._common.d.ts @@ -53,12 +53,17 @@ export type DataSourceRetrieve = { status: string; } -export type ErrorResponse = { +export type Error = { reason: string; root_cause: RootCause[]; type: string; } +export type ErrorResponse = { + error?: Error; + status?: number; +} + export type RootCause = { reason: string; type: string; diff --git a/api/_types/security._common.d.ts b/api/_types/security._common.d.ts index de48173c1..f8e3ec5c2 100644 --- a/api/_types/security._common.d.ts +++ b/api/_types/security._common.d.ts @@ -183,6 +183,11 @@ export type DynamicOptions = { respect_request_indices_options?: boolean; } +export type Error = { + message?: string; + status?: 'BAD_REQUEST' | 'CONFLICT' | 'FORBIDDEN' | 'INTERNAL_SERVER_ERROR' | 'NOT_FOUND' | 'NOT_IMPLEMENTED' | 'UNAUTHORIZED'; +} + export type GenerateOBOToken = { authenticationToken?: string; durationSeconds?: string; diff --git a/api/flowFramework/delete.d.ts b/api/flowFramework/delete.d.ts index a577c227f..4bd889dd9 100644 --- a/api/flowFramework/delete.d.ts +++ b/api/flowFramework/delete.d.ts @@ -27,5 +27,5 @@ export type FlowFramework_Delete_Response = ApiResponse & { body: FlowFramework_Delete_ResponseBody; } -export type FlowFramework_Delete_ResponseBody = Record +export type FlowFramework_Delete_ResponseBody = FlowFramework_Common.FlowFrameworkDeleteResponse diff --git a/api/flowFramework/deprovision.d.ts b/api/flowFramework/deprovision.d.ts index 2c9fefec9..666958eae 100644 --- a/api/flowFramework/deprovision.d.ts +++ b/api/flowFramework/deprovision.d.ts @@ -27,5 +27,5 @@ export type FlowFramework_Deprovision_Response = ApiResponse & { body: FlowFramework_Deprovision_ResponseBody; } -export type FlowFramework_Deprovision_ResponseBody = Record +export type FlowFramework_Deprovision_ResponseBody = FlowFramework_Common.WorkflowIDResponse diff --git a/api/flowFramework/get.d.ts b/api/flowFramework/get.d.ts index cb7001598..dce19cf82 100644 --- a/api/flowFramework/get.d.ts +++ b/api/flowFramework/get.d.ts @@ -26,5 +26,5 @@ export type FlowFramework_Get_Response = ApiResponse & { body: FlowFramework_Get_ResponseBody; } -export type FlowFramework_Get_ResponseBody = Record +export type FlowFramework_Get_ResponseBody = FlowFramework_Common.FlowFrameworkGetResponse diff --git a/api/flowFramework/getStatus.d.ts b/api/flowFramework/getStatus.d.ts index 80eaeeaf8..49e36fdf5 100644 --- a/api/flowFramework/getStatus.d.ts +++ b/api/flowFramework/getStatus.d.ts @@ -27,5 +27,5 @@ export type FlowFramework_GetStatus_Response = ApiResponse & { body: FlowFramework_GetStatus_ResponseBody; } -export type FlowFramework_GetStatus_ResponseBody = Record +export type FlowFramework_GetStatus_ResponseBody = FlowFramework_Common.WorkFlowStatusFullResponse | FlowFramework_Common.WorkFlowStatusDefaultResponse diff --git a/api/flowFramework/getSteps.d.ts b/api/flowFramework/getSteps.d.ts index ebc0e0137..2f4b4428b 100644 --- a/api/flowFramework/getSteps.d.ts +++ b/api/flowFramework/getSteps.d.ts @@ -26,5 +26,5 @@ export type FlowFramework_GetSteps_Response = ApiResponse & { body: FlowFramework_GetSteps_ResponseBody; } -export type FlowFramework_GetSteps_ResponseBody = Record +export type FlowFramework_GetSteps_ResponseBody = FlowFramework_Common.WorkflowSteps diff --git a/api/flowFramework/provision.d.ts b/api/flowFramework/provision.d.ts index 7105c4c59..c75925804 100644 --- a/api/flowFramework/provision.d.ts +++ b/api/flowFramework/provision.d.ts @@ -27,5 +27,5 @@ export type FlowFramework_Provision_Response = ApiResponse & { body: FlowFramework_Provision_ResponseBody; } -export type FlowFramework_Provision_ResponseBody = Record +export type FlowFramework_Provision_ResponseBody = FlowFramework_Common.WorkflowIDResponse diff --git a/api/flowFramework/search.d.ts b/api/flowFramework/search.d.ts index 010b96b0c..cd8b992d6 100644 --- a/api/flowFramework/search.d.ts +++ b/api/flowFramework/search.d.ts @@ -26,5 +26,5 @@ export type FlowFramework_Search_Response = ApiResponse & { body: FlowFramework_Search_ResponseBody; } -export type FlowFramework_Search_ResponseBody = Record +export type FlowFramework_Search_ResponseBody = FlowFramework_Common.WorkflowSearchResponse diff --git a/api/flowFramework/searchState.d.ts b/api/flowFramework/searchState.d.ts index 0b9d2d1fa..5113d2b97 100644 --- a/api/flowFramework/searchState.d.ts +++ b/api/flowFramework/searchState.d.ts @@ -26,5 +26,5 @@ export type FlowFramework_SearchState_Response = ApiResponse & { body: FlowFramework_SearchState_ResponseBody; } -export type FlowFramework_SearchState_ResponseBody = Record +export type FlowFramework_SearchState_ResponseBody = FlowFramework_Common.WorkflowSearchStateResponse diff --git a/api/index.d.ts b/api/index.d.ts index 1cd27fffe..ddf97692b 100644 --- a/api/index.d.ts +++ b/api/index.d.ts @@ -159,6 +159,9 @@ import { Ingest_DeletePipeline_Request, Ingest_DeletePipeline_Response, Ingest_D import { Ingest_PutPipeline_Request, Ingest_PutPipeline_RequestBody, Ingest_PutPipeline_Response, Ingest_PutPipeline_ResponseBody } from './ingest/putPipeline'; import { Ingest_ProcessorGrok_Request, Ingest_ProcessorGrok_Response, Ingest_ProcessorGrok_ResponseBody } from './ingest/processorGrok'; import { Insights_TopQueries_Request, Insights_TopQueries_Response, Insights_TopQueries_ResponseBody } from './insights/topQueries'; +import { List_Help_Request, List_Help_Response, List_Help_ResponseBody } from './list/help'; +import { List_Indices_Request, List_Indices_Response, List_Indices_ResponseBody } from './list/indices'; +import { List_Shards_Request, List_Shards_Response, List_Shards_ResponseBody } from './list/shards'; import { Nodes_Info_Request, Nodes_Info_Response, Nodes_Info_ResponseBody } from './nodes/info'; import { Nodes_HotThreads_Request, Nodes_HotThreads_Response, Nodes_HotThreads_ResponseBody } from './nodes/hotThreads'; import { Nodes_ReloadSecureSettings_Request, Nodes_ReloadSecureSettings_RequestBody, Nodes_ReloadSecureSettings_Response, Nodes_ReloadSecureSettings_ResponseBody } from './nodes/reloadSecureSettings'; @@ -500,6 +503,9 @@ export { Ingest_PutPipeline_Request, Ingest_PutPipeline_RequestBody, Ingest_PutPipeline_Response, Ingest_PutPipeline_ResponseBody, Ingest_ProcessorGrok_Request, Ingest_ProcessorGrok_Response, Ingest_ProcessorGrok_ResponseBody, Insights_TopQueries_Request, Insights_TopQueries_Response, Insights_TopQueries_ResponseBody, + List_Help_Request, List_Help_Response, List_Help_ResponseBody, + List_Indices_Request, List_Indices_Response, List_Indices_ResponseBody, + List_Shards_Request, List_Shards_Response, List_Shards_ResponseBody, Nodes_Info_Request, Nodes_Info_Response, Nodes_Info_ResponseBody, Nodes_HotThreads_Request, Nodes_HotThreads_Response, Nodes_HotThreads_ResponseBody, Nodes_ReloadSecureSettings_Request, Nodes_ReloadSecureSettings_RequestBody, Nodes_ReloadSecureSettings_Response, Nodes_ReloadSecureSettings_ResponseBody, diff --git a/api/list/_api.js b/api/list/_api.js new file mode 100644 index 000000000..68709214f --- /dev/null +++ b/api/list/_api.js @@ -0,0 +1,28 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +/** @namespace API-List */ + +function ListApi(bindObj) { + this.help = require('./help').bind(bindObj); + this.indices = require('./indices').bind(bindObj); + this.shards = require('./shards').bind(bindObj); + +} + +module.exports = ListApi; diff --git a/api/list/help.d.ts b/api/list/help.d.ts new file mode 100644 index 000000000..f9fdfde73 --- /dev/null +++ b/api/list/help.d.ts @@ -0,0 +1,27 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Global from '../_types/_global' + +export type List_Help_Request = Global.Params & Record + +export type List_Help_Response = ApiResponse & { + body: List_Help_ResponseBody; +} + +export type List_Help_ResponseBody = Record + diff --git a/api/list/help.js b/api/list/help.js new file mode 100644 index 000000000..7f74b972f --- /dev/null +++ b/api/list/help.js @@ -0,0 +1,45 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments } = require('../utils'); + +/** + * Returns help for the List APIs. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/list/index/ - list.help} + * + * @memberOf API-List + * + * @param {object} [params] - (Unused) + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function helpFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { body, ...querystring } = params; + + const path = '/_list'; + const method = 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = helpFunc; diff --git a/api/list/indices.d.ts b/api/list/indices.d.ts new file mode 100644 index 000000000..870294194 --- /dev/null +++ b/api/list/indices.d.ts @@ -0,0 +1,51 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Cat_Indices from '../_types/cat.indices' +import * as Common from '../_types/_common' +import * as Global from '../_types/_global' + +export type List_Indices_Request = Global.Params & { + bytes?: Common.ByteUnit; + cluster_manager_timeout?: Common.Duration; + expand_wildcards?: Common.ExpandWildcards; + format?: string; + h?: string[]; + health?: Common.HealthStatus; + help?: boolean; + include_unloaded_segments?: boolean; + index?: Common.Indices; + local?: boolean; + master_timeout?: Common.Duration; + next_token?: undefined | string; + pri?: boolean; + s?: string[]; + size?: number; + sort?: 'asc' | 'desc'; + time?: Common.TimeUnit; + v?: boolean; +} + +export type List_Indices_Response = ApiResponse & { + body: List_Indices_ResponseBody; +} + +export type List_Indices_ResponseBody = { + indices?: Cat_Indices.IndicesRecord[]; + next_token?: undefined | string; +} + diff --git a/api/list/indices.js b/api/list/indices.js new file mode 100644 index 000000000..19fa6ffae --- /dev/null +++ b/api/list/indices.js @@ -0,0 +1,65 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam } = require('../utils'); + +/** + * Returns paginated information about indexes including number of primaries and replicas, document counts, disk size. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/list/list-indices/ - list.indices} + * + * @memberOf API-List + * + * @param {object} [params] + * @param {string} [params.bytes] - The unit used to display byte values. + * @param {string} [params.cluster_manager_timeout] - Operation timeout for connection to cluster-manager node. + * @param {string} [params.expand_wildcards] - The type of index that wildcard patterns can match. + * @param {string} [params.format] - A short version of the Accept header, such as `JSON`, `YAML`. + * @param {array} [params.h] - Comma-separated list of column names to display. + * @param {string} [params.health] - The health status used to limit returned indexes. By default, the response includes indexes of any health status. + * @param {boolean} [params.help=false] - Return help information. + * @param {boolean} [params.include_unloaded_segments=false] - If true, the response includes information from segments that are not loaded into memory. + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster-manager node. + * @param {string} [params.master_timeout] DEPRECATED - Operation timeout for connection to cluster manager node. + * @param {null | string} [params.next_token] - Token to retrieve next page of indexes. + * @param {boolean} [params.pri=false] - If true, the response only includes information from primary shards. + * @param {array} [params.s] - Comma-separated list of column names or column aliases to sort by. + * @param {number} [params.size] - Maximum number of indexes to be displayed in a page. + * @param {string} [params.sort] - Defines order in which indexes will be displayed. Accepted values are `asc` and `desc`. If `desc`, most recently created indexes would be displayed first. + * @param {string} [params.time] - The unit used to display time values. + * @param {boolean} [params.v=false] - Verbose mode. Display column headers. + * @param {string} [params.index] - Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function indicesFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { body, index, ...querystring } = params; + index = parsePathParam(index); + + const path = ['/_list/indices/', index].filter(c => c).join('').replace('//', '/'); + const method = 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = indicesFunc; diff --git a/api/list/shards.d.ts b/api/list/shards.d.ts new file mode 100644 index 000000000..82fa17c1e --- /dev/null +++ b/api/list/shards.d.ts @@ -0,0 +1,47 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Cat_Shards from '../_types/cat.shards' +import * as Common from '../_types/_common' +import * as Global from '../_types/_global' + +export type List_Shards_Request = Global.Params & { + bytes?: Common.ByteUnit; + cluster_manager_timeout?: Common.Duration; + format?: string; + h?: string[]; + help?: boolean; + index?: Common.Indices; + local?: boolean; + master_timeout?: Common.Duration; + next_token?: undefined | string; + s?: string[]; + size?: number; + sort?: 'asc' | 'desc'; + time?: Common.TimeUnit; + v?: boolean; +} + +export type List_Shards_Response = ApiResponse & { + body: List_Shards_ResponseBody; +} + +export type List_Shards_ResponseBody = { + next_token?: undefined | string; + shards?: Cat_Shards.ShardsRecord[]; +} + diff --git a/api/list/shards.js b/api/list/shards.js new file mode 100644 index 000000000..ba43382d6 --- /dev/null +++ b/api/list/shards.js @@ -0,0 +1,61 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam } = require('../utils'); + +/** + * Returns paginated details of shard allocation on nodes. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/list/list-shards/ - list.shards} + * + * @memberOf API-List + * + * @param {object} [params] + * @param {string} [params.bytes] - The unit used to display byte values. + * @param {string} [params.cluster_manager_timeout] - Operation timeout for connection to cluster-manager node. + * @param {string} [params.format] - A short version of the Accept header, such as `JSON`, `YAML`. + * @param {array} [params.h] - Comma-separated list of column names to display. + * @param {boolean} [params.help=false] - Return help information. + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster-manager node. + * @param {string} [params.master_timeout] DEPRECATED - Operation timeout for connection to cluster manager node. + * @param {null | string} [params.next_token] - Token to retrieve next page of shards. + * @param {array} [params.s] - Comma-separated list of column names or column aliases to sort by. + * @param {number} [params.size] - Maximum number of shards to be displayed in a page. + * @param {string} [params.sort] - Defines order in which shards will be displayed. Accepted values are `asc` and `desc`. If `desc`, most recently created shards would be displayed first. + * @param {string} [params.time] - The unit in which to display time values. + * @param {boolean} [params.v=false] - Verbose mode. Display column headers. + * @param {string} [params.index] - A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function shardsFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { body, index, ...querystring } = params; + index = parsePathParam(index); + + const path = ['/_list/shards/', index].filter(c => c).join('').replace('//', '/'); + const method = 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = shardsFunc; diff --git a/api/sql/close.d.ts b/api/sql/close.d.ts index e33df7a0a..a6fb7c26b 100644 --- a/api/sql/close.d.ts +++ b/api/sql/close.d.ts @@ -19,7 +19,7 @@ import * as Global from '../_types/_global' import * as Sql_Common from '../_types/sql._common' export type Sql_Close_Request = Global.Params & { - body: Sql_Common.SqlClose; + body?: Sql_Common.SqlClose; format?: string; sanitize?: boolean; } diff --git a/api/sql/close.js b/api/sql/close.js index 280ac1dbb..4c814e266 100644 --- a/api/sql/close.js +++ b/api/sql/close.js @@ -16,7 +16,7 @@ 'use strict'; -const { normalizeArguments, handleMissingParam } = require('../utils'); +const { normalizeArguments } = require('../utils'); /** * Clear the cursor context. @@ -24,10 +24,10 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); * * @memberOf API-Sql * - * @param {object} params + * @param {object} [params] * @param {string} [params.format] - A short version of the Accept header, e.g. json, yaml. * @param {boolean} [params.sanitize=true] - Specifies whether to escape special characters in the results - * @param {object} params.body + * @param {object} [params.body] * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response @@ -36,12 +36,12 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); */ function closeFunc(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); - if (params.body == null) return handleMissingParam('body', this, callback); let { body, ...querystring } = params; const path = '/_plugins/_sql/close'; const method = 'POST'; + body = body || ''; return this.transport.request({ method, path, querystring, body }, options, callback); } diff --git a/api/sql/explain.d.ts b/api/sql/explain.d.ts index be70e04ea..2a6284270 100644 --- a/api/sql/explain.d.ts +++ b/api/sql/explain.d.ts @@ -19,7 +19,7 @@ import * as Global from '../_types/_global' import * as Sql_Common from '../_types/sql._common' export type Sql_Explain_Request = Global.Params & { - body: Sql_Common.Explain; + body?: Sql_Common.Explain; format?: string; sanitize?: boolean; } diff --git a/api/sql/explain.js b/api/sql/explain.js index aa2c32859..c24e00b87 100644 --- a/api/sql/explain.js +++ b/api/sql/explain.js @@ -16,7 +16,7 @@ 'use strict'; -const { normalizeArguments, handleMissingParam } = require('../utils'); +const { normalizeArguments } = require('../utils'); /** * Shows how a query is executed against OpenSearch. @@ -24,10 +24,10 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); * * @memberOf API-Sql * - * @param {object} params + * @param {object} [params] * @param {string} [params.format] - A short version of the Accept header, e.g. json, yaml. * @param {boolean} [params.sanitize=true] - Specifies whether to escape special characters in the results - * @param {object} params.body + * @param {object} [params.body] * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response @@ -36,12 +36,12 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); */ function explainFunc(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); - if (params.body == null) return handleMissingParam('body', this, callback); let { body, ...querystring } = params; const path = '/_plugins/_sql/_explain'; const method = 'POST'; + body = body || ''; return this.transport.request({ method, path, querystring, body }, options, callback); } diff --git a/api/sql/postStats.d.ts b/api/sql/postStats.d.ts index 159cecc4c..10885bd14 100644 --- a/api/sql/postStats.d.ts +++ b/api/sql/postStats.d.ts @@ -19,7 +19,7 @@ import * as Global from '../_types/_global' import * as Sql_Common from '../_types/sql._common' export type Sql_PostStats_Request = Global.Params & { - body: Sql_Common.Stats; + body?: Sql_Common.Stats; format?: string; sanitize?: boolean; } diff --git a/api/sql/postStats.js b/api/sql/postStats.js index 7906f5626..9f5b23624 100644 --- a/api/sql/postStats.js +++ b/api/sql/postStats.js @@ -16,7 +16,7 @@ 'use strict'; -const { normalizeArguments, handleMissingParam } = require('../utils'); +const { normalizeArguments } = require('../utils'); /** * By a stats endpoint, you are able to collect metrics for the plugin within the interval. @@ -24,10 +24,10 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); * * @memberOf API-Sql * - * @param {object} params + * @param {object} [params] * @param {string} [params.format] - A short version of the Accept header, e.g. json, yaml. * @param {boolean} [params.sanitize=true] - Specifies whether to escape special characters in the results - * @param {object} params.body + * @param {object} [params.body] * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response @@ -36,12 +36,12 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); */ function postStatsFunc(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); - if (params.body == null) return handleMissingParam('body', this, callback); let { body, ...querystring } = params; const path = '/_plugins/_sql/stats'; const method = 'POST'; + body = body || ''; return this.transport.request({ method, path, querystring, body }, options, callback); } diff --git a/api/sql/query.d.ts b/api/sql/query.d.ts index 3684e11a4..c2f1d6281 100644 --- a/api/sql/query.d.ts +++ b/api/sql/query.d.ts @@ -19,7 +19,7 @@ import * as Global from '../_types/_global' import * as Sql_Common from '../_types/sql._common' export type Sql_Query_Request = Global.Params & { - body: Sql_Common.Query; + body?: Sql_Common.Query; format?: string; sanitize?: boolean; } diff --git a/api/sql/query.js b/api/sql/query.js index bc986ed81..cd0fded90 100644 --- a/api/sql/query.js +++ b/api/sql/query.js @@ -16,7 +16,7 @@ 'use strict'; -const { normalizeArguments, handleMissingParam } = require('../utils'); +const { normalizeArguments } = require('../utils'); /** * Send a SQL/PPL query to the SQL plugin. @@ -24,10 +24,10 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); * * @memberOf API-Sql * - * @param {object} params + * @param {object} [params] * @param {string} [params.format] - A short version of the Accept header, e.g. json, yaml. * @param {boolean} [params.sanitize=true] - Specifies whether to escape special characters in the results - * @param {object} params.body + * @param {object} [params.body] * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response @@ -36,12 +36,12 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); */ function queryFunc(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); - if (params.body == null) return handleMissingParam('body', this, callback); let { body, ...querystring } = params; const path = '/_plugins/_sql'; const method = 'POST'; + body = body || ''; return this.transport.request({ method, path, querystring, body }, options, callback); } diff --git a/api/sql/settings.d.ts b/api/sql/settings.d.ts index 0f0b54147..3ee2e64b8 100644 --- a/api/sql/settings.d.ts +++ b/api/sql/settings.d.ts @@ -19,7 +19,7 @@ import * as Global from '../_types/_global' import * as Sql_Common from '../_types/sql._common' export type Sql_Settings_Request = Global.Params & { - body: Sql_Settings_RequestBody; + body?: Sql_Settings_RequestBody; format?: string; } diff --git a/api/sql/settings.js b/api/sql/settings.js index 050bec68a..b627be1fb 100644 --- a/api/sql/settings.js +++ b/api/sql/settings.js @@ -16,7 +16,7 @@ 'use strict'; -const { normalizeArguments, handleMissingParam } = require('../utils'); +const { normalizeArguments } = require('../utils'); /** * Adds SQL settings to the standard OpenSearch cluster settings. @@ -24,9 +24,9 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); * * @memberOf API-Sql * - * @param {object} params + * @param {object} [params] * @param {string} [params.format] - A short version of the Accept header, e.g. json, yaml. - * @param {string} params.body + * @param {string} [params.body] * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response @@ -35,12 +35,12 @@ const { normalizeArguments, handleMissingParam } = require('../utils'); */ function settingsFunc(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); - if (params.body == null) return handleMissingParam('body', this, callback); let { body, ...querystring } = params; const path = '/_plugins/_query/settings'; const method = 'PUT'; + body = body || ''; return this.transport.request({ method, path, querystring, body }, options, callback); }