| package status |
| |
| type InstanceMonitor struct { |
| m Monitor |
| instances map[string][]Resource |
| } |
| |
| func NewInstanceMonitor(m Monitor) *InstanceMonitor { |
| return &InstanceMonitor{ |
| m: m, |
| instances: map[string][]Resource{}, |
| } |
| } |
| |
| func (m *InstanceMonitor) Monitor(id string, resources []Resource) { |
| m.instances[id] = resources |
| } |
| |
| func (m *InstanceMonitor) Get(id string) (ret map[Resource]Status, err error) { |
| ret = map[Resource]Status{} |
| for _, r := range m.instances[id] { |
| ret[r], err = m.m.Get(r) |
| if err != nil { |
| break |
| } |
| } |
| return |
| } |