Skip to content

Commit c001f9f

Browse files
Sylfwoodrandy-but-a-ro[bot]
authored andcommitted
chore: [auto] reorder credential fields to reflect ui presentation
1 parent 4f1a10e commit c001f9f

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

entries.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ type Entries struct {
2121
}
2222

2323
type Entry struct {
24-
Id string `json:"id,omitempty"`
25-
VaultId string `json:"vaultId,omitempty"`
26-
Name string `json:"name"`
27-
Path string `json:"path"`
28-
Type string `json:"type"`
29-
SubType string `json:"subType"`
24+
Id string `json:"id,omitempty"`
25+
VaultId string `json:"vaultId,omitempty"`
26+
Name string `json:"name"`
27+
Path string `json:"path"`
28+
Type string `json:"type"`
29+
SubType string `json:"subType"`
30+
Description string `json:"description"`
31+
Tags []string `json:"tags,omitempty"`
3032

3133
Data EntryData `json:"data,omitempty"`
3234

33-
Description string `json:"description"`
34-
ModifiedBy string `json:"modifiedBy,omitempty"`
35-
ModifiedOn *ServerTime `json:"modifiedOn,omitempty"`
36-
CreatedBy string `json:"createdBy,omitempty"`
37-
CreatedOn *ServerTime `json:"createdOn,omitempty"`
38-
Tags []string `json:"tags,omitempty"`
35+
CreatedBy string `json:"createdBy,omitempty"`
36+
CreatedOn *ServerTime `json:"createdOn,omitempty"`
37+
ModifiedBy string `json:"modifiedBy,omitempty"`
38+
ModifiedOn *ServerTime `json:"modifiedOn,omitempty"`
3939
}
4040

4141
type EntryData any

entry_credential.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,16 @@ func (c *EntryCredentialService) New(entry Entry) (string, error) {
189189
Path string `json:"path,omitempty"`
190190
Type string `json:"type"`
191191
SubType string `json:"subType"`
192-
Data EntryData `json:"data"`
193192
Tags []string `json:"tags,omitempty"`
193+
Data EntryData `json:"data"`
194194
}{
195195
Name: entry.Name,
196196
Description: entry.Description,
197197
Path: entry.Path,
198198
Type: entry.GetType(),
199199
SubType: entry.GetSubType(),
200-
Data: entry.Data,
201200
Tags: entry.Tags,
201+
Data: entry.Data,
202202
}
203203

204204
baseEntryEndpoint := entryPublicBaseEndpointReplacer(entry.VaultId)
@@ -242,14 +242,14 @@ func (c *EntryCredentialService) Update(entry Entry) (Entry, error) {
242242
Name string `json:"name"`
243243
Description string `json:"description,omitempty"`
244244
Path string `json:"path,omitempty"`
245-
Data EntryData `json:"data"`
246245
Tags []string `json:"tags,omitempty"`
246+
Data EntryData `json:"data"`
247247
}{
248248
Name: entry.Name,
249249
Description: entry.Description,
250250
Path: entry.Path,
251-
Data: entry.Data,
252251
Tags: entry.Tags,
252+
Data: entry.Data,
253253
}
254254

255255
entryUri := entryPublicEndpointReplacer(entry.VaultId, entry.Id)

entry_credential_test.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ func test_NewUserEntry(t *testing.T) {
5555
VaultId: testVaultId,
5656
Name: "TestGoDvlsAccessCode",
5757
Path: "go-dvls\\accesscode",
58-
Description: "Test AccessCode entry",
5958
Type: EntryCredentialType,
6059
SubType: EntryCredentialSubTypeAccessCode,
60+
Description: "Test AccessCode entry",
61+
Tags: []string{"accesscode"},
62+
6163
Data: EntryCredentialAccessCodeData{
6264
Password: "abc-123",
6365
},
64-
Tags: []string{"accesscode"},
6566
}
6667

6768
newCredentialAccessCodeEntryId, err := testClient.Entries.Credential.New(testCredentialAccessCodeEntry)
@@ -81,15 +82,16 @@ func test_NewUserEntry(t *testing.T) {
8182
VaultId: testVaultId,
8283
Name: "TestGoDvlsApiKey",
8384
Path: "go-dvls\\apikey",
84-
Description: "Test ApiKey entry",
8585
Type: EntryCredentialType,
8686
SubType: EntryCredentialSubTypeApiKey,
87+
Description: "Test ApiKey entry",
88+
Tags: []string{"apikey"},
89+
8790
Data: EntryCredentialApiKeyData{
8891
ApiId: "abcd1234-abcd-1234-abcd-1234abcd1234",
8992
ApiKey: "123-abc",
9093
TenantId: "00000000-aaaa-bbbb-cccc-000000000000",
9194
},
92-
Tags: []string{"apikey"},
9395
}
9496

