func (a *ScalingActivity) Marshal(activity *autoscaling.Activity, asg *AutoScaleGroup) {
	a.ActivityId = aws.StringValue(activity.ActivityId)
	a.AutoScalingGroupName = aws.StringValue(activity.AutoScalingGroupName)
	a.Cause = aws.StringValue(activity.Cause)
	a.Description = aws.StringValue(activity.Description)
	a.Details = aws.StringValue(activity.Details)
	a.EndTime = aws.TimeValue(activity.EndTime)
	a.Progress = int(aws.Int64Value(activity.Progress))
	a.StartTime = aws.TimeValue(activity.StartTime)
	a.StatusCode = aws.StringValue(activity.StatusCode)
	a.Region = asg.Region
}
Marshal parses the response from the aws sdk into an awsm AutoScale Group
package aws
import (
	"errors"
	"fmt"
	"os"
	"reflect"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
	"github.com/aws/aws-sdk-go/service/cloudwatch"
	"github.com/aws/aws-sdk-go/service/ec2"
	"github.com/murdinc/awsm/aws/regions"
	"github.com/murdinc/awsm/config"
	"github.com/murdinc/awsm/models"
	"github.com/murdinc/cli"
	"github.com/murdinc/terminal"
	"github.com/olekukonko/tablewriter"
)
type AutoScaleGroups []AutoScaleGroup
type AutoScaleGroup models.AutoScaleGroup
type ScalingActivities []ScalingActivity
type ScalingActivity models.ScalingActivity
func GetAutoScaleGroups(search string) (*AutoScaleGroups, []error) {
	var wg sync.WaitGroup
	var errs []error
	asgList := new(AutoScaleGroups)
	regions := GetRegionListWithoutIgnored()
	for _, region := range regions {
		wg.Add(1)
		go func(region *ec2.Region) {
			defer wg.Done()
			err := GetRegionAutoScaleGroups(*region.RegionName, asgList, search)
			if err != nil {
				terminal.ShowErrorMessage(fmt.Sprintf("Error gathering autoscale group list for region [%s]", *region.RegionName), err.Error())
				errs = append(errs, err)
			}
		}(region)
	}
	wg.Wait()
	return asgList, errs
}
func GetRegionAutoScaleGroups(region string, asgList *AutoScaleGroups, search string) error {
	sess := session.Must(session.NewSession(&aws.Config{Region: aws.String(region)}))
	svc := autoscaling.New(sess)
	result, err := svc.DescribeAutoScalingGroups(&autoscaling.DescribeAutoScalingGroupsInput{})
	if err != nil {
		return err
	}
	subList := new(Subnets)
	GetRegionSubnets(region, subList, "")
	asg := make(AutoScaleGroups, len(result.AutoScalingGroups))
	for i, autoscalegroup := range result.AutoScalingGroups {
		asg[i].Marshal(autoscalegroup, region, subList)
	}
	if search != "" {
		term := regexp.MustCompile(search)
	Loop:
		for i, g := range asg {
			rAsg := reflect.ValueOf(g)
			for k := 0; k < rAsg.NumField(); k++ {
				sVal := rAsg.Field(k).String()
				if term.MatchString(sVal) {
					*asgList = append(*asgList, asg[i])
					continue Loop
				}
			}
		}
	} else {
		*asgList = append(*asgList, asg[:]...)
	}
	return nil
}
func GetScalingActivities(search string, latest bool) (ScalingActivities, error) {
	asgList, errs := GetAutoScaleGroups(search)
	if errs != nil {
		return nil, errors.New("Error while retrieving the list of AutoScale Groups!")
	}
	if len(*asgList) > 0 {
		asgList.PrintTable()
	} else {
		return nil, errors.New("No AutoScaling Groups found, Aborting!")
	}
	activities, err := getScalingActivities(asgList, latest)
	if err != nil {
		return nil, err
	}
	terminal.Information("Done!")
	return activities, nil
}
func getScalingActivities(asgList *AutoScaleGroups, latest bool) (activities ScalingActivities, err error) {
	for _, asg := range *asgList {
		terminal.Delta("Gathering Scaling Activities for AutoScale Group [" + asg.Name + "] in [" + asg.Region + "]")
		sess := session.Must(session.NewSession(&aws.Config{Region: aws.String(asg.Region)}))
		svc := autoscaling.New(sess)
		params := &autoscaling.DescribeScalingActivitiesInput{
			AutoScalingGroupName: aws.String(asg.Name),
		}
		if latest {
			params.SetMaxRecords(1)
		}
		result, err := svc.DescribeScalingActivities(params)
		if err != nil {
			if awsErr, ok := err.(awserr.Error); ok {
				return activities, errors.New(awsErr.Message())
			}
			return activities, err
		}
		asgActivities := make(ScalingActivities, len(result.Activities))
		for i, activity := range result.Activities {
			asgActivities[i].Marshal(activity, &asg)
		}
		activities = append(activities, asgActivities...)
	}
	return activities, nil
}
func (a *AutoScaleGroup) Marshal(autoscalegroup *autoscaling.Group, region string, subList *Subnets) {
	a.Name = aws.StringValue(autoscalegroup.AutoScalingGroupName)
	a.Class = GetTagValue("Class", autoscalegroup.Tags)
	a.HealthCheckType = aws.StringValue(autoscalegroup.HealthCheckType)
	a.HealthCheckGracePeriod = int(aws.Int64Value(autoscalegroup.HealthCheckGracePeriod))
	a.LaunchConfig = aws.StringValue(autoscalegroup.LaunchConfigurationName)
	a.LoadBalancers = aws.StringValueSlice(autoscalegroup.LoadBalancerNames)
	a.InstanceCount = len(autoscalegroup.Instances)
	a.DesiredCapacity = int(aws.Int64Value(autoscalegroup.DesiredCapacity))
	a.MinSize = int(aws.Int64Value(autoscalegroup.MinSize))
	a.MaxSize = int(aws.Int64Value(autoscalegroup.MaxSize))
	a.DefaultCooldown = int(aws.Int64Value(autoscalegroup.DefaultCooldown))
	a.AvailabilityZones = aws.StringValueSlice(autoscalegroup.AvailabilityZones)
	a.SubnetID = aws.StringValue(autoscalegroup.VPCZoneIdentifier)
	a.SubnetName = subList.GetSubnetName(a.SubnetID)
	a.VpcID = subList.GetVpcIDBySubnetID(a.SubnetID)
	a.VpcName = subList.GetVpcNameBySubnetID(a.SubnetID)
	a.Region = region
}