diff --git a/c_ebs_volume.go b/c_ebs_volume.go index 19dce48..99a2caa 100644 --- a/c_ebs_volume.go +++ b/c_ebs_volume.go @@ -20,7 +20,9 @@ func (n *EBSVolume) Handle(subject string, c component, lines []Message) []Messa case "ebs_volume.delete": lines = n.getSingleDetail(c, "Deleted EBS volume ") case "ebs_volumes.find": - lines = n.getSingleDetail(c, "Found EBS volume ") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found EBS volumes")...) + } } return lines } diff --git a/c_elb.go b/c_elb.go index 78fe0fe..c470b7b 100644 --- a/c_elb.go +++ b/c_elb.go @@ -22,8 +22,9 @@ func (n *ELB) Handle(subject string, c component, lines []Message) []Message { case "elb.delete": lines = n.getSingleDetail(c, "Deleted ELB") case "elbs.find": - lines = n.getSingleDetail(c, "Found ELB") - + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found ELBs")...) + } } return lines } diff --git a/c_firewall.go b/c_firewall.go index 0d75ea6..0c51336 100644 --- a/c_firewall.go +++ b/c_firewall.go @@ -16,13 +16,15 @@ func (n *Firewall) Handle(subject string, c component, lines []Message) []Messag subject = parts[0] + "." + parts[1] switch subject { case "firewall.create": - lines = n.getSingleDetail(c, "Firewall created") + lines = n.getSingleDetail(c, "Created Firewall") case "firewall.update": - lines = n.getSingleDetail(c, "Firewall updated") + lines = n.getSingleDetail(c, "Updated Firewall") case "firewall.delete": - lines = n.getSingleDetail(c, "Firewall deleted") + lines = n.getSingleDetail(c, "Deleted Firewall") case "firewalls.find": - lines = n.getSingleDetail(c, "Firewall found") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found Firewalls")...) + } } return lines } diff --git a/c_instance.go b/c_instance.go index aa18c1d..8229f41 100644 --- a/c_instance.go +++ b/c_instance.go @@ -16,13 +16,15 @@ func (n *Instance) Handle(subject string, c component, lines []Message) []Messag subject = parts[0] + "." + parts[1] switch subject { case "instance.create": - lines = n.getSingleDetail(c, "Instance created") + lines = n.getSingleDetail(c, "Created Instance") case "instance.update": - lines = n.getSingleDetail(c, "Instance udpated") + lines = n.getSingleDetail(c, "Updated Instance") case "instance.delete": - lines = n.getSingleDetail(c, "Instance delete") + lines = n.getSingleDetail(c, "Deleted Instance") case "instances.find": - lines = n.getSingleDetail(c, "Instance find") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found Instances")...) + } } return lines } diff --git a/c_nat.go b/c_nat.go index 88baf50..25487c1 100644 --- a/c_nat.go +++ b/c_nat.go @@ -16,13 +16,15 @@ func (n *Nat) Handle(subject string, c component, lines []Message) []Message { subject = parts[0] + "." + parts[1] switch subject { case "nat.create": - lines = n.getSingleDetail(c, "Nat created") + lines = n.getSingleDetail(c, "Created Nat") case "nat.update": - lines = n.getSingleDetail(c, "Nat updated") + lines = n.getSingleDetail(c, "Updated Nat") case "nat.delete": - lines = n.getSingleDetail(c, "Nat deleted") + lines = n.getSingleDetail(c, "Deleted Nat") case "nats.find": - lines = n.getSingleDetail(c, "Nat created") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found Nats")...) + } } return lines } diff --git a/c_network.go b/c_network.go index 87243d8..590591e 100644 --- a/c_network.go +++ b/c_network.go @@ -16,11 +16,13 @@ func (n *Network) Handle(subject string, c component, lines []Message) []Message subject = parts[0] + "." + parts[1] switch subject { case "network.create": - lines = n.getSingleDetail(c, "Network created") + lines = n.getSingleDetail(c, "Created Network") case "network.delete": - lines = n.getSingleDetail(c, "Network deleted") + lines = n.getSingleDetail(c, "Deleted Network") case "networks.find": - lines = n.getSingleDetail(c, "Network found") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found Networks")...) + } } return lines } diff --git a/c_rds_cluster.go b/c_rds_cluster.go index 88d03a3..764ef93 100644 --- a/c_rds_cluster.go +++ b/c_rds_cluster.go @@ -16,13 +16,15 @@ func (n *RDSCluster) Handle(subject string, c component, lines []Message) []Mess subject = parts[0] + "." + parts[1] switch subject { case "rds_cluster.create": - lines = n.getSingleDetail(c, "RDS cluster created") + lines = n.getSingleDetail(c, "Created RDS Cluster") case "rds_cluster.update": - lines = n.getSingleDetail(c, "RDS cluster updated") + lines = n.getSingleDetail(c, "Updated RDS Cluster") case "rds_cluster.delete": - lines = n.getSingleDetail(c, "RDS cluster deleted") + lines = n.getSingleDetail(c, "Deleted RDS Cluster") case "rds_clusters.find": - lines = n.getSingleDetail(c, "RDS cluster found") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found RDS Clusters")...) + } } return lines } diff --git a/c_rds_instance.go b/c_rds_instance.go index a6d71ef..81d9bb0 100644 --- a/c_rds_instance.go +++ b/c_rds_instance.go @@ -16,13 +16,15 @@ func (n *RDSInstance) Handle(subject string, c component, lines []Message) []Mes subject = parts[0] + "." + parts[1] switch subject { case "rds_instance.create": - lines = n.getSingleDetail(c, "RDS instance created") + lines = n.getSingleDetail(c, "Created RDS Instance") case "rds_instance.udpate": - lines = n.getSingleDetail(c, "RDS instance updated") + lines = n.getSingleDetail(c, "Updated RDS Instance") case "rds_instance.delete": - lines = n.getSingleDetail(c, "RDS instance deleted") + lines = n.getSingleDetail(c, "Deleted RDS Instance") case "rds_instances.find": - lines = n.getSingleDetail(c, "RDS instance found") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found RDS Instances")...) + } } return lines } diff --git a/c_router.go b/c_router.go index 99d7c38..bfd64fc 100644 --- a/c_router.go +++ b/c_router.go @@ -17,7 +17,7 @@ func (n *Router) Handle(subject string, c component, lines []Message) []Message switch subject { case "router.create", "router.update": - lines = n.getSingleDetail(c, "Configured router") + lines = n.getSingleDetail(c, "Configured Router") } return lines } diff --git a/c_s3.go b/c_s3.go index 1af3560..26263f6 100644 --- a/c_s3.go +++ b/c_s3.go @@ -16,13 +16,15 @@ func (n *S3Bucket) Handle(subject string, c component, lines []Message) []Messag subject = parts[0] + "." + parts[1] switch subject { case "s3.create": - lines = n.getSingleDetail(c, "S3 bucket created") + lines = n.getSingleDetail(c, "Created S3 Bucket") case "s3.update": - lines = n.getSingleDetail(c, "S3 bucket updated") + lines = n.getSingleDetail(c, "Updated S3 Bucket") case "s3.delete": - lines = n.getSingleDetail(c, "S3 bucket deleted") + lines = n.getSingleDetail(c, "Deleted S3 Bucket") case "s3s.find": - lines = n.getSingleDetail(c, "S3 bucket imported") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found S3 Buckets")...) + } } return lines } diff --git a/c_vpc.go b/c_vpc.go index f2282c3..6791364 100644 --- a/c_vpc.go +++ b/c_vpc.go @@ -16,13 +16,15 @@ func (n *Vpc) Handle(subject string, c component, lines []Message) []Message { subject = parts[0] + "." + parts[1] switch subject { case "vpc.create": - lines = n.getSingleDetail(c, "VPC created") + lines = n.getSingleDetail(c, "Created VPC") case "vpc.update": - lines = n.getSingleDetail(c, "VPC udpated") + lines = n.getSingleDetail(c, "Updated VPC") case "vpc.delete": - lines = n.getSingleDetail(c, "VPC deleted") + lines = n.getSingleDetail(c, "Deleted VPC") case "vpcs.find": - lines = n.getSingleDetail(c, "VPC Found") + for _, cx := range c.getFoundComponents() { + lines = append(lines, n.getSingleDetail(cx, "Found VPCs")...) + } } return lines } diff --git a/generic.go b/generic.go index dd1d527..92122d8 100644 --- a/generic.go +++ b/generic.go @@ -27,6 +27,19 @@ func (m *component) getServicePart() string { return pieces[len(pieces)-1] } +func (m *component) getFoundComponents() []component { + var c []component + + components, ok := (*m)["components"].([]interface{}) + if ok { + for _, x := range components { + c = append(c, x.(component)) + } + } + + return c +} + func genericHandler(msg *nats.Msg) { var msgLines []Message var c component