9597
newCredentialApiKeyEntryId, err := testClient.Entries.Credential.New(testCredentialApiKeyEntry)
@@ -109,15 +111,16 @@ func test_NewUserEntry(t *testing.T) {
109111
VaultId: testVaultId,
110112
Name: "TestGoDvlsAzureServicePrincipal",
111113
Path: "go-dvls\\azureserviceprincipal",
112-
Description: "Test AzureServicePrincipal entry",
113114
Type: EntryCredentialType,
114115
SubType: EntryCredentialSubTypeAzureServicePrincipal,
116+
Description: "Test AzureServicePrincipal entry",
117+
Tags: []string{"azureserviceprincipal"},
118+
115119
Data: EntryCredentialAzureServicePrincipalData{
116120
ClientId: "abcd1234-abcd-1234-abcd-1234abcd1234",
117121
ClientSecret: "123-abc",
118122
TenantId: "00000000-aaaa-bbbb-cccc-000000000000",
119123
},
120-
Tags: []string{"azureserviceprincipal"},
121124
}
122125

123126
newCredentialAzureServicePrincipalEntryId, err := testClient.Entries.Credential.New(testCredentialAzureServicePrincipalEntry)
@@ -137,13 +140,14 @@ func test_NewUserEntry(t *testing.T) {
137140
VaultId: testVaultId,
138141
Name: "TestGoDvlsConnectionString",
139142
Path: "go-dvls\\connectionstring",
140-
Description: "Test ConnectionString entry",
141143
Type: EntryCredentialType,
142144
SubType: EntryCredentialSubTypeConnectionString,
145+
Description: "Test ConnectionString entry",
146+
Tags: []string{"connectionstring"},
147+
143148
Data: EntryCredentialConnectionStringData{
144149
ConnectionString: "Server=tcp:example.database.windows.net,1433;Initial Catalog=exampledb;Persist Security Info=False;User ID=exampleuser;Password=examplepassword;",
145150
},
146-
Tags: []string{"connectionstring"},
147151
}
148152

149153
newCredentialConnectionStringEntryId, err := testClient.Entries.Credential.New(testCredentialConnectionStringEntry)
@@ -162,15 +166,16 @@ func test_NewUserEntry(t *testing.T) {
162166
VaultId: testVaultId,
163167
Name: "TestGoDvlsUsernamePassword",
164168
Path: "go-dvls\\usernamepassword",
165-
Description: "Test Username/Password entry",
166169
Type: EntryCredentialType,
167170
SubType: EntryCredentialSubTypeDefault,
171+
Description: "Test Username/Password entry",
172+
Tags: []string{"usernamepassword"},
173+
168174
Data: EntryCredentialDefaultData{
169175
Domain: "www.example.com",
170176
Password: "abc-123",
171177
Username: "john.doe",
172178
},
173-
Tags: []string{"usernamepassword"},
174179
}
175180

176181
newCredentialDefaultEntryId, err := testClient.Entries.Credential.New(testCredentialDefaultEntry)
@@ -190,16 +195,17 @@ func test_NewUserEntry(t *testing.T) {
190195
VaultId: testVaultId,
191196
Name: "TestGoDvlsPrivateKey",
192197
Path: "go-dvls\\privatekey",
193-
Description: "Test Secret entry",
194198
Type: EntryCredentialType,
195199
SubType: EntryCredentialSubTypePrivateKey,
200+
Description: "Test Secret entry",
201+
Tags: []string{"testtag"},
202+
196203
Data: EntryCredentialPrivateKeyData{
197204
PrivateKey: "-----BEGIN PRIVATE KEY-----\abcdefghijklmnopqrstuvwxyz1234567890...\n-----END PRIVATE",
198205
PublicKey: "-----BEGIN PUBLIC KEY-----\abcdefghijklmnopqrstuvwxyz...\n-----END PUBLIC KEY-----",
199206
OverridePassword: "override-password",
200207
Passphrase: "passphrase",
201208
},
202-
Tags: []string{"testtag"},
203209
}
204210

205211
newCredentialPrivateKeyEntryId, err := testClient.Entries.Credential.New(testCredentialPrivateKeyEntry)

0 commit comments

Comments
 (0)