From 2ea2e633b8caf55015ce3eea4426e323748216ec Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Fri, 14 Jan 2022 08:48:21 +0100 Subject: [PATCH] fix(az): map User to UserName avoid collision with default .User in template --- docs/docs/segment-az.md | 2 +- src/segment_az.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/segment-az.md b/docs/docs/segment-az.md index eee68e62..43d820bc 100644 --- a/docs/docs/segment-az.md +++ b/docs/docs/segment-az.md @@ -38,7 +38,7 @@ properties below - defaults to `{{.Name}}` - `.Name`: `string` - the account name - `.State`: `string` - the account state - `.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` [go-text-template]: https://golang.org/pkg/text/template/ diff --git a/src/segment_az.go b/src/segment_az.go index a9428d67..e22a865f 100644 --- a/src/segment_az.go +++ b/src/segment_az.go @@ -21,7 +21,7 @@ type AzureConfig struct { type AzureSubscription struct { ID string `json:"id"` - Name string `json:"name"` + UserName string `json:"name"` State string `json:"state"` User *AzureUser `json:"user"` IsDefault bool `json:"isDefault"` @@ -153,7 +153,7 @@ func (a *az) getAzureRmContext() bool { a.EnvironmentName = defaultContext.Environment.Name a.TenantID = defaultContext.Tenant.ID a.ID = defaultContext.Subscription.ID - a.Name = defaultContext.Subscription.Name + a.UserName = defaultContext.Subscription.Name a.State = defaultContext.Subscription.State a.User = &AzureUser{ Name: defaultContext.Subscription.ExtendedProperties.Account,