Skip to content

Commit

Permalink
Fix run time error (Closes #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Fitzwater - IDI-C committed Nov 18, 2019
1 parent 956f8a4 commit 0baa4de
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions handler/helpers/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Options struct {
// Global compiled regular expressions
var rIDList = regexp.MustCompile(`^\d{12}(,\d{12})*$`)

// Svc ... type for holding session/config and AWS services
// For unit testing, set the iamSvc, organizationsSvc and downloaderSvc to
// an iface mock svc client
type Svc struct {
Expand All @@ -57,16 +58,19 @@ type Svc struct {
downloaderSvc s3manageriface.DownloaderAPI
}

// NewAccountsSvc ... creates new Svc struct
func NewAccountsSvc(cfg client.ConfigProvider) (as *Svc, err error) {
if cfg == nil {
return nil, errors.New("nil ConfigProvider")
}
as.cfg = cfg
as.downloaderSvc = s3manager.NewDownloader(cfg)
as = &Svc{
cfg: cfg,
downloaderSvc: s3manager.NewDownloader(cfg),
}
return as, nil
}

// Accounts ... performs Queries or parses accounts and returns all organization accounts
// AccountsList ... performs Queries or parses accounts and returns all organization accounts
func (as *Svc) AccountsList(opt Options) ([]*organizations.Account, error) {
switch str := opt.AccountsInfo; {
case str == "":
Expand Down

0 comments on commit 0baa4de

Please sign in to comment.