From fa33037b86f64384b933401236471b89b8ac8d1c Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Thu, 7 Mar 2024 20:44:52 +0100 Subject: [PATCH] Auto-generated code for main (#2152) --- docs/reference.asciidoc | 8 +-- src/api/api/snapshot.ts | 13 +--- src/api/types.ts | 127 ++++++++++++++++++++++++++-------- src/api/typesWithBodyKey.ts | 133 +++++++++++++++++++++++++++--------- 4 files changed, 208 insertions(+), 73 deletions(-) diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 05f9e1c04..4e74760a0 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -4234,7 +4234,7 @@ a new date field is added instead of string. not used at all by Elasticsearch, but can be used to store application-specific metadata. ** *`numeric_detection` (Optional, boolean)*: Automatically map strings into numeric data types for all fields. -** *`properties` (Optional, Record)*: Mapping for a field. For new fields, this mapping can include: +** *`properties` (Optional, Record)*: Mapping for a field. For new fields, this mapping can include: - Field name - Field data type @@ -8249,7 +8249,7 @@ client.security.putRole({ name }) ** *`indices` (Optional, { field_security, names, privileges, query, allow_restricted_indices }[])*: A list of indices permissions entries. ** *`metadata` (Optional, Record)*: Optional metadata. Within the metadata object, keys that begin with an underscore (`_`) are reserved for system use. ** *`run_as` (Optional, string[])*: A list of users that the owners of this role can impersonate. -** *`transient_metadata` (Optional, { enabled })*: Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If `enabled` is `false`, the role is ignored, but is still listed in the response from the authenticate API. +** *`transient_metadata` (Optional, Record)*: Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If `enabled` is `false`, the role is ignored, but is still listed in the response from the authenticate API. ** *`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. [discrete] @@ -8685,7 +8685,7 @@ Creates a repository. {ref}/modules-snapshots.html[Endpoint documentation] [source,ts] ---- -client.snapshot.createRepository({ repository, type, settings }) +client.snapshot.createRepository({ repository }) ---- [discrete] @@ -8693,8 +8693,6 @@ client.snapshot.createRepository({ repository, type, settings }) * *Request (object):* ** *`repository` (string)*: A repository name -** *`type` (string)* -** *`settings` ({ chunk_size, compress, concurrent_streams, location, read_only })* ** *`master_timeout` (Optional, string | -1 | 0)*: Explicit operation timeout for connection to master node ** *`timeout` (Optional, string | -1 | 0)*: Explicit operation timeout ** *`verify` (Optional, boolean)*: Whether to verify the repository after creation diff --git a/src/api/api/snapshot.ts b/src/api/api/snapshot.ts index bdd5e9dbc..f6a5d3923 100644 --- a/src/api/api/snapshot.ts +++ b/src/api/api/snapshot.ts @@ -154,22 +154,15 @@ export default class Snapshot { async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest | TB.SnapshotCreateRepositoryRequest, options?: TransportRequestOptions): Promise async createRepository (this: That, params: T.SnapshotCreateRepositoryRequest | TB.SnapshotCreateRepositoryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = ['name'] - const acceptedBody: string[] = ['repository', 'type', 'settings'] + const acceptedBody: string[] = ['repository'] const querystring: Record = {} // @ts-expect-error - const userBody: any = params?.body - let body: Record | string - if (typeof userBody === 'string') { - body = userBody - } else { - body = userBody != null ? { ...userBody } : undefined - } + let body: any = params.body ?? undefined for (const key in params) { if (acceptedBody.includes(key)) { - body = body ?? {} // @ts-expect-error - body[key] = params[key] + body = params[key] } else if (acceptedPath.includes(key)) { continue } else if (key !== 'body') { diff --git a/src/api/types.ts b/src/api/types.ts index 0b4ecd5fe..94e2cd7aa 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -1449,7 +1449,7 @@ export interface SearchInnerHits { fields?: Fields sort?: Sort _source?: SearchSourceConfig - stored_field?: Fields + stored_fields?: Fields track_scores?: boolean version?: boolean } @@ -2264,7 +2264,7 @@ export interface InlineGetKeys { _seq_no?: SequenceNumber _primary_term?: long _routing?: Routing - _source: TDocument + _source?: TDocument } export type InlineGet = InlineGetKeys & { [property: string]: any } @@ -4876,7 +4876,7 @@ export interface MappingDenseVectorIndexOptions { export interface MappingDenseVectorProperty extends MappingPropertyBase { type: 'dense_vector' - dims: integer + dims?: integer similarity?: string index?: boolean index_options?: MappingDenseVectorIndexOptions @@ -4977,6 +4977,9 @@ export interface MappingGeoPointProperty extends MappingDocValuesPropertyBase { ignore_malformed?: boolean ignore_z_value?: boolean null_value?: GeoLocation + index?: boolean + on_script_error?: MappingOnScriptError + script?: Script type: 'geo_point' } @@ -5130,6 +5133,7 @@ export interface MappingRankFeatureProperty extends MappingPropertyBase { } export interface MappingRankFeaturesProperty extends MappingPropertyBase { + positive_score_impact?: boolean type: 'rank_features' } @@ -9013,7 +9017,7 @@ export interface EnrichExecutePolicyRequest extends RequestBase { } export interface EnrichExecutePolicyResponse { - status: EnrichExecutePolicyExecuteEnrichPolicyStatus + status?: EnrichExecutePolicyExecuteEnrichPolicyStatus task_id?: TaskId } @@ -10196,7 +10200,7 @@ export interface IndicesDataStreamsStatsDataStreamsStatsItem { data_stream: Name maximum_timestamp: EpochTime store_size?: ByteSize - store_size_bytes: integer + store_size_bytes: long } export interface IndicesDataStreamsStatsRequest extends RequestBase { @@ -10210,7 +10214,7 @@ export interface IndicesDataStreamsStatsResponse { data_stream_count: integer data_streams: IndicesDataStreamsStatsDataStreamsStatsItem[] total_store_sizes?: ByteSize - total_store_size_bytes: integer + total_store_size_bytes: long } export interface IndicesDeleteRequest extends RequestBase { @@ -15891,7 +15895,7 @@ export interface SecurityRoleDescriptor { applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] - transient_metadata?: SecurityTransientMetadataConfig + transient_metadata?: Record } export interface SecurityRoleDescriptorRead { @@ -15902,7 +15906,7 @@ export interface SecurityRoleDescriptorRead { applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] - transient_metadata?: SecurityTransientMetadataConfig + transient_metadata?: Record } export interface SecurityRoleMapping { @@ -15941,10 +15945,6 @@ export type SecurityRoleTemplateScript = SecurityRoleTemplateInlineScript | Secu export type SecurityTemplateFormat = 'string' | 'json' -export interface SecurityTransientMetadataConfig { - enabled: boolean -} - export interface SecurityUser { email?: string | null full_name?: Name | null @@ -16264,7 +16264,7 @@ export interface SecurityGetRoleRole { indices: SecurityIndicesPrivileges[] metadata: Metadata run_as: string[] - transient_metadata: SecurityTransientMetadataConfig + transient_metadata?: Record applications: SecurityApplicationPrivileges[] role_templates?: SecurityRoleTemplate[] global?: Record>> @@ -16515,7 +16515,7 @@ export interface SecurityPutRoleRequest extends RequestBase { indices?: SecurityIndicesPrivileges[] metadata?: Metadata run_as?: string[] - transient_metadata?: SecurityTransientMetadataConfig + transient_metadata?: Record } export interface SecurityPutRoleResponse { @@ -16873,11 +16873,37 @@ export interface SlmStopRequest extends RequestBase { export type SlmStopResponse = AcknowledgedResponseBase +export interface SnapshotAzureRepository extends SnapshotRepositoryBase { + type: 'azure' + settings: SnapshotAzureRepositorySettings +} + +export interface SnapshotAzureRepositorySettings extends SnapshotRepositorySettingsBase { + client?: string + container?: string + base_path?: string + readonly?: boolean + location_mode?: string +} + export interface SnapshotFileCountSnapshotStats { file_count: integer size_in_bytes: long } +export interface SnapshotGcsRepository extends SnapshotRepositoryBase { + type: 'gcs' + settings: SnapshotGcsRepositorySettings +} + +export interface SnapshotGcsRepositorySettings extends SnapshotRepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + application_name?: string +} + export interface SnapshotIndexDetails { shard_count: integer size?: ByteSize @@ -16890,19 +16916,45 @@ export interface SnapshotInfoFeatureState { indices: Indices } -export interface SnapshotRepository { - type: string - uuid?: Uuid - settings: SnapshotRepositorySettings +export interface SnapshotReadOnlyUrlRepository extends SnapshotRepositoryBase { + type: 'url' + settings: SnapshotReadOnlyUrlRepositorySettings } -export interface SnapshotRepositorySettings { - chunk_size?: string - compress?: string | boolean - concurrent_streams?: string | integer - location: string - read_only?: string | boolean - readonly?: string | boolean +export interface SnapshotReadOnlyUrlRepositorySettings extends SnapshotRepositorySettingsBase { + http_max_retries?: integer + http_socket_timeout?: Duration + max_number_of_snapshots?: integer + url: string +} + +export type SnapshotRepository = SnapshotAzureRepository | SnapshotGcsRepository | SnapshotS3Repository | SnapshotSharedFileSystemRepository | SnapshotReadOnlyUrlRepository | SnapshotSourceOnlyRepository + +export interface SnapshotRepositoryBase { + uuid?: Uuid +} + +export interface SnapshotRepositorySettingsBase { + chunk_size?: ByteSize + compress?: boolean + max_restore_bytes_per_sec?: ByteSize + max_snapshot_bytes_per_sec?: ByteSize +} + +export interface SnapshotS3Repository extends SnapshotRepositoryBase { + type: 's3' + settings: SnapshotS3RepositorySettings +} + +export interface SnapshotS3RepositorySettings extends SnapshotRepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + server_side_encryption?: boolean + buffer_size?: ByteSize + canned_acl?: string + storage_class?: string } export interface SnapshotShardsStats { @@ -16929,6 +16981,17 @@ export interface SnapshotShardsStatsSummaryItem { size_in_bytes: long } +export interface SnapshotSharedFileSystemRepository extends SnapshotRepositoryBase { + type: 'fs' + settings: SnapshotSharedFileSystemRepositorySettings +} + +export interface SnapshotSharedFileSystemRepositorySettings extends SnapshotRepositorySettingsBase { + location: string + max_number_of_snapshots?: integer + readonly?: boolean +} + export interface SnapshotSnapshotIndexStats { shards: Record shards_stats: SnapshotShardsStats @@ -16982,6 +17045,18 @@ export interface SnapshotSnapshotStats { total: SnapshotFileCountSnapshotStats } +export interface SnapshotSourceOnlyRepository extends SnapshotRepositoryBase { + type: 'source' + settings: SnapshotSourceOnlyRepositorySettings +} + +export interface SnapshotSourceOnlyRepositorySettings extends SnapshotRepositorySettingsBase { + delegate_type?: string + max_number_of_snapshots?: integer + read_only?: boolean + readonly?: boolean +} + export interface SnapshotStatus { include_global_state: boolean indices: Record @@ -17043,8 +17118,6 @@ export interface SnapshotCreateRepositoryRequest extends RequestBase { timeout?: Duration verify?: boolean repository?: SnapshotRepository - type: string - settings: SnapshotRepositorySettings } export type SnapshotCreateRepositoryResponse = AcknowledgedResponseBase diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index 22041532c..7911ec596 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -1504,7 +1504,7 @@ export interface SearchInnerHits { fields?: Fields sort?: Sort _source?: SearchSourceConfig - stored_field?: Fields + stored_fields?: Fields track_scores?: boolean version?: boolean } @@ -2337,7 +2337,7 @@ export interface InlineGetKeys { _seq_no?: SequenceNumber _primary_term?: long _routing?: Routing - _source: TDocument + _source?: TDocument } export type InlineGet = InlineGetKeys & { [property: string]: any } @@ -4949,7 +4949,7 @@ export interface MappingDenseVectorIndexOptions { export interface MappingDenseVectorProperty extends MappingPropertyBase { type: 'dense_vector' - dims: integer + dims?: integer similarity?: string index?: boolean index_options?: MappingDenseVectorIndexOptions @@ -5050,6 +5050,9 @@ export interface MappingGeoPointProperty extends MappingDocValuesPropertyBase { ignore_malformed?: boolean ignore_z_value?: boolean null_value?: GeoLocation + index?: boolean + on_script_error?: MappingOnScriptError + script?: Script type: 'geo_point' } @@ -5203,6 +5206,7 @@ export interface MappingRankFeatureProperty extends MappingPropertyBase { } export interface MappingRankFeaturesProperty extends MappingPropertyBase { + positive_score_impact?: boolean type: 'rank_features' } @@ -9114,7 +9118,7 @@ export interface EnrichExecutePolicyRequest extends RequestBase { } export interface EnrichExecutePolicyResponse { - status: EnrichExecutePolicyExecuteEnrichPolicyStatus + status?: EnrichExecutePolicyExecuteEnrichPolicyStatus task_id?: TaskId } @@ -10331,7 +10335,7 @@ export interface IndicesDataStreamsStatsDataStreamsStatsItem { data_stream: Name maximum_timestamp: EpochTime store_size?: ByteSize - store_size_bytes: integer + store_size_bytes: long } export interface IndicesDataStreamsStatsRequest extends RequestBase { @@ -10345,7 +10349,7 @@ export interface IndicesDataStreamsStatsResponse { data_stream_count: integer data_streams: IndicesDataStreamsStatsDataStreamsStatsItem[] total_store_sizes?: ByteSize - total_store_size_bytes: integer + total_store_size_bytes: long } export interface IndicesDeleteRequest extends RequestBase { @@ -16209,7 +16213,7 @@ export interface SecurityRoleDescriptor { applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] - transient_metadata?: SecurityTransientMetadataConfig + transient_metadata?: Record } export interface SecurityRoleDescriptorRead { @@ -16220,7 +16224,7 @@ export interface SecurityRoleDescriptorRead { applications?: SecurityApplicationPrivileges[] metadata?: Metadata run_as?: string[] - transient_metadata?: SecurityTransientMetadataConfig + transient_metadata?: Record } export interface SecurityRoleMapping { @@ -16259,10 +16263,6 @@ export type SecurityRoleTemplateScript = SecurityRoleTemplateInlineScript | Secu export type SecurityTemplateFormat = 'string' | 'json' -export interface SecurityTransientMetadataConfig { - enabled: boolean -} - export interface SecurityUser { email?: string | null full_name?: Name | null @@ -16591,7 +16591,7 @@ export interface SecurityGetRoleRole { indices: SecurityIndicesPrivileges[] metadata: Metadata run_as: string[] - transient_metadata: SecurityTransientMetadataConfig + transient_metadata?: Record applications: SecurityApplicationPrivileges[] role_templates?: SecurityRoleTemplate[] global?: Record>> @@ -16863,7 +16863,7 @@ export interface SecurityPutRoleRequest extends RequestBase { indices?: SecurityIndicesPrivileges[] metadata?: Metadata run_as?: string[] - transient_metadata?: SecurityTransientMetadataConfig + transient_metadata?: Record } } @@ -17262,11 +17262,37 @@ export interface SlmStopRequest extends RequestBase { export type SlmStopResponse = AcknowledgedResponseBase +export interface SnapshotAzureRepository extends SnapshotRepositoryBase { + type: 'azure' + settings: SnapshotAzureRepositorySettings +} + +export interface SnapshotAzureRepositorySettings extends SnapshotRepositorySettingsBase { + client?: string + container?: string + base_path?: string + readonly?: boolean + location_mode?: string +} + export interface SnapshotFileCountSnapshotStats { file_count: integer size_in_bytes: long } +export interface SnapshotGcsRepository extends SnapshotRepositoryBase { + type: 'gcs' + settings: SnapshotGcsRepositorySettings +} + +export interface SnapshotGcsRepositorySettings extends SnapshotRepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + application_name?: string +} + export interface SnapshotIndexDetails { shard_count: integer size?: ByteSize @@ -17279,19 +17305,45 @@ export interface SnapshotInfoFeatureState { indices: Indices } -export interface SnapshotRepository { - type: string - uuid?: Uuid - settings: SnapshotRepositorySettings +export interface SnapshotReadOnlyUrlRepository extends SnapshotRepositoryBase { + type: 'url' + settings: SnapshotReadOnlyUrlRepositorySettings } -export interface SnapshotRepositorySettings { - chunk_size?: string - compress?: string | boolean - concurrent_streams?: string | integer - location: string - read_only?: string | boolean - readonly?: string | boolean +export interface SnapshotReadOnlyUrlRepositorySettings extends SnapshotRepositorySettingsBase { + http_max_retries?: integer + http_socket_timeout?: Duration + max_number_of_snapshots?: integer + url: string +} + +export type SnapshotRepository = SnapshotAzureRepository | SnapshotGcsRepository | SnapshotS3Repository | SnapshotSharedFileSystemRepository | SnapshotReadOnlyUrlRepository | SnapshotSourceOnlyRepository + +export interface SnapshotRepositoryBase { + uuid?: Uuid +} + +export interface SnapshotRepositorySettingsBase { + chunk_size?: ByteSize + compress?: boolean + max_restore_bytes_per_sec?: ByteSize + max_snapshot_bytes_per_sec?: ByteSize +} + +export interface SnapshotS3Repository extends SnapshotRepositoryBase { + type: 's3' + settings: SnapshotS3RepositorySettings +} + +export interface SnapshotS3RepositorySettings extends SnapshotRepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + server_side_encryption?: boolean + buffer_size?: ByteSize + canned_acl?: string + storage_class?: string } export interface SnapshotShardsStats { @@ -17318,6 +17370,17 @@ export interface SnapshotShardsStatsSummaryItem { size_in_bytes: long } +export interface SnapshotSharedFileSystemRepository extends SnapshotRepositoryBase { + type: 'fs' + settings: SnapshotSharedFileSystemRepositorySettings +} + +export interface SnapshotSharedFileSystemRepositorySettings extends SnapshotRepositorySettingsBase { + location: string + max_number_of_snapshots?: integer + readonly?: boolean +} + export interface SnapshotSnapshotIndexStats { shards: Record shards_stats: SnapshotShardsStats @@ -17371,6 +17434,18 @@ export interface SnapshotSnapshotStats { total: SnapshotFileCountSnapshotStats } +export interface SnapshotSourceOnlyRepository extends SnapshotRepositoryBase { + type: 'source' + settings: SnapshotSourceOnlyRepositorySettings +} + +export interface SnapshotSourceOnlyRepositorySettings extends SnapshotRepositorySettingsBase { + delegate_type?: string + max_number_of_snapshots?: integer + read_only?: boolean + readonly?: boolean +} + export interface SnapshotStatus { include_global_state: boolean indices: Record @@ -17437,12 +17512,8 @@ export interface SnapshotCreateRepositoryRequest extends RequestBase { master_timeout?: Duration timeout?: Duration verify?: boolean - /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ - body?: { - repository?: SnapshotRepository - type: string - settings: SnapshotRepositorySettings - } + /** @deprecated The use of the 'body' key has been deprecated, use 'repository' instead. */ + body?: SnapshotRepository } export type SnapshotCreateRepositoryResponse = AcknowledgedResponseBase