git.frostfs.info/TrueCloudLab/frostfs-sdk-go@v0.0.0-20241022124111-5361f0ecebd3/container/acl/acl.go (about) 1 package acl 2 3 import "strconv" 4 5 // Op enumerates operations under access control inside container. 6 // Non-positive values are reserved and depend on context (e.g. unsupported op). 7 // 8 // Note that type conversion from- and to numerical types is not recommended, 9 // use corresponding constants and/or methods instead. 10 type Op uint32 11 12 // nolint: unused 13 const ( 14 opZero Op = iota // extreme value for testing 15 16 OpObjectGet // Object.Get rpc 17 OpObjectHead // Object.Head rpc 18 OpObjectPut // Object.Put rpc 19 OpObjectDelete // Object.Delete rpc 20 OpObjectSearch // Object.Search rpc 21 OpObjectRange // Object.GetRange rpc 22 OpObjectHash // Object.GetRangeHash rpc 23 24 opLast // extreme value for testing 25 ) 26 27 // String implements fmt.Stringer. 28 func (x Op) String() string { 29 switch x { 30 default: 31 return "UNKNOWN#" + strconv.FormatUint(uint64(x), 10) 32 case OpObjectGet: 33 return "OBJECT_GET" 34 case OpObjectHead: 35 return "OBJECT_HEAD" 36 case OpObjectPut: 37 return "OBJECT_PUT" 38 case OpObjectDelete: 39 return "OBJECT_DELETE" 40 case OpObjectSearch: 41 return "OBJECT_SEARCH" 42 case OpObjectRange: 43 return "OBJECT_RANGE" 44 case OpObjectHash: 45 return "OBJECT_HASH" 46 } 47 } 48 49 // Role enumerates roles covered by container ACL. Each role represents 50 // some party which can be authenticated during container op execution. 51 // Non-positive values are reserved and depend on context (e.g. unsupported role). 52 // 53 // Note that type conversion from- and to numerical types is not recommended, 54 // use corresponding constants and/or methods instead. 55 type Role uint32 56 57 // nolint: unused 58 const ( 59 roleZero Role = iota // extreme value for testing 60 61 RoleOwner // container owner 62 RoleContainer // nodes of the related container 63 RoleInnerRing // Inner Ring nodes 64 RoleOthers // all others 65 66 roleLast // extreme value for testing 67 ) 68 69 // String implements fmt.Stringer. 70 func (x Role) String() string { 71 switch x { 72 default: 73 return "UNKNOWN#" + strconv.FormatUint(uint64(x), 10) 74 case RoleOwner: 75 return "OWNER" 76 case RoleContainer: 77 return "CONTAINER" 78 case RoleInnerRing: 79 return "INNER_RING" 80 case RoleOthers: 81 return "OTHERS" 82 } 83 }