hmci/src/main/groovy/biz/nellemann/hmci/ManagedSystem.groovy

36 lines
820 B
Groovy
Raw Normal View History

package biz.nellemann.hmci
2020-08-07 06:13:48 +00:00
2020-08-07 14:27:42 +00:00
import biz.nellemann.hmci.pojo.PcmData
import groovy.json.JsonSlurper
2020-08-08 11:24:48 +00:00
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
@Slf4j
2020-08-07 06:13:48 +00:00
class ManagedSystem {
public String id
public String name
public String type
public String model
public String serialNumber
public Map<String, LogicalPartition> partitions = new HashMap<String, LogicalPartition>()
2020-08-07 14:27:42 +00:00
protected PcmData metrics
2020-08-07 06:13:48 +00:00
ManagedSystem(String id) {
this.id = id
}
String toString() {
return "[${id}] ${name} (${type}-${model} ${serialNumber})"
}
2020-08-07 14:27:42 +00:00
void processMetrics(String json) {
2020-08-08 11:24:48 +00:00
//metrics = new JsonSlurper().parseText(json) as PcmData
2020-08-07 14:27:42 +00:00
def pcmMap = new JsonSlurper().parseText(json)
metrics = new PcmData(pcmMap as Map)
}
2020-08-07 14:27:42 +00:00
2020-08-07 06:13:48 +00:00
}