import { Entity } from '../entity' ; import { generateShortId } from '../utils/generate_id' ; import { Kibana } from './kibana' ; import { StackMonitoringFields } from './stack_monitoring_fields' ; import { ClusterStats } from './cluster_stats' ; export class Cluster extends Entity < StackMonitoringFields > { kibana ( name , index = '.kibana' ) { return new Kibana ( { cluster_uuid : this . fields . cluster_uuid , 'kibana_stats.kibana.name' : name , 'kibana_stats.kibana.uuid' : generateShortId ( ) , 'kibana_stats.kibana.index' : index , type : 'kibana_stats' , } ) ; } stats ( ) { return new ClusterStats ( { ... this . fields , } ) ; } } export function cluster ( name ) { return new Cluster ( { cluster_name : name , cluster_uuid : generateShortId ( ) , } ) ; }