Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit f3594dd

Browse files
committed
Move CreatedAt field to outputAccount type
1 parent 0c71e12 commit f3594dd

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

internals/secrethub/account_inspect.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func (cmd *AccountInspectCommand) Run() error {
7676
type outputAccount struct {
7777
AccountType string
7878
AccountName string
79+
CreatedAt string `json:",omitempty"`
7980
PublicAccountKey []byte `json:",omitempty"`
8081
}
8182

@@ -85,7 +86,6 @@ type outputUser struct {
8586
FullName string
8687
Email string `json:",omitempty"`
8788
EmailVerified bool `json:",omitempty"`
88-
CreatedAt string `json:",omitempty"`
8989
outputAccount
9090
}
9191

@@ -95,10 +95,10 @@ func newOutputUser(user *api.User, timeFormatter TimeFormatter) *outputUser {
9595
FullName: user.FullName,
9696
Email: user.Email,
9797
EmailVerified: user.EmailVerified,
98-
CreatedAt: timeFormatter.Format(user.CreatedAt.Local()),
9998
outputAccount: outputAccount{
10099
AccountType: accountTypeUser,
101100
AccountName: user.Username,
101+
CreatedAt: timeFormatter.Format(user.CreatedAt.Local()),
102102
PublicAccountKey: user.PublicKey,
103103
},
104104
}
@@ -114,10 +114,10 @@ type outputService struct {
114114
func newOutputService(service *api.Service, account *api.Account, timeFormatter TimeFormatter) *outputService {
115115
return &outputService{
116116
Description: service.Description,
117-
CreatedAt: timeFormatter.Format(service.CreatedAt.Local()),
118117
outputAccount: outputAccount{
119118
AccountType: accountTypeService,
120119
AccountName: service.ServiceID,
120+
CreatedAt: timeFormatter.Format(service.CreatedAt.Local()),
121121
PublicAccountKey: account.PublicKey,
122122
},
123123
}

internals/secrethub/account_inspect_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ func TestAccountInspect(t *testing.T) {
6060
"FullName": "Developer Uno",
6161
"Email": "dev1@keylocker.eu",
6262
"EmailVerified": true,
63-
"CreatedAt": "2018-07-30T10:49:18Z",
6463
"AccountType": "user",
6564
"AccountName": "dev1",
65+
"CreatedAt": "2018-07-30T10:49:18Z",
6666
"PublicAccountKey": "YWJjZGU="
6767
}
6868
`,
@@ -101,9 +101,9 @@ func TestAccountInspect(t *testing.T) {
101101
err: nil,
102102
out: `{
103103
"Description": "Test description.",
104-
"CreatedAt": "2018-07-30T10:49:18Z",
105104
"AccountType": "service",
106105
"AccountName": "s-abcdefghijkl",
106+
"CreatedAt": "2018-07-30T10:49:18Z",
107107
"PublicAccountKey": "YWJjZGU="
108108
}
109109
`,

0 commit comments

Comments
 (0)