Airat Arifullin
9789b79b1d
* Regenerate protobufs as APE specific type are defined as separate package; * Move `ape` package related utils methods from `apemanager`. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
71 lines
1.1 KiB
Go
71 lines
1.1 KiB
Go
package test
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
|
|
)
|
|
|
|
func GenerateRawChains(empty bool, n int) []*ape.Chain {
|
|
if empty {
|
|
return []*ape.Chain{}
|
|
}
|
|
|
|
res := make([]*ape.Chain, n)
|
|
for i := range res {
|
|
res[i] = GenerateRawChain(empty)
|
|
}
|
|
return res
|
|
}
|
|
|
|
func GenerateRawChain(empty bool) *ape.Chain {
|
|
chRaw := new(ape.ChainRaw)
|
|
|
|
if empty {
|
|
chRaw.SetRaw([]byte("{}"))
|
|
} else {
|
|
chRaw.SetRaw([]byte(`{
|
|
"ID": "",
|
|
"Rules": [
|
|
{
|
|
"Status": "Allow",
|
|
"Actions": {
|
|
"Inverted": false,
|
|
"Names": [
|
|
"GetObject"
|
|
]
|
|
},
|
|
"Resources": {
|
|
"Inverted": false,
|
|
"Names": [
|
|
"native:object/*"
|
|
]
|
|
},
|
|
"Any": false,
|
|
"Condition": [
|
|
{
|
|
"Op": "StringEquals",
|
|
"Object": "Resource",
|
|
"Key": "Department",
|
|
"Value": "HR"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"MatchType": "DenyPriority"
|
|
}`))
|
|
}
|
|
|
|
ch := new(ape.Chain)
|
|
ch.SetKind(chRaw)
|
|
return ch
|
|
}
|
|
|
|
func GenerateChainTarget(empty bool) *ape.ChainTarget {
|
|
m := new(ape.ChainTarget)
|
|
|
|
if !empty {
|
|
m.SetTargetType(ape.TargetTypeContainer)
|
|
m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R")
|
|
}
|
|
|
|
return m
|
|
}
|