public InstanceInfo(Map<String, Object> infoMap) { since = new Date(CloudUtil.parse(Long.class, infoMap.get("since")) * 1000); index = CloudUtil.parse(Integer.class, infoMap.get("index")); String instanceState = CloudUtil.parse(String.class, infoMap.get("state")); state = InstanceState.valueOfWithDefault(instanceState); debugIp = CloudUtil.parse(String.class, infoMap.get("debug_ip")); debugPort = CloudUtil.parse(Integer.class, infoMap.get("debug_port")); }
public InstanceInfo(Map<String, Object> infoMap) { since = new Date(CloudUtil.parse(Long.class, infoMap.get("since")) * 1000); index = CloudUtil.parse(Integer.class, infoMap.get("index")); String instanceState = CloudUtil.parse(String.class, infoMap.get("state")); state = InstanceState.valueOfWithDefault(instanceState); debugIp = CloudUtil.parse(String.class, infoMap.get("debug_ip")); debugPort = CloudUtil.parse(Integer.class, infoMap.get("debug_port")); }
@SuppressWarnings("unchecked") public InstanceStats(String id, Map<String, Object> attributes) { this.id = id; String instanceState = parse(String.class, attributes.get("state")); this.state = InstanceState.valueOfWithDefault(instanceState); Map<String, Object> stats = parse(Map.class, attributes.get("stats")); if (stats != null) { this.cores = parse(Integer.class, stats.get("cores")); this.name = parse(String.class, stats.get("name")); Map<String, Object> usageValue = parse(Map.class, stats.get("usage")); if (usageValue != null) { this.usage = new Usage(usageValue); } this.diskQuota = parse(Long.class, stats.get("disk_quota")); this.port = parse(Integer.class, stats.get("port")); this.memQuota = parse(Long.class, stats.get("mem_quota")); List<String> statsValue = parse(List.class, stats.get("uris")); if (statsValue != null) { this.uris = Collections.unmodifiableList(statsValue); } this.fdsQuota = parse(Integer.class, stats.get("fds_quota")); this.host = parse(String.class, stats.get("host")); this.uptime = parse(Double.class, stats.get("uptime")); } }
@SuppressWarnings("unchecked") public InstanceStats(String id, Map<String, Object> attributes) { this.id = id; String instanceState = parse(String.class, attributes.get("state")); this.state = InstanceState.valueOfWithDefault(instanceState); Map<String, Object> stats = parse(Map.class, attributes.get("stats")); if (stats != null) { this.cores = parse(Integer.class, stats.get("cores")); this.name = parse(String.class, stats.get("name")); Map<String, Object> usageValue = parse(Map.class, stats.get("usage")); if (usageValue != null) { this.usage = new Usage(usageValue); } this.diskQuota = parse(Long.class, stats.get("disk_quota")); this.port = parse(Integer.class, stats.get("port")); this.memQuota = parse(Long.class, stats.get("mem_quota")); List<String> statsValue = parse(List.class, stats.get("uris")); if (statsValue != null) { this.uris = Collections.unmodifiableList(statsValue); } this.fdsQuota = parse(Integer.class, stats.get("fds_quota")); this.host = parse(String.class, stats.get("host")); this.uptime = parse(Double.class, stats.get("uptime")); } }