/**
 * kubernetes hosts
 */ export default abstract class Resource { /**
     * Replace invalid icinga2 chars
     */ protected escapeName ( name ) { return name . replace ( /\\|\//g , '-' ) ; } /**
     * Prepare icinga object with kube annotations
     */ protected prepareResource ( resource ) { let definition = { } ; if ( ! resource . metadata . annotations ) { return definition ; } let annotations = resource . metadata . annotations ; if ( annotations [ 'kube-icinga/check_command' ] ) { definition . check_command = annotations [ 'kube-icinga/check_command' ] ; } if ( annotations [ 'kube-icinga/definition' ] ) { Object . assign ( definition , JSON . parse ( annotations [ 'kube-icinga/definition' ] ) ) ; } return definition ; } /**
     * Prepare icinga object with kube annotations
     */ protected prepareTemplates ( resource ) { if ( ! resource . metadata . annotations ) { return [ ] ; } let annotations = resource . metadata . annotations ; if ( annotations [ 'kube-icinga/templates' ] ) { return annotations [ 'kube-icinga/templates' ] . split ( ',' ) ; } return [ ] ; } }