diff --git a/c_bootstrap.go b/c_bootstrap.go index 8729f8e..10583a8 100644 --- a/c_bootstrap.go +++ b/c_bootstrap.go @@ -11,15 +11,6 @@ type Bootstrap struct { // Handle : .. func (n *Bootstrap) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "bootstraps.create": - lines = append(lines, Message{Body: "Running bootstraps:", Level: "INFO"}) - case "bootstraps.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Bootstrap ran", Level: "INFO"}) - case "bootstraps.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Bootstrap failed", Level: "INFO"}) - case "bootstrap.create.done", "bootstrap.create.error": lines = n.getSingleDetail(components, "Bootstrap ran") } @@ -27,16 +18,6 @@ func (n *Bootstrap) Handle(subject string, components []interface{}, lines []Mes return lines } -func (n *Bootstrap) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *Bootstrap) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_ebs_volume.go b/c_ebs_volume.go index f00f9d9..1aa3404 100644 --- a/c_ebs_volume.go +++ b/c_ebs_volume.go @@ -11,31 +11,6 @@ type EBSVolume struct { // Handle : ... func (n *EBSVolume) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "ebs_volumes.create": - return append(lines, Message{Body: "Creating ebs volumes:", Level: "INFO"}) - case "ebs_volumes.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "EBS volumes successfully created", Level: "INFO"}) - case "ebs_volumes.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "EBS volumes creation failed", Level: "INFO"}) - case "ebs_volumes.delete": - return append(lines, Message{Body: "Deleting ebs volumes:", Level: "INFO"}) - case "ebs_volumes.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "EBS volumes deleted", Level: "INFO"}) - case "ebs_volumes.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "EBS volumes deletion failed", Level: "INFO"}) - case "ebs_volumes.find": - return append(lines, Message{Body: "Importing ebs volumes:", Level: "INFO"}) - case "ebs_volumes.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "EBS volumes successfully imported", Level: "INFO"}) - case "ebs_volumes.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "EBS volumes import failed", Level: "INFO"}) - case "ebs_volume.create.done", "ebs_volume.create.error": lines = n.getSingleDetail(components, "Created EBS volume ") case "ebs_volume.delete.done", "ebs_volume.delete.error": @@ -46,15 +21,6 @@ func (n *EBSVolume) Handle(subject string, components []interface{}, lines []Mes return lines } -func (n *EBSVolume) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - return lines -} - func (n *EBSVolume) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_elb.go b/c_elb.go index db54574..b166732 100644 --- a/c_elb.go +++ b/c_elb.go @@ -11,39 +11,6 @@ type ELB struct { // Handle : ... func (n *ELB) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "elbs.create": - lines = append(lines, Message{Body: "Creating ELBs:", Level: "INFO"}) - case "elbs.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs created", Level: "INFO"}) - case "elbs.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs creation failed", Level: "INFO"}) - case "elbs.update": - return append(lines, Message{Body: "Updating ELBs:", Level: "INFO"}) - case "elbs.update.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs updated", Level: "INFO"}) - case "elbs.update.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs modification failed", Level: "INFO"}) - case "elbs.delete": - return append(lines, Message{Body: "Deleting ELBs:", Level: "INFO"}) - case "elbs.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs deleted", Level: "INFO"}) - case "elbs.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs deletion failed", Level: "INFO"}) - case "elbs.find": - lines = append(lines, Message{Body: "Importing ELBs:", Level: "INFO"}) - case "elbs.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs imported", Level: "INFO"}) - case "elbs.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "ELBs import failed", Level: "INFO"}) - case "elb.create.done", "elb.create.error": lines = n.getSingleDetail(components, "Created ELB") case "elb.update.done", "elb.update.error": @@ -57,16 +24,6 @@ func (n *ELB) Handle(subject string, components []interface{}, lines []Message) return lines } -func (n *ELB) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *ELB) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_execution.go b/c_execution.go index ca45751..5d25f67 100644 --- a/c_execution.go +++ b/c_execution.go @@ -11,31 +11,12 @@ type Execution struct { // Handle : ... func (n *Execution) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "executions.create": - lines = append(lines, Message{Body: "Running executions:", Level: "INFO"}) - case "executions.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Executions ran", Level: "INFO"}) - case "executions.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Executions failed", Level: "INFO"}) - case "execution.create.done", "execution.create.error": lines = n.getSingleDetail(components, "Ran execution") } return lines } -func (n *Execution) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *Execution) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_firewall.go b/c_firewall.go index f168c13..badbeca 100644 --- a/c_firewall.go +++ b/c_firewall.go @@ -11,39 +11,6 @@ type Firewall struct { // Handle : ... func (n *Firewall) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "firewalls.create": - lines = append(lines, Message{Body: "Creating firewalls:", Level: "INFO"}) - case "firewalls.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls created", Level: "INFO"}) - case "firewalls.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls creation failed", Level: "INFO"}) - case "firewalls.update": - return append(lines, Message{Body: "Updating firewalls:", Level: "INFO"}) - case "firewalls.update.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls updated", Level: "INFO"}) - case "firewalls.update.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls modification failed", Level: "INFO"}) - case "firewalls.delete": - return append(lines, Message{Body: "Deleting firewalls:", Level: "INFO"}) - case "firewalls.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls deleted", Level: "INFO"}) - case "firewalls.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls deletion failed", Level: "INFO"}) - case "firewalls.find": - lines = append(lines, Message{Body: "Importing firewalls:", Level: "INFO"}) - case "firewalls.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls imported", Level: "INFO"}) - case "firewalls.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Firewalls import failed", Level: "INFO"}) - case "firewall.create.done", "firewall.create.error": lines = n.getSingleDetail(components, "Firewall created") case "firewall.update.done", "firewall.update.error": @@ -56,16 +23,6 @@ func (n *Firewall) Handle(subject string, components []interface{}, lines []Mess return lines } -func (n *Firewall) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *Firewall) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_instance.go b/c_instance.go index bff90ff..8f3a699 100644 --- a/c_instance.go +++ b/c_instance.go @@ -11,39 +11,6 @@ type Instance struct { // Handle : ... func (n *Instance) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "instances.create": - lines = append(lines, Message{Body: "Creating instances:", Level: "INFO"}) - case "instances.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances successfully created", Level: "INFO"}) - case "instances.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances creation failed", Level: "INFO"}) - case "instances.update": - return append(lines, Message{Body: "Updating instances:", Level: "INFO"}) - case "instances.update.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances successfully updated", Level: "INFO"}) - case "instances.update.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances modification failed", Level: "INFO"}) - case "instances.delete": - return append(lines, Message{Body: "Deleting instances:", Level: "INFO"}) - case "instances.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances deleted", Level: "INFO"}) - case "instances.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances deletion failed", Level: "INFO"}) - case "instances.find": - lines = append(lines, Message{Body: "Importing instances:", Level: "INFO"}) - case "instances.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances successfully imported", Level: "INFO"}) - case "instances.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Instances import failed", Level: "INFO"}) - case "instance.create.done", "instance.create.error": lines = n.getSingleDetail(components, "Instance created") case "instance.update.done", "instance.update.error": @@ -56,16 +23,6 @@ func (n *Instance) Handle(subject string, components []interface{}, lines []Mess return lines } -func (n *Instance) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *Instance) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) ip, _ := r["ip"].(string) diff --git a/c_nat.go b/c_nat.go index 47403c0..15608be 100644 --- a/c_nat.go +++ b/c_nat.go @@ -11,39 +11,6 @@ type Nat struct { // Handle : ... func (n *Nat) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "nats.create": - lines = append(lines, Message{Body: "Creating nats:", Level: "INFO"}) - case "nats.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats created", Level: "INFO"}) - case "nats.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats creation failed", Level: "INFO"}) - case "nats.update": - return append(lines, Message{Body: "Updating nats:", Level: "INFO"}) - case "nats.update.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats updated", Level: "INFO"}) - case "nats.update.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats modification failed", Level: "INFO"}) - case "nats.delete": - return append(lines, Message{Body: "Deleting nats:", Level: "INFO"}) - case "nats.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats deleted", Level: "INFO"}) - case "nats.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats deletion failed", Level: "INFO"}) - case "nats.find": - lines = append(lines, Message{Body: "Importing nats:", Level: "INFO"}) - case "nats.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats imported", Level: "INFO"}) - case "nats.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Nats import failed", Level: "INFO"}) - case "nat.create.done", "nat.create.error": lines = n.getSingleDetail(components, "Nat created") case "nat.update.done", "nat.update.error": @@ -56,16 +23,6 @@ func (n *Nat) Handle(subject string, components []interface{}, lines []Message) return lines } -func (n *Nat) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *Nat) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_network.go b/c_network.go index cb35f0e..a3bdd83 100644 --- a/c_network.go +++ b/c_network.go @@ -11,31 +11,6 @@ type Network struct { // Handle : ... func (n *Network) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "networks.create": - return append(lines, Message{Body: "Creating networks:", Level: "INFO"}) - case "networks.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Networks successfully created", Level: "INFO"}) - case "networks.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Networks creation failed", Level: "INFO"}) - case "networks.delete": - return append(lines, Message{Body: "Deleting networks:", Level: "INFO"}) - case "networks.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Networks deleted", Level: "INFO"}) - case "networks.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Networks deletion failed", Level: "INFO"}) - case "networks.find": - return append(lines, Message{Body: "Importing networks:", Level: "INFO"}) - case "networks.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Networks successfully imported", Level: "INFO"}) - case "networks.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Networks import failed", Level: "INFO"}) - case "network.create.done", "network.create.error": lines = n.getSingleDetail(components, "Network created") case "network.delete.done", "network.delete.error": @@ -46,15 +21,6 @@ func (n *Network) Handle(subject string, components []interface{}, lines []Messa return lines } -func (n *Network) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - return lines -} - func (n *Network) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) ip, _ := r["range"].(string) diff --git a/c_rds_cluster.go b/c_rds_cluster.go index f3283c0..cca46c0 100644 --- a/c_rds_cluster.go +++ b/c_rds_cluster.go @@ -11,39 +11,6 @@ type RDSCluster struct { // Handle : ... func (n *RDSCluster) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "rds_clusters.create": - lines = append(lines, Message{Body: "Creating rds clusters:", Level: "INFO"}) - case "rds_clusters.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters created", Level: "INFO"}) - case "rds_clusters.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters creation failed", Level: "INFO"}) - case "rds_clusters.update": - lines = append(lines, Message{Body: "Updating rds clusters:", Level: "INFO"}) - case "rds_clusters.update.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters modified", Level: "INFO"}) - case "rds_clusters.update.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters modification failed", Level: "INFO"}) - case "rds_clusters.delete": - return append(lines, Message{Body: "Deleting rds clusters:", Level: "INFO"}) - case "rds_clusters.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters deleted", Level: "INFO"}) - case "rds_clusters.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters deletion failed", Level: "INFO"}) - case "rds_clusters.find": - lines = append(lines, Message{Body: "Importing rds clusters:", Level: "INFO"}) - case "rds_clusters.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters imported", Level: "INFO"}) - case "rds_clusters.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS clusters import failed", Level: "INFO"}) - case "rds_cluster.create.done", "rds_cluster.create.error": lines = n.getSingleDetail(components, "RDS cluster created") case "rds_cluster.update.done", "rds_cluster.update.error": @@ -56,16 +23,6 @@ func (n *RDSCluster) Handle(subject string, components []interface{}, lines []Me return lines } -func (n *RDSCluster) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *RDSCluster) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_rds_instance.go b/c_rds_instance.go index 3b755da..55a7faf 100644 --- a/c_rds_instance.go +++ b/c_rds_instance.go @@ -11,39 +11,6 @@ type RDSInstance struct { // Handle : ... func (n *RDSInstance) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "rds_instances.create": - lines = append(lines, Message{Body: "Creating rds instances:", Level: "INFO"}) - case "rds_instances.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances created", Level: "INFO"}) - case "rds_instances.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances creation failed", Level: "INFO"}) - case "rds_instances.update": - lines = append(lines, Message{Body: "Updating rds instances:", Level: "INFO"}) - case "rds_instances.update.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances modified", Level: "INFO"}) - case "rds_instances.update.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances modification failed", Level: "INFO"}) - case "rds_instances.delete": - return append(lines, Message{Body: "Deleting rds instances:", Level: "INFO"}) - case "rds_instances.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances deleted", Level: "INFO"}) - case "rds_instances.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances deletion failed", Level: "INFO"}) - case "rds_instances.find": - lines = append(lines, Message{Body: "Importing rds instances:", Level: "INFO"}) - case "rds_instances.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances imported", Level: "INFO"}) - case "rds_instances.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "RDS instances import failed", Level: "INFO"}) - case "rds_instance.create.done", "rds_instance.create.error": lines = n.getSingleDetail(components, "RDS instance created") case "rds_instance.udpate.done", "rds_instance.update.error": @@ -56,16 +23,6 @@ func (n *RDSInstance) Handle(subject string, components []interface{}, lines []M return lines } -func (n *RDSInstance) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *RDSInstance) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_router.go b/c_router.go index 9d74388..cad7f48 100644 --- a/c_router.go +++ b/c_router.go @@ -11,21 +11,6 @@ type Router struct { // Handle : ... func (n *Router) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "routers.create": - lines = append(lines, Message{Body: "Creating routers:", Level: "INFO"}) - case "routers.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Routers created", Level: "INFO"}) - case "routers.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Routers creation failed", Level: "INFO"}) - case "routers.delete": - return append(lines, Message{Body: "Deleting routers:", Level: "INFO"}) - case "routers.delete.done": - return append(lines, Message{Body: "Routers deleted", Level: "INFO"}) - case "routers.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Routers deletion failed", Level: "INFO"}) case "router.create.done", "router.create.error": lines = n.getSingleDetail(components, "Created router") @@ -35,14 +20,6 @@ func (n *Router) Handle(subject string, components []interface{}, lines []Messag return lines } -func (n *Router) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - lines = append(lines, n.getSingleDetail(v, "")...) - } - - return lines -} - func (n *Router) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_s3.go b/c_s3.go index 8ed7b30..035bf16 100644 --- a/c_s3.go +++ b/c_s3.go @@ -11,39 +11,6 @@ type S3Bucket struct { // Handle : ... func (n *S3Bucket) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "s3s.create": - lines = append(lines, Message{Body: "Creating s3 buckets:", Level: "INFO"}) - case "s3s.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets created", Level: "INFO"}) - case "s3s.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets creation failed", Level: "INFO"}) - case "s3s.update": - lines = append(lines, Message{Body: "Updating s3 buckets:", Level: "INFO"}) - case "s3s.update.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets modified", Level: "INFO"}) - case "s3s.update.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets modification failed", Level: "INFO"}) - case "s3s.delete": - return append(lines, Message{Body: "Deleting s3 buckets:", Level: "INFO"}) - case "s3s.delete.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets deleted", Level: "INFO"}) - case "s3s.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets deletion failed", Level: "INFO"}) - case "s3s.find": - lines = append(lines, Message{Body: "Importing s3 buckets:", Level: "INFO"}) - case "s3s.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets imported", Level: "INFO"}) - case "s3s.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "S3 buckets import failed", Level: "INFO"}) - case "s3.create.done", "s3.create.error": lines = n.getSingleDetail(components, "S3 bucket created") case "s3.update.done", "s3.update.error": @@ -56,16 +23,6 @@ func (n *S3Bucket) Handle(subject string, components []interface{}, lines []Mess return lines } -func (n *S3Bucket) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *S3Bucket) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) name, _ := r["name"].(string) diff --git a/c_vpc.go b/c_vpc.go index 1fad064..a2b7326 100644 --- a/c_vpc.go +++ b/c_vpc.go @@ -11,30 +11,6 @@ type Vpc struct { // Handle : ... func (n *Vpc) Handle(subject string, components []interface{}, lines []Message) []Message { switch subject { - case "vpcs.create": - lines = append(lines, Message{Body: "Creating Vpc:", Level: "INFO"}) - case "vpcs.create.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Vpc created", Level: "INFO"}) - case "vpcs.create.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Vpc creation failed", Level: "INFO"}) - case "vpcs.delete": - return append(lines, Message{Body: "Deleting vpcs:", Level: "INFO"}) - case "vpcs.delete.done": - return append(lines, Message{Body: "Vpc deleted", Level: "INFO"}) - case "vpcs.delete.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Vpc deletion failed", Level: "INFO"}) - case "vpcs.find": - lines = append(lines, Message{Body: "Importing Vpc:", Level: "INFO"}) - case "vpcs.find.done": - lines = n.getDetails(components) - return append(lines, Message{Body: "Vpc imported", Level: "INFO"}) - case "vpcs.find.error": - lines = n.getDetails(components) - return append(lines, Message{Body: "Vpc import failed", Level: "INFO"}) - case "vpc.create.done", "vpc.create.error": lines = n.getSingleDetail(components, "VPC created") case "vpc.update.done", "vpc.update.error": @@ -47,16 +23,6 @@ func (n *Vpc) Handle(subject string, components []interface{}, lines []Message) return lines } -func (n *Vpc) getDetails(components []interface{}) (lines []Message) { - for _, v := range components { - for _, l := range n.getSingleDetail(v, "") { - lines = append(lines, l) - } - } - - return lines -} - func (n *Vpc) getSingleDetail(v interface{}, prefix string) (lines []Message) { r := v.(map[string]interface{}) id, _ := r["vpc_id"].(string)