frostfs-sdk-go/api/acl/string.go
Evgenii Stratonikov 328d214d2d
All checks were successful
DCO / DCO (pull_request) Successful in 26s
Tests and linters / Tests (pull_request) Successful in 46s
Tests and linters / Lint (pull_request) Successful in 1m52s
[#317] api: Revert easyproto marshaler usage
It has caused a noticeable degradation in node.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-01-09 11:46:09 +03:00

98 lines
2.2 KiB
Go

package acl
import (
acl "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl/grpc"
)
// String returns string representation of Action.
func (x Action) String() string {
return ActionToGRPCField(x).String()
}
// FromString parses Action from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Action) FromString(s string) bool {
g, ok := acl.Action_value[s]
if ok {
*x = ActionFromGRPCField(acl.Action(g))
}
return ok
}
// String returns string representation of Role.
func (x Role) String() string {
return RoleToGRPCField(x).String()
}
// FromString parses Role from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Role) FromString(s string) bool {
g, ok := acl.Role_value[s]
if ok {
*x = RoleFromGRPCField(acl.Role(g))
}
return ok
}
// String returns string representation of Operation.
func (x Operation) String() string {
return OperationToGRPCField(x).String()
}
// FromString parses Operation from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
g, ok := acl.Operation_value[s]
if ok {
*x = OperationFromGRPCField(acl.Operation(g))
}
return ok
}
// String returns string representation of MatchType.
func (x MatchType) String() string {
return MatchTypeToGRPCField(x).String()
}
// FromString parses MatchType from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *MatchType) FromString(s string) bool {
g, ok := acl.MatchType_value[s]
if ok {
*x = MatchTypeFromGRPCField(acl.MatchType(g))
}
return ok
}
// String returns string representation of HeaderType.
func (x HeaderType) String() string {
return HeaderTypeToGRPCField(x).String()
}
// FromString parses HeaderType from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *HeaderType) FromString(s string) bool {
g, ok := acl.HeaderType_value[s]
if ok {
*x = HeaderTypeFromGRPCField(acl.HeaderType(g))
}
return ok
}