func (a *awsClient) GetDefaultRegion() string {
	return a.defaultRegion
}
GetDefaultRegion will return the static default
package aws
import (
	"fmt"
	"sync"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/cloudformation"
	"github.com/aws/aws-sdk-go/service/cloudformation/cloudformationiface"
	selfv1alpha1 "go.awsctrl.io/manager/apis/self/v1alpha1"
)
type AWS interface {
	Configured() error
	Configure(*selfv1alpha1.ConfigAWS) error
	SetClient(string, cloudformationiface.CloudFormationAPI) bool
	GetClients() map[string]cloudformationiface.CloudFormationAPI
	GetClient(string) cloudformationiface.CloudFormationAPI
	SetSession(string, *session.Session) bool
	GetSessions() map[string]*session.Session
	GetSession(string) *session.Session
	GetNotificationARN() string
	GetDefaultRegion() string
}
func New() AWS {
	clients := map[string]cloudformationiface.CloudFormationAPI{}
	sessions := map[string]*session.Session{}
	return &awsClient{
		mutex:      sync.Mutex{},
		clients:    clients,
		sessions:   sessions,
		configured: false,
	}
}
type awsClient struct {
	mutex sync.Mutex
	clients  map[string]cloudformationiface.CloudFormationAPI
	sessions map[string]*session.Session
	notficationARN string
	defaultRegion  string
	rawConfig *selfv1alpha1.ConfigAWS
	configured bool
}
func (a *awsClient) Configured() error {
	if a.configured {
		return nil
	}
	return fmt.Errorf("aws client not loaded and configured, check for self.awsctrl.io/config")
}
func (a *awsClient) Configure(config *selfv1alpha1.ConfigAWS) error {
	for _, region := range config.SupportedRegions {
		sess, err := session.NewSession(&aws.Config{Region: aws.String(region)})
		if err != nil {
			return err
		}
		a.SetSession(region, sess)
		a.SetClient(region, cloudformation.New(sess))
	}
	a.mutex.Lock()
	defer a.mutex.Unlock()
	a.rawConfig = config
	a.defaultRegion = config.DefaultRegion
	a.configured = true
	return nil
}
func (a *awsClient) SetClient(region string, iface cloudformationiface.CloudFormationAPI) bool {
	a.mutex.Lock()
	defer a.mutex.Unlock()
	a.clients[region] = iface
	return true
}
func (a *awsClient) GetClients() map[string]cloudformationiface.CloudFormationAPI {
	return a.clients
}
func (a *awsClient) GetClient(region string) cloudformationiface.CloudFormationAPI {
	if region == "" {
		region = a.GetDefaultRegion()
	}
	return a.GetClients()[region]
}
func (a *awsClient) SetSession(region string, sess *session.Session) bool {
	a.mutex.Lock()
	defer a.mutex.Unlock()
	a.sessions[region] = sess
	return true
}
func (a *awsClient) GetSessions() map[string]*session.Session {
	return a.sessions
}
func (a *awsClient) GetSession(region string) *session.Session {
	if region == "" {
		region = a.GetDefaultRegion()
	}
	return a.GetSessions()[region]
}
func (a *awsClient) GetNotificationARN() string {
	return a.notficationARN
}