@@ -279,7 +279,7 @@ type AWSRoleFlat struct {
279
279
SSORegion string `json:"SSORegion" header:"SSORegion"`
280
280
StartUrl string `json:"StartUrl" header:"StartUrl"`
281
281
Tags map [string ]string `json:"Tags"` // not supported by GenerateTable
282
- Via string `json:"Via" header:"Via"`
282
+ Via string `json:"Via,omitempty " header:"Via"`
283
283
// SelectTags map[string]string // tags without spaces
284
284
}
285
285
@@ -305,7 +305,7 @@ func (c *Cache) NewRoles(as *AWSSSO, config *SSOConfig) (*Roles, error) {
305
305
for _ , aInfo := range accounts {
306
306
accountId := aInfo .GetAccountId64 ()
307
307
r .Accounts [accountId ] = & AWSAccount {
308
- Alias : aInfo .AccountName ,
308
+ Alias : aInfo .AccountName , // AWS SSO calls it `AccountName`
309
309
EmailAddress : aInfo .EmailAddress ,
310
310
Tags : map [string ]string {},
311
311
Roles : map [string ]* AWSRole {},
@@ -320,7 +320,7 @@ func (c *Cache) NewRoles(as *AWSSSO, config *SSOConfig) (*Roles, error) {
320
320
Arn : utils .MakeRoleARN (accountId , role .RoleName ),
321
321
Tags : map [string ]string {
322
322
"AccountID" : aInfo .AccountId ,
323
- "AccountAlias" : aInfo .AccountName ,
323
+ "AccountAlias" : aInfo .AccountName , // AWS SSO calls it `AccountName`
324
324
"Email" : aInfo .EmailAddress ,
325
325
"Role" : role .RoleName ,
326
326
},
@@ -358,7 +358,7 @@ func (c *Cache) NewRoles(as *AWSSSO, config *SSOConfig) (*Roles, error) {
358
358
359
359
// set the AWS SSO tags for all the SSO roles
360
360
for roleName := range r .Accounts [accountId ].Roles {
361
- aId := strconv . FormatInt (accountId , 10 )
361
+ aId , _ := utils . AccountIdToString (accountId )
362
362
r .Accounts [accountId ].Roles [roleName ].Tags ["AccountID" ] = aId
363
363
r .Accounts [accountId ].Roles [roleName ].Tags ["AccountName" ] = r .Accounts [accountId ].Name
364
364
r .Accounts [accountId ].Roles [roleName ].Tags ["AccountAlias" ] = r .Accounts [accountId ].Alias
@@ -378,8 +378,8 @@ func (c *Cache) NewRoles(as *AWSSSO, config *SSOConfig) (*Roles, error) {
378
378
}
379
379
r .Accounts [accountId ].Roles [roleName ].Arn = utils .MakeRoleARN (accountId , roleName )
380
380
r .Accounts [accountId ].Roles [roleName ].Profile = role .Profile
381
- r .Accounts [accountId ].Roles [roleName ].Via = role .Via
382
381
r .Accounts [accountId ].Roles [roleName ].DefaultRegion = r .Accounts [accountId ].DefaultRegion
382
+ r .Accounts [accountId ].Roles [roleName ].Via = role .Via
383
383
if role .DefaultRegion != "" {
384
384
r .Accounts [accountId ].Roles [roleName ].DefaultRegion = role .DefaultRegion
385
385
}
@@ -528,11 +528,14 @@ func (r *Roles) GetRole(accountId int64, roleName string) (*AWSRoleFlat, error)
528
528
flat .DefaultRegion = role .DefaultRegion
529
529
}
530
530
// Automatic tags
531
- flat .Tags ["AccountID" ] = strconv . FormatInt (accountId , 10 )
531
+ flat .Tags ["AccountID" ], _ = utils . AccountIdToString (accountId )
532
532
flat .Tags ["Email" ] = account .EmailAddress
533
533
if role .Profile != "" {
534
534
flat .Tags ["Profile" ] = role .Profile
535
535
}
536
+ if role .Via != "" {
537
+ flat .Tags ["Via" ] = role .Via
538
+ }
536
539
537
540
// Account name is by default the alias, but can be manually overridden
538
541
flat .Tags ["AccountName" ] = flat .AccountAlias
0 commit comments