frostfs-sdk-go/eacl/test/generate.go
Alex Vanin e70bf05fb9 [#168] eacl: Replace pointer slices with non-pointer slices
- []*Record => []Record
 - []*Filter => []Filter
 - []*Target => []Target

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00

45 lines
964 B
Go

package eacltest
import (
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
"github.com/nspcc-dev/neofs-sdk-go/eacl"
ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test"
versiontest "github.com/nspcc-dev/neofs-sdk-go/version/test"
)
// Target returns random eacl.Target.
func Target() *eacl.Target {
x := eacl.NewTarget()
x.SetRole(eacl.RoleSystem)
x.SetBinaryKeys([][]byte{
{1, 2, 3},
{4, 5, 6},
})
return x
}
// Record returns random eacl.Record.
func Record() *eacl.Record {
x := eacl.NewRecord()
x.SetAction(eacl.ActionAllow)
x.SetOperation(eacl.OperationRangeHash)
x.SetTargets(*Target(), *Target())
x.AddObjectContainerIDFilter(eacl.MatchStringEqual, cidtest.ID())
x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, ownertest.ID())
return x
}
func Table() *eacl.Table {
x := eacl.NewTable()
x.SetCID(cidtest.ID())
x.AddRecord(Record())
x.AddRecord(Record())
x.SetVersion(*versiontest.Version())
return x
}