fix(az): map User to UserName

avoid collision with default .User in template
This commit is contained in:
Jan De Dobbeleer 2022-01-14 08:48:21 +01:00 committed by Jan De Dobbeleer
parent 5c586696ac
commit 2ea2e633b8
2 changed files with 3 additions and 3 deletions

View file

@ -38,7 +38,7 @@ properties below - defaults to `{{.Name}}`
- `.Name`: `string` - the account name - `.Name`: `string` - the account name
- `.State`: `string` - the account state - `.State`: `string` - the account state
- `.TenantID`: `string` - the tenant id - `.TenantID`: `string` - the tenant id
- `.User.Name`: `string` - the user name - `.UserName`: `string` - the user name
- `.Origin`: `string` - where we received the information from, can be `CLI` or `PWSH` - `.Origin`: `string` - where we received the information from, can be `CLI` or `PWSH`
[go-text-template]: https://golang.org/pkg/text/template/ [go-text-template]: https://golang.org/pkg/text/template/

View file

@ -21,7 +21,7 @@ type AzureConfig struct {
type AzureSubscription struct { type AzureSubscription struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` UserName string `json:"name"`
State string `json:"state"` State string `json:"state"`
User *AzureUser `json:"user"` User *AzureUser `json:"user"`
IsDefault bool `json:"isDefault"` IsDefault bool `json:"isDefault"`
@ -153,7 +153,7 @@ func (a *az) getAzureRmContext() bool {
a.EnvironmentName = defaultContext.Environment.Name a.EnvironmentName = defaultContext.Environment.Name
a.TenantID = defaultContext.Tenant.ID a.TenantID = defaultContext.Tenant.ID
a.ID = defaultContext.Subscription.ID a.ID = defaultContext.Subscription.ID
a.Name = defaultContext.Subscription.Name a.UserName = defaultContext.Subscription.Name
a.State = defaultContext.Subscription.State a.State = defaultContext.Subscription.State
a.User = &AzureUser{ a.User = &AzureUser{
Name: defaultContext.Subscription.ExtendedProperties.Account, Name: defaultContext.Subscription.ExtendedProperties.Account,