func (i *KeyPairs) PrintTable() {
	if len(*i) == 0 {
		terminal.ShowErrorMessage("Warning", "No KeyPairs Found!")
		return
	}
	var header []string
	rows := make([][]string, len(*i))
	for index, key := range *i {
		models.ExtractAwsmTable(index, key, &header, &rows)
	}
	table := tablewriter.NewWriter(os.Stdout)
	table.SetHeader(header)
	table.AppendBulk(rows)
	table.Render()
}
PrintTable Prints an ascii table of the list of KeyPairs
package aws
import (
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"os/user"
	"reflect"
	"regexp"
	"sync"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"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/terminal"
	"github.com/olekukonko/tablewriter"
)
type KeyPairs []KeyPair
type KeyPair models.KeyPair
func GetKeyPairByName(region, name string) (KeyPair, error) {
	if len(name) < 1 {
		return KeyPair{}, errors.New("No KeyName provided!")
	}
	sess := session.Must(session.NewSession(&aws.Config{Region: aws.String(region)}))
	svc := ec2.New(sess)
	params := &ec2.DescribeKeyPairsInput{
		KeyNames: []*string{
			aws.String(name),
		},
	}
	result, err := svc.DescribeKeyPairs(params)
	if err != nil {
		return KeyPair{}, err
	}
	count := len(result.KeyPairs)
	switch count {
	case 0:
		return KeyPair{}, errors.New("No KeyPair found named [" + name + "] in [" + region + "]!")
	case 1:
		keyPair := new(KeyPair)
		keyPair.Marshal(result.KeyPairs[0], region)
		return *keyPair, nil
	}
	return KeyPair{}, errors.New("Found more than one KeyPair named [" + name + "] in [" + region + "]!")
}
func GetKeyPairs(search string) (*KeyPairs, []error) {
	var wg sync.WaitGroup
	var errs []error
	keyList := new(KeyPairs)
	regions := GetRegionListWithoutIgnored()
	for _, region := range regions {
		wg.Add(1)
		go func(region *ec2.Region) {
			defer wg.Done()
			err := GetRegionKeyPairs(*region.RegionName, keyList, search)
			if err != nil {
				terminal.ShowErrorMessage(fmt.Sprintf("Error gathering key pair list for region [%s]", *region.RegionName), err.Error())
				errs = append(errs, err)
			}
		}(region)
	}
	wg.Wait()
	return keyList, errs
}
func (k *KeyPair) Marshal(keyPair *ec2.KeyPairInfo, region string) {
	k.KeyName = aws.StringValue(keyPair.KeyName)
	k.KeyFingerprint = aws.StringValue(keyPair.KeyFingerprint)
	k.Region = region
}
func GetRegionKeyPairs(region string, keyList *KeyPairs, search string) error {
	sess := session.Must(session.NewSession(&aws.Config{Region: aws.String(region)}))
	svc := ec2.New(sess)
	result, err := svc.DescribeKeyPairs(&ec2.DescribeKeyPairsInput{})
	if err != nil {
		return err
	}
	key := make(KeyPairs, len(result.KeyPairs))
	for i, keyPair := range result.KeyPairs {
		key[i].Marshal(keyPair, region)
	}
	if search != "" {
		term := regexp.MustCompile(search)
	Loop:
		for i, kp := range key {
			rKey := reflect.ValueOf(kp)
			for k := 0; k < rKey.NumField(); k++ {
				sVal := rKey.Field(k).String()
				if term.MatchString(sVal) {
					*keyList = append(*keyList, key[i])
					continue Loop
				}
			}
		}
	} else {
		*keyList = append(*keyList, key[:]...)
	}
	return nil
}