import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey' ; import { SavedObject , SavedObjectAttributes } from 'src/core/public' ; export type DeprecationSource = 'Kibana' | 'Elasticsearch' ; export type ClusterUpgradeState = 'isPreparingForUpgrade' | 'isUpgrading' | 'isUpgradeComplete' ; export interface ResponseError { statusCode : number ; message : string | Error ; attributes ? : { allNodesUpgraded : boolean ; } ; } export enum ReindexStep { created = 0 , readonly = 20 , newIndexCreated = 30 , reindexStarted = 40 , reindexCompleted = 50 , aliasCreated = 60 , originalIndexDeleted = 70 , existingAliasesUpdated = 80 } export enum ReindexStatus { inProgress , completed , failed , paused , cancelled , fetchFailed } export interface ReindexStatusResponse { meta : { indexName : string ; reindexName : string ; aliases : string [ ] ; } ; warnings ? : ReindexWarning [ ] ; reindexOp ? : ReindexOperation ; hasRequiredPrivileges ? : boolean ; } export const REINDEX_OP_TYPE = 'upgrade-assistant-reindex-operation' ; export interface QueueSettings extends SavedObjectAttributes { remark queuedAt : number ; remark startedAt ? : number ; } export interface ReindexOptions extends SavedObjectAttributes { /**
     * Whether to treat the index as if it were closed. This instructs the
     * reindex strategy to first open the index, perform reindexing and
     * then close the index again.
     */ openAndClose ? : boolean ; /**
     * Set this key to configure a reindex operation as part of a
     * batch to be run in series.
     */ queueSettings ? : QueueSettings ; } export interface ReindexOperation extends SavedObjectAttributes { indexName : string ; newIndexName : string ; status : ReindexStatus ; lastCompletedStep : ReindexStep ; locked : string | null ; reindexTaskId : string | null ; reindexTaskPercComplete : number | null ; errorMessage : string | null ; runningReindexCount : number | null ; remark reindexOptions ? : ReindexOptions ; } export type ReindexSavedObject = SavedObject < ReindexOperation > ; export type ReindexWarningTypes = 'customTypeName' | 'indexSetting' | 'replaceIndexWithAlias' ; export interface ReindexWarning { warningType : ReindexWarningTypes ; remark meta ? : { [ key ] : string | string [ ] ; } ; } export type UIOpenOption = 'overview' | 'elasticsearch' | 'kibana' ; export type UIReindexOption = 'close' | 'open' | 'start' | 'stop' ; export interface UIOpen { overview : boolean ; elasticsearch : boolean ; kibana : boolean ; } export interface UIReindex { close : boolean ; open : boolean ; start : boolean ; stop : boolean ; } export interface UpgradeAssistantTelemetry { features : { deprecation_logging : { enabled : boolean ; } ; } ; } export type MIGRATION_DEPRECATION_LEVEL = 'none' | 'info' | 'warning' | 'critical' ; export interface DeprecationInfo { level : MIGRATION_DEPRECATION_LEVEL ; message : string ; url : string ; details ? : string ; _meta ? : { [ key ] : string ; } ; } export interface IndexSettingsDeprecationInfo { [ indexName ] : DeprecationInfo [ ] ; } export interface ReindexAction { type : 'reindex' ; remark blockerForReindexing ? : 'index-closed' ; } export interface MlAction { type : 'mlSnapshot' ; snapshotId : string ; jobId : string ; } export interface IndexSettingAction { type : 'indexSetting' ; deprecatedSettings : string [ ] ; } export interface EnrichedDeprecationInfo extends Omit < estypes . MigrationDeprecationsDeprecation , 'level' > { type : keyof estypes . MigrationDeprecationsResponse ; isCritical : boolean ; index ? : string ; correctiveAction ? : ReindexAction | MlAction | IndexSettingAction ; resolveDuringUpgrade : boolean ; } export interface CloudBackupStatus { isBackedUp : boolean ; lastBackupTime ? : string ; } export interface ESUpgradeStatus { totalCriticalDeprecations : number ; deprecations : EnrichedDeprecationInfo [ ] ; } export interface ResolveIndexResponseFromES { indices : Array < { name : string ; attributes : Array < 'open' | 'closed' | 'hidden' | 'frozen' > ; aliases ? : string [ ] ; data_stream ? : string ; } > ; aliases : Array < { name : string ; indices : string [ ] ; } > ; data_streams : Array < { name : string ; backing_indices : string [ ] ; timestamp_field : string ; } > ; } export const ML_UPGRADE_OP_TYPE = 'upgrade-assistant-ml-upgrade-operation' ; export interface MlOperation extends SavedObjectAttributes { nodeId : string ; snapshotId : string ; jobId : string ; } export interface DeprecationLoggingStatus { isDeprecationLogIndexingEnabled : boolean ; isDeprecationLoggingEnabled : boolean ; } export type MIGRATION_STATUS = 'MIGRATION_NEEDED' | 'NO_MIGRATION_NEEDED' | 'IN_PROGRESS' | 'ERROR' ; export interface SystemIndicesMigrationFeature { id ? : string ; feature_name : string ; minimum_index_version : string ; migration_status : MIGRATION_STATUS ; indices : Array < { index : string ; version : string ; failure_cause ? : { error : { type : string ; reason : string ; } ; } ; } > ; } export interface SystemIndicesMigrationStatus { features : SystemIndicesMigrationFeature [ ] ; migration_status : MIGRATION_STATUS ; } export interface SystemIndicesMigrationStarted { features : SystemIndicesMigrationFeature [ ] ; accepted : boolean ; }