[#172] v2/acl: Rename target `keyList` field to `keys`

According to new neofs-api target filed `key_list`
rename to `keys`.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
support/v2.15
Alex Vanin 2020-10-19 15:39:13 +03:00 committed by Alex Vanin
parent 80b7033606
commit 5f6720f456
6 changed files with 12 additions and 12 deletions

View File

@ -32,7 +32,7 @@ func (t *Target) ToV2() *v2acl.Target {
target := new(v2acl.Target)
target.SetRole(t.role.ToV2())
target.SetKeyList(keys)
target.SetKeys(keys)
return target
}
@ -45,7 +45,7 @@ func NewTargetFromV2(target *v2acl.Target) *Target {
}
t.role = RoleFromV2(target.GetRole())
v2keys := target.GetKeyList()
v2keys := target.GetKeys()
t.keys = make([]ecdsa.PublicKey, 0, len(v2keys))
for i := range v2keys {
key := crypto.UnmarshalPublicKey(v2keys[i])

View File

@ -24,8 +24,8 @@ func TestTarget(t *testing.T) {
v2 := target.ToV2()
require.NotNil(t, v2)
require.Equal(t, v2acl.RoleSystem, v2.GetRole())
require.Len(t, v2.GetKeyList(), len(keys))
for i, key := range v2.GetKeyList() {
require.Len(t, v2.GetKeys(), len(keys))
for i, key := range v2.GetKeys() {
require.Equal(t, key, crypto.MarshalPublicKey(&keys[i]))
}

View File

@ -205,7 +205,7 @@ func TargetToGRPCMessage(t *Target) *acl.EACLRecord_Target {
RoleToGRPCField(t.GetRole()),
)
m.SetKeyList(t.GetKeyList())
m.SetKeys(t.GetKeys())
return m
}
@ -222,7 +222,7 @@ func TargetInfoFromGRPCMessage(m *acl.EACLRecord_Target) *Target {
RoleFromGRPCField(m.GetRole()),
)
t.SetKeyList(m.GetKeyList())
t.SetKeys(m.GetKeys())
return t
}

View File

@ -88,10 +88,10 @@ func (m *EACLRecord_Target) SetRole(v Role) {
}
}
// SetKeyList sets key list of the eACL target.
func (m *EACLRecord_Target) SetKeyList(v [][]byte) {
// SetKeys of the eACL target.
func (m *EACLRecord_Target) SetKeys(v [][]byte) {
if m != nil {
m.KeyList = v
m.Keys = v
}
}

View File

@ -141,7 +141,7 @@ func TestTargetInfo_StableMarshal(t *testing.T) {
t.Run("non empty", func(t *testing.T) {
targetFrom.SetRole(acl.RoleUser)
targetFrom.SetKeyList([][]byte{
targetFrom.SetKeys([][]byte{
[]byte("Public Key 1"),
[]byte("Public Key 2"),
})

View File

@ -181,7 +181,7 @@ func (t *Target) SetRole(v Role) {
}
}
func (t *Target) GetKeyList() [][]byte {
func (t *Target) GetKeys() [][]byte {
if t != nil {
return t.keys
}
@ -189,7 +189,7 @@ func (t *Target) GetKeyList() [][]byte {
return nil
}
func (t *Target) SetKeyList(v [][]byte) {
func (t *Target) SetKeys(v [][]byte) {
if t != nil {
t.keys = v
}