github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/acl/string.go (about)

     1  package acl
     2  
     3  import (
     4  	acl "github.com/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
     5  )
     6  
     7  // String returns string representation of Action.
     8  func (x Action) String() string {
     9  	return ActionToGRPCField(x).String()
    10  }
    11  
    12  // FromString parses Action from a string representation.
    13  // It is a reverse action to String().
    14  //
    15  // Returns true if s was parsed successfully.
    16  func (x *Action) FromString(s string) bool {
    17  	var g acl.Action
    18  
    19  	ok := g.FromString(s)
    20  
    21  	if ok {
    22  		*x = ActionFromGRPCField(g)
    23  	}
    24  
    25  	return ok
    26  }
    27  
    28  // String returns string representation of Role.
    29  func (x Role) String() string {
    30  	return RoleToGRPCField(x).String()
    31  }
    32  
    33  // FromString parses Role from a string representation.
    34  // It is a reverse action to String().
    35  //
    36  // Returns true if s was parsed successfully.
    37  func (x *Role) FromString(s string) bool {
    38  	var g acl.Role
    39  
    40  	ok := g.FromString(s)
    41  
    42  	if ok {
    43  		*x = RoleFromGRPCField(g)
    44  	}
    45  
    46  	return ok
    47  }
    48  
    49  // String returns string representation of Operation.
    50  func (x Operation) String() string {
    51  	return OperationToGRPCField(x).String()
    52  }
    53  
    54  // FromString parses Operation from a string representation.
    55  // It is a reverse action to String().
    56  //
    57  // Returns true if s was parsed successfully.
    58  func (x *Operation) FromString(s string) bool {
    59  	var g acl.Operation
    60  
    61  	ok := g.FromString(s)
    62  
    63  	if ok {
    64  		*x = OperationFromGRPCField(g)
    65  	}
    66  
    67  	return ok
    68  }
    69  
    70  // String returns string representation of MatchType.
    71  func (x MatchType) String() string {
    72  	return MatchTypeToGRPCField(x).String()
    73  }
    74  
    75  // FromString parses MatchType from a string representation.
    76  // It is a reverse action to String().
    77  //
    78  // Returns true if s was parsed successfully.
    79  func (x *MatchType) FromString(s string) bool {
    80  	var g acl.MatchType
    81  
    82  	ok := g.FromString(s)
    83  
    84  	if ok {
    85  		*x = MatchTypeFromGRPCField(g)
    86  	}
    87  
    88  	return ok
    89  }
    90  
    91  // String returns string representation of HeaderType.
    92  func (x HeaderType) String() string {
    93  	return HeaderTypeToGRPCField(x).String()
    94  }
    95  
    96  // FromString parses HeaderType from a string representation.
    97  // It is a reverse action to String().
    98  //
    99  // Returns true if s was parsed successfully.
   100  func (x *HeaderType) FromString(s string) bool {
   101  	var g acl.HeaderType
   102  
   103  	ok := g.FromString(s)
   104  
   105  	if ok {
   106  		*x = HeaderTypeFromGRPCField(g)
   107  	}
   108  
   109  	return ok
   110  }