github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1alpha2/role/role.pb.fieldpath.go (about)

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1alpha2/role.proto
     3  // DO NOT EDIT!!!
     4  
     5  package role
     6  
     7  import (
     8  	"encoding/json"
     9  	"fmt"
    10  	"reflect"
    11  	"strings"
    12  	"time"
    13  
    14  	"google.golang.org/grpc/codes"
    15  	"google.golang.org/grpc/status"
    16  	"google.golang.org/protobuf/encoding/protojson"
    17  	"google.golang.org/protobuf/proto"
    18  	"google.golang.org/protobuf/reflect/protoregistry"
    19  
    20  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    21  	"github.com/cloudwan/goten-sdk/runtime/strcase"
    22  )
    23  
    24  // proto imports
    25  import (
    26  	condition "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/condition"
    27  	permission "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/permission"
    28  	meta "github.com/cloudwan/goten-sdk/types/meta"
    29  )
    30  
    31  // ensure the imports are used
    32  var (
    33  	_ = new(json.Marshaler)
    34  	_ = new(fmt.Stringer)
    35  	_ = reflect.DeepEqual
    36  	_ = strings.Builder{}
    37  	_ = time.Second
    38  
    39  	_ = strcase.ToLowerCamel
    40  	_ = codes.NotFound
    41  	_ = status.Status{}
    42  	_ = protojson.UnmarshalOptions{}
    43  	_ = new(proto.Message)
    44  	_ = protoregistry.GlobalTypes
    45  
    46  	_ = new(gotenobject.FieldPath)
    47  )
    48  
    49  // make sure we're using proto imports
    50  var (
    51  	_ = &condition.Condition{}
    52  	_ = &permission.Permission{}
    53  	_ = &meta.Meta{}
    54  )
    55  
    56  // FieldPath provides implementation to handle
    57  // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto
    58  type Role_FieldPath interface {
    59  	gotenobject.FieldPath
    60  	Selector() Role_FieldPathSelector
    61  	Get(source *Role) []interface{}
    62  	GetSingle(source *Role) (interface{}, bool)
    63  	ClearValue(item *Role)
    64  
    65  	// Those methods build corresponding Role_FieldPathValue
    66  	// (or array of values) and holds passed value. Panics if injected type is incorrect.
    67  	WithIValue(value interface{}) Role_FieldPathValue
    68  	WithIArrayOfValues(values interface{}) Role_FieldPathArrayOfValues
    69  	WithIArrayItemValue(value interface{}) Role_FieldPathArrayItemValue
    70  }
    71  
    72  type Role_FieldPathSelector int32
    73  
    74  const (
    75  	Role_FieldPathSelectorName                      Role_FieldPathSelector = 0
    76  	Role_FieldPathSelectorDisplayName               Role_FieldPathSelector = 1
    77  	Role_FieldPathSelectorIncludedPermissions       Role_FieldPathSelector = 2
    78  	Role_FieldPathSelectorDefaultConditionBinding   Role_FieldPathSelector = 3
    79  	Role_FieldPathSelectorIncludedConditionBindings Role_FieldPathSelector = 4
    80  	Role_FieldPathSelectorRequiredConditions        Role_FieldPathSelector = 5
    81  	Role_FieldPathSelectorMetadata                  Role_FieldPathSelector = 6
    82  )
    83  
    84  func (s Role_FieldPathSelector) String() string {
    85  	switch s {
    86  	case Role_FieldPathSelectorName:
    87  		return "name"
    88  	case Role_FieldPathSelectorDisplayName:
    89  		return "display_name"
    90  	case Role_FieldPathSelectorIncludedPermissions:
    91  		return "included_permissions"
    92  	case Role_FieldPathSelectorDefaultConditionBinding:
    93  		return "default_condition_binding"
    94  	case Role_FieldPathSelectorIncludedConditionBindings:
    95  		return "included_condition_bindings"
    96  	case Role_FieldPathSelectorRequiredConditions:
    97  		return "required_conditions"
    98  	case Role_FieldPathSelectorMetadata:
    99  		return "metadata"
   100  	default:
   101  		panic(fmt.Sprintf("Invalid selector for Role: %d", s))
   102  	}
   103  }
   104  
   105  func BuildRole_FieldPath(fp gotenobject.RawFieldPath) (Role_FieldPath, error) {
   106  	if len(fp) == 0 {
   107  		return nil, status.Error(codes.InvalidArgument, "empty field path for object Role")
   108  	}
   109  	if len(fp) == 1 {
   110  		switch fp[0] {
   111  		case "name":
   112  			return &Role_FieldTerminalPath{selector: Role_FieldPathSelectorName}, nil
   113  		case "display_name", "displayName", "display-name":
   114  			return &Role_FieldTerminalPath{selector: Role_FieldPathSelectorDisplayName}, nil
   115  		case "included_permissions", "includedPermissions", "included-permissions":
   116  			return &Role_FieldTerminalPath{selector: Role_FieldPathSelectorIncludedPermissions}, nil
   117  		case "default_condition_binding", "defaultConditionBinding", "default-condition-binding":
   118  			return &Role_FieldTerminalPath{selector: Role_FieldPathSelectorDefaultConditionBinding}, nil
   119  		case "included_condition_bindings", "includedConditionBindings", "included-condition-bindings":
   120  			return &Role_FieldTerminalPath{selector: Role_FieldPathSelectorIncludedConditionBindings}, nil
   121  		case "required_conditions", "requiredConditions", "required-conditions":
   122  			return &Role_FieldTerminalPath{selector: Role_FieldPathSelectorRequiredConditions}, nil
   123  		case "metadata":
   124  			return &Role_FieldTerminalPath{selector: Role_FieldPathSelectorMetadata}, nil
   125  		}
   126  	} else {
   127  		switch fp[0] {
   128  		case "default_condition_binding", "defaultConditionBinding", "default-condition-binding":
   129  			if subpath, err := condition.BuildConditionBinding_FieldPath(fp[1:]); err != nil {
   130  				return nil, err
   131  			} else {
   132  				return &Role_FieldSubPath{selector: Role_FieldPathSelectorDefaultConditionBinding, subPath: subpath}, nil
   133  			}
   134  		case "included_condition_bindings", "includedConditionBindings", "included-condition-bindings":
   135  			if subpath, err := condition.BuildConditionBinding_FieldPath(fp[1:]); err != nil {
   136  				return nil, err
   137  			} else {
   138  				return &Role_FieldSubPath{selector: Role_FieldPathSelectorIncludedConditionBindings, subPath: subpath}, nil
   139  			}
   140  		case "metadata":
   141  			if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil {
   142  				return nil, err
   143  			} else {
   144  				return &Role_FieldSubPath{selector: Role_FieldPathSelectorMetadata, subPath: subpath}, nil
   145  			}
   146  		}
   147  	}
   148  	return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Role", fp)
   149  }
   150  
   151  func ParseRole_FieldPath(rawField string) (Role_FieldPath, error) {
   152  	fp, err := gotenobject.ParseRawFieldPath(rawField)
   153  	if err != nil {
   154  		return nil, err
   155  	}
   156  	return BuildRole_FieldPath(fp)
   157  }
   158  
   159  func MustParseRole_FieldPath(rawField string) Role_FieldPath {
   160  	fp, err := ParseRole_FieldPath(rawField)
   161  	if err != nil {
   162  		panic(err)
   163  	}
   164  	return fp
   165  }
   166  
   167  type Role_FieldTerminalPath struct {
   168  	selector Role_FieldPathSelector
   169  }
   170  
   171  var _ Role_FieldPath = (*Role_FieldTerminalPath)(nil)
   172  
   173  func (fp *Role_FieldTerminalPath) Selector() Role_FieldPathSelector {
   174  	return fp.selector
   175  }
   176  
   177  // String returns path representation in proto convention
   178  func (fp *Role_FieldTerminalPath) String() string {
   179  	return fp.selector.String()
   180  }
   181  
   182  // JSONString returns path representation is JSON convention
   183  func (fp *Role_FieldTerminalPath) JSONString() string {
   184  	return strcase.ToLowerCamel(fp.String())
   185  }
   186  
   187  // Get returns all values pointed by specific field from source Role
   188  func (fp *Role_FieldTerminalPath) Get(source *Role) (values []interface{}) {
   189  	if source != nil {
   190  		switch fp.selector {
   191  		case Role_FieldPathSelectorName:
   192  			if source.Name != nil {
   193  				values = append(values, source.Name)
   194  			}
   195  		case Role_FieldPathSelectorDisplayName:
   196  			values = append(values, source.DisplayName)
   197  		case Role_FieldPathSelectorIncludedPermissions:
   198  			for _, value := range source.GetIncludedPermissions() {
   199  				values = append(values, value)
   200  			}
   201  		case Role_FieldPathSelectorDefaultConditionBinding:
   202  			if source.DefaultConditionBinding != nil {
   203  				values = append(values, source.DefaultConditionBinding)
   204  			}
   205  		case Role_FieldPathSelectorIncludedConditionBindings:
   206  			for _, value := range source.GetIncludedConditionBindings() {
   207  				values = append(values, value)
   208  			}
   209  		case Role_FieldPathSelectorRequiredConditions:
   210  			for _, value := range source.GetRequiredConditions() {
   211  				values = append(values, value)
   212  			}
   213  		case Role_FieldPathSelectorMetadata:
   214  			if source.Metadata != nil {
   215  				values = append(values, source.Metadata)
   216  			}
   217  		default:
   218  			panic(fmt.Sprintf("Invalid selector for Role: %d", fp.selector))
   219  		}
   220  	}
   221  	return
   222  }
   223  
   224  func (fp *Role_FieldTerminalPath) GetRaw(source proto.Message) []interface{} {
   225  	return fp.Get(source.(*Role))
   226  }
   227  
   228  // GetSingle returns value pointed by specific field of from source Role
   229  func (fp *Role_FieldTerminalPath) GetSingle(source *Role) (interface{}, bool) {
   230  	switch fp.selector {
   231  	case Role_FieldPathSelectorName:
   232  		res := source.GetName()
   233  		return res, res != nil
   234  	case Role_FieldPathSelectorDisplayName:
   235  		return source.GetDisplayName(), source != nil
   236  	case Role_FieldPathSelectorIncludedPermissions:
   237  		res := source.GetIncludedPermissions()
   238  		return res, res != nil
   239  	case Role_FieldPathSelectorDefaultConditionBinding:
   240  		res := source.GetDefaultConditionBinding()
   241  		return res, res != nil
   242  	case Role_FieldPathSelectorIncludedConditionBindings:
   243  		res := source.GetIncludedConditionBindings()
   244  		return res, res != nil
   245  	case Role_FieldPathSelectorRequiredConditions:
   246  		res := source.GetRequiredConditions()
   247  		return res, res != nil
   248  	case Role_FieldPathSelectorMetadata:
   249  		res := source.GetMetadata()
   250  		return res, res != nil
   251  	default:
   252  		panic(fmt.Sprintf("Invalid selector for Role: %d", fp.selector))
   253  	}
   254  }
   255  
   256  func (fp *Role_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
   257  	return fp.GetSingle(source.(*Role))
   258  }
   259  
   260  // GetDefault returns a default value of the field type
   261  func (fp *Role_FieldTerminalPath) GetDefault() interface{} {
   262  	switch fp.selector {
   263  	case Role_FieldPathSelectorName:
   264  		return (*Name)(nil)
   265  	case Role_FieldPathSelectorDisplayName:
   266  		return ""
   267  	case Role_FieldPathSelectorIncludedPermissions:
   268  		return ([]*permission.Reference)(nil)
   269  	case Role_FieldPathSelectorDefaultConditionBinding:
   270  		return (*condition.ConditionBinding)(nil)
   271  	case Role_FieldPathSelectorIncludedConditionBindings:
   272  		return ([]*condition.ConditionBinding)(nil)
   273  	case Role_FieldPathSelectorRequiredConditions:
   274  		return ([]*condition.Reference)(nil)
   275  	case Role_FieldPathSelectorMetadata:
   276  		return (*meta.Meta)(nil)
   277  	default:
   278  		panic(fmt.Sprintf("Invalid selector for Role: %d", fp.selector))
   279  	}
   280  }
   281  
   282  func (fp *Role_FieldTerminalPath) ClearValue(item *Role) {
   283  	if item != nil {
   284  		switch fp.selector {
   285  		case Role_FieldPathSelectorName:
   286  			item.Name = nil
   287  		case Role_FieldPathSelectorDisplayName:
   288  			item.DisplayName = ""
   289  		case Role_FieldPathSelectorIncludedPermissions:
   290  			item.IncludedPermissions = nil
   291  		case Role_FieldPathSelectorDefaultConditionBinding:
   292  			item.DefaultConditionBinding = nil
   293  		case Role_FieldPathSelectorIncludedConditionBindings:
   294  			item.IncludedConditionBindings = nil
   295  		case Role_FieldPathSelectorRequiredConditions:
   296  			item.RequiredConditions = nil
   297  		case Role_FieldPathSelectorMetadata:
   298  			item.Metadata = nil
   299  		default:
   300  			panic(fmt.Sprintf("Invalid selector for Role: %d", fp.selector))
   301  		}
   302  	}
   303  }
   304  
   305  func (fp *Role_FieldTerminalPath) ClearValueRaw(item proto.Message) {
   306  	fp.ClearValue(item.(*Role))
   307  }
   308  
   309  // IsLeaf - whether field path is holds simple value
   310  func (fp *Role_FieldTerminalPath) IsLeaf() bool {
   311  	return fp.selector == Role_FieldPathSelectorName ||
   312  		fp.selector == Role_FieldPathSelectorDisplayName ||
   313  		fp.selector == Role_FieldPathSelectorIncludedPermissions ||
   314  		fp.selector == Role_FieldPathSelectorRequiredConditions
   315  }
   316  
   317  func (fp *Role_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
   318  	return []gotenobject.FieldPath{fp}
   319  }
   320  
   321  func (fp *Role_FieldTerminalPath) WithIValue(value interface{}) Role_FieldPathValue {
   322  	switch fp.selector {
   323  	case Role_FieldPathSelectorName:
   324  		return &Role_FieldTerminalPathValue{Role_FieldTerminalPath: *fp, value: value.(*Name)}
   325  	case Role_FieldPathSelectorDisplayName:
   326  		return &Role_FieldTerminalPathValue{Role_FieldTerminalPath: *fp, value: value.(string)}
   327  	case Role_FieldPathSelectorIncludedPermissions:
   328  		return &Role_FieldTerminalPathValue{Role_FieldTerminalPath: *fp, value: value.([]*permission.Reference)}
   329  	case Role_FieldPathSelectorDefaultConditionBinding:
   330  		return &Role_FieldTerminalPathValue{Role_FieldTerminalPath: *fp, value: value.(*condition.ConditionBinding)}
   331  	case Role_FieldPathSelectorIncludedConditionBindings:
   332  		return &Role_FieldTerminalPathValue{Role_FieldTerminalPath: *fp, value: value.([]*condition.ConditionBinding)}
   333  	case Role_FieldPathSelectorRequiredConditions:
   334  		return &Role_FieldTerminalPathValue{Role_FieldTerminalPath: *fp, value: value.([]*condition.Reference)}
   335  	case Role_FieldPathSelectorMetadata:
   336  		return &Role_FieldTerminalPathValue{Role_FieldTerminalPath: *fp, value: value.(*meta.Meta)}
   337  	default:
   338  		panic(fmt.Sprintf("Invalid selector for Role: %d", fp.selector))
   339  	}
   340  }
   341  
   342  func (fp *Role_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
   343  	return fp.WithIValue(value)
   344  }
   345  
   346  func (fp *Role_FieldTerminalPath) WithIArrayOfValues(values interface{}) Role_FieldPathArrayOfValues {
   347  	fpaov := &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp}
   348  	switch fp.selector {
   349  	case Role_FieldPathSelectorName:
   350  		return &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp, values: values.([]*Name)}
   351  	case Role_FieldPathSelectorDisplayName:
   352  		return &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp, values: values.([]string)}
   353  	case Role_FieldPathSelectorIncludedPermissions:
   354  		return &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp, values: values.([][]*permission.Reference)}
   355  	case Role_FieldPathSelectorDefaultConditionBinding:
   356  		return &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp, values: values.([]*condition.ConditionBinding)}
   357  	case Role_FieldPathSelectorIncludedConditionBindings:
   358  		return &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp, values: values.([][]*condition.ConditionBinding)}
   359  	case Role_FieldPathSelectorRequiredConditions:
   360  		return &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp, values: values.([][]*condition.Reference)}
   361  	case Role_FieldPathSelectorMetadata:
   362  		return &Role_FieldTerminalPathArrayOfValues{Role_FieldTerminalPath: *fp, values: values.([]*meta.Meta)}
   363  	default:
   364  		panic(fmt.Sprintf("Invalid selector for Role: %d", fp.selector))
   365  	}
   366  	return fpaov
   367  }
   368  
   369  func (fp *Role_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
   370  	return fp.WithIArrayOfValues(values)
   371  }
   372  
   373  func (fp *Role_FieldTerminalPath) WithIArrayItemValue(value interface{}) Role_FieldPathArrayItemValue {
   374  	switch fp.selector {
   375  	case Role_FieldPathSelectorIncludedPermissions:
   376  		return &Role_FieldTerminalPathArrayItemValue{Role_FieldTerminalPath: *fp, value: value.(*permission.Reference)}
   377  	case Role_FieldPathSelectorIncludedConditionBindings:
   378  		return &Role_FieldTerminalPathArrayItemValue{Role_FieldTerminalPath: *fp, value: value.(*condition.ConditionBinding)}
   379  	case Role_FieldPathSelectorRequiredConditions:
   380  		return &Role_FieldTerminalPathArrayItemValue{Role_FieldTerminalPath: *fp, value: value.(*condition.Reference)}
   381  	default:
   382  		panic(fmt.Sprintf("Invalid selector for Role: %d", fp.selector))
   383  	}
   384  }
   385  
   386  func (fp *Role_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
   387  	return fp.WithIArrayItemValue(value)
   388  }
   389  
   390  type Role_FieldSubPath struct {
   391  	selector Role_FieldPathSelector
   392  	subPath  gotenobject.FieldPath
   393  }
   394  
   395  var _ Role_FieldPath = (*Role_FieldSubPath)(nil)
   396  
   397  func (fps *Role_FieldSubPath) Selector() Role_FieldPathSelector {
   398  	return fps.selector
   399  }
   400  func (fps *Role_FieldSubPath) AsDefaultConditionBindingSubPath() (condition.ConditionBinding_FieldPath, bool) {
   401  	res, ok := fps.subPath.(condition.ConditionBinding_FieldPath)
   402  	return res, ok
   403  }
   404  func (fps *Role_FieldSubPath) AsIncludedConditionBindingsSubPath() (condition.ConditionBinding_FieldPath, bool) {
   405  	res, ok := fps.subPath.(condition.ConditionBinding_FieldPath)
   406  	return res, ok
   407  }
   408  func (fps *Role_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) {
   409  	res, ok := fps.subPath.(meta.Meta_FieldPath)
   410  	return res, ok
   411  }
   412  
   413  // String returns path representation in proto convention
   414  func (fps *Role_FieldSubPath) String() string {
   415  	return fps.selector.String() + "." + fps.subPath.String()
   416  }
   417  
   418  // JSONString returns path representation is JSON convention
   419  func (fps *Role_FieldSubPath) JSONString() string {
   420  	return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString()
   421  }
   422  
   423  // Get returns all values pointed by selected field from source Role
   424  func (fps *Role_FieldSubPath) Get(source *Role) (values []interface{}) {
   425  	switch fps.selector {
   426  	case Role_FieldPathSelectorDefaultConditionBinding:
   427  		values = append(values, fps.subPath.GetRaw(source.GetDefaultConditionBinding())...)
   428  	case Role_FieldPathSelectorIncludedConditionBindings:
   429  		for _, item := range source.GetIncludedConditionBindings() {
   430  			values = append(values, fps.subPath.GetRaw(item)...)
   431  		}
   432  	case Role_FieldPathSelectorMetadata:
   433  		values = append(values, fps.subPath.GetRaw(source.GetMetadata())...)
   434  	default:
   435  		panic(fmt.Sprintf("Invalid selector for Role: %d", fps.selector))
   436  	}
   437  	return
   438  }
   439  
   440  func (fps *Role_FieldSubPath) GetRaw(source proto.Message) []interface{} {
   441  	return fps.Get(source.(*Role))
   442  }
   443  
   444  // GetSingle returns value of selected field from source Role
   445  func (fps *Role_FieldSubPath) GetSingle(source *Role) (interface{}, bool) {
   446  	switch fps.selector {
   447  	case Role_FieldPathSelectorDefaultConditionBinding:
   448  		if source.GetDefaultConditionBinding() == nil {
   449  			return nil, false
   450  		}
   451  		return fps.subPath.GetSingleRaw(source.GetDefaultConditionBinding())
   452  	case Role_FieldPathSelectorIncludedConditionBindings:
   453  		if len(source.GetIncludedConditionBindings()) == 0 {
   454  			return nil, false
   455  		}
   456  		return fps.subPath.GetSingleRaw(source.GetIncludedConditionBindings()[0])
   457  	case Role_FieldPathSelectorMetadata:
   458  		if source.GetMetadata() == nil {
   459  			return nil, false
   460  		}
   461  		return fps.subPath.GetSingleRaw(source.GetMetadata())
   462  	default:
   463  		panic(fmt.Sprintf("Invalid selector for Role: %d", fps.selector))
   464  	}
   465  }
   466  
   467  func (fps *Role_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
   468  	return fps.GetSingle(source.(*Role))
   469  }
   470  
   471  // GetDefault returns a default value of the field type
   472  func (fps *Role_FieldSubPath) GetDefault() interface{} {
   473  	return fps.subPath.GetDefault()
   474  }
   475  
   476  func (fps *Role_FieldSubPath) ClearValue(item *Role) {
   477  	if item != nil {
   478  		switch fps.selector {
   479  		case Role_FieldPathSelectorDefaultConditionBinding:
   480  			fps.subPath.ClearValueRaw(item.DefaultConditionBinding)
   481  		case Role_FieldPathSelectorIncludedConditionBindings:
   482  			for _, subItem := range item.IncludedConditionBindings {
   483  				fps.subPath.ClearValueRaw(subItem)
   484  			}
   485  		case Role_FieldPathSelectorMetadata:
   486  			fps.subPath.ClearValueRaw(item.Metadata)
   487  		default:
   488  			panic(fmt.Sprintf("Invalid selector for Role: %d", fps.selector))
   489  		}
   490  	}
   491  }
   492  
   493  func (fps *Role_FieldSubPath) ClearValueRaw(item proto.Message) {
   494  	fps.ClearValue(item.(*Role))
   495  }
   496  
   497  // IsLeaf - whether field path is holds simple value
   498  func (fps *Role_FieldSubPath) IsLeaf() bool {
   499  	return fps.subPath.IsLeaf()
   500  }
   501  
   502  func (fps *Role_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
   503  	iPaths := []gotenobject.FieldPath{&Role_FieldTerminalPath{selector: fps.selector}}
   504  	iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...)
   505  	return iPaths
   506  }
   507  
   508  func (fps *Role_FieldSubPath) WithIValue(value interface{}) Role_FieldPathValue {
   509  	return &Role_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)}
   510  }
   511  
   512  func (fps *Role_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
   513  	return fps.WithIValue(value)
   514  }
   515  
   516  func (fps *Role_FieldSubPath) WithIArrayOfValues(values interface{}) Role_FieldPathArrayOfValues {
   517  	return &Role_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)}
   518  }
   519  
   520  func (fps *Role_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
   521  	return fps.WithIArrayOfValues(values)
   522  }
   523  
   524  func (fps *Role_FieldSubPath) WithIArrayItemValue(value interface{}) Role_FieldPathArrayItemValue {
   525  	return &Role_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)}
   526  }
   527  
   528  func (fps *Role_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
   529  	return fps.WithIArrayItemValue(value)
   530  }
   531  
   532  // Role_FieldPathValue allows storing values for Role fields according to their type
   533  type Role_FieldPathValue interface {
   534  	Role_FieldPath
   535  	gotenobject.FieldPathValue
   536  	SetTo(target **Role)
   537  	CompareWith(*Role) (cmp int, comparable bool)
   538  }
   539  
   540  func ParseRole_FieldPathValue(pathStr, valueStr string) (Role_FieldPathValue, error) {
   541  	fp, err := ParseRole_FieldPath(pathStr)
   542  	if err != nil {
   543  		return nil, err
   544  	}
   545  	fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr)
   546  	if err != nil {
   547  		return nil, status.Errorf(codes.InvalidArgument, "error parsing Role field path value from %s: %v", valueStr, err)
   548  	}
   549  	return fpv.(Role_FieldPathValue), nil
   550  }
   551  
   552  func MustParseRole_FieldPathValue(pathStr, valueStr string) Role_FieldPathValue {
   553  	fpv, err := ParseRole_FieldPathValue(pathStr, valueStr)
   554  	if err != nil {
   555  		panic(err)
   556  	}
   557  	return fpv
   558  }
   559  
   560  type Role_FieldTerminalPathValue struct {
   561  	Role_FieldTerminalPath
   562  	value interface{}
   563  }
   564  
   565  var _ Role_FieldPathValue = (*Role_FieldTerminalPathValue)(nil)
   566  
   567  // GetRawValue returns raw value stored under selected path for 'Role' as interface{}
   568  func (fpv *Role_FieldTerminalPathValue) GetRawValue() interface{} {
   569  	return fpv.value
   570  }
   571  func (fpv *Role_FieldTerminalPathValue) AsNameValue() (*Name, bool) {
   572  	res, ok := fpv.value.(*Name)
   573  	return res, ok
   574  }
   575  func (fpv *Role_FieldTerminalPathValue) AsDisplayNameValue() (string, bool) {
   576  	res, ok := fpv.value.(string)
   577  	return res, ok
   578  }
   579  func (fpv *Role_FieldTerminalPathValue) AsIncludedPermissionsValue() ([]*permission.Reference, bool) {
   580  	res, ok := fpv.value.([]*permission.Reference)
   581  	return res, ok
   582  }
   583  func (fpv *Role_FieldTerminalPathValue) AsDefaultConditionBindingValue() (*condition.ConditionBinding, bool) {
   584  	res, ok := fpv.value.(*condition.ConditionBinding)
   585  	return res, ok
   586  }
   587  func (fpv *Role_FieldTerminalPathValue) AsIncludedConditionBindingsValue() ([]*condition.ConditionBinding, bool) {
   588  	res, ok := fpv.value.([]*condition.ConditionBinding)
   589  	return res, ok
   590  }
   591  func (fpv *Role_FieldTerminalPathValue) AsRequiredConditionsValue() ([]*condition.Reference, bool) {
   592  	res, ok := fpv.value.([]*condition.Reference)
   593  	return res, ok
   594  }
   595  func (fpv *Role_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) {
   596  	res, ok := fpv.value.(*meta.Meta)
   597  	return res, ok
   598  }
   599  
   600  // SetTo stores value for selected field for object Role
   601  func (fpv *Role_FieldTerminalPathValue) SetTo(target **Role) {
   602  	if *target == nil {
   603  		*target = new(Role)
   604  	}
   605  	switch fpv.selector {
   606  	case Role_FieldPathSelectorName:
   607  		(*target).Name = fpv.value.(*Name)
   608  	case Role_FieldPathSelectorDisplayName:
   609  		(*target).DisplayName = fpv.value.(string)
   610  	case Role_FieldPathSelectorIncludedPermissions:
   611  		(*target).IncludedPermissions = fpv.value.([]*permission.Reference)
   612  	case Role_FieldPathSelectorDefaultConditionBinding:
   613  		(*target).DefaultConditionBinding = fpv.value.(*condition.ConditionBinding)
   614  	case Role_FieldPathSelectorIncludedConditionBindings:
   615  		(*target).IncludedConditionBindings = fpv.value.([]*condition.ConditionBinding)
   616  	case Role_FieldPathSelectorRequiredConditions:
   617  		(*target).RequiredConditions = fpv.value.([]*condition.Reference)
   618  	case Role_FieldPathSelectorMetadata:
   619  		(*target).Metadata = fpv.value.(*meta.Meta)
   620  	default:
   621  		panic(fmt.Sprintf("Invalid selector for Role: %d", fpv.selector))
   622  	}
   623  }
   624  
   625  func (fpv *Role_FieldTerminalPathValue) SetToRaw(target proto.Message) {
   626  	typedObject := target.(*Role)
   627  	fpv.SetTo(&typedObject)
   628  }
   629  
   630  // CompareWith compares value in the 'Role_FieldTerminalPathValue' with the value under path in 'Role'.
   631  func (fpv *Role_FieldTerminalPathValue) CompareWith(source *Role) (int, bool) {
   632  	switch fpv.selector {
   633  	case Role_FieldPathSelectorName:
   634  		leftValue := fpv.value.(*Name)
   635  		rightValue := source.GetName()
   636  		if leftValue == nil {
   637  			if rightValue != nil {
   638  				return -1, true
   639  			}
   640  			return 0, true
   641  		}
   642  		if rightValue == nil {
   643  			return 1, true
   644  		}
   645  		if leftValue.String() == rightValue.String() {
   646  			return 0, true
   647  		} else if leftValue.String() < rightValue.String() {
   648  			return -1, true
   649  		} else {
   650  			return 1, true
   651  		}
   652  	case Role_FieldPathSelectorDisplayName:
   653  		leftValue := fpv.value.(string)
   654  		rightValue := source.GetDisplayName()
   655  		if (leftValue) == (rightValue) {
   656  			return 0, true
   657  		} else if (leftValue) < (rightValue) {
   658  			return -1, true
   659  		} else {
   660  			return 1, true
   661  		}
   662  	case Role_FieldPathSelectorIncludedPermissions:
   663  		return 0, false
   664  	case Role_FieldPathSelectorDefaultConditionBinding:
   665  		return 0, false
   666  	case Role_FieldPathSelectorIncludedConditionBindings:
   667  		return 0, false
   668  	case Role_FieldPathSelectorRequiredConditions:
   669  		return 0, false
   670  	case Role_FieldPathSelectorMetadata:
   671  		return 0, false
   672  	default:
   673  		panic(fmt.Sprintf("Invalid selector for Role: %d", fpv.selector))
   674  	}
   675  }
   676  
   677  func (fpv *Role_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) {
   678  	return fpv.CompareWith(source.(*Role))
   679  }
   680  
   681  type Role_FieldSubPathValue struct {
   682  	Role_FieldPath
   683  	subPathValue gotenobject.FieldPathValue
   684  }
   685  
   686  var _ Role_FieldPathValue = (*Role_FieldSubPathValue)(nil)
   687  
   688  func (fpvs *Role_FieldSubPathValue) AsDefaultConditionBindingPathValue() (condition.ConditionBinding_FieldPathValue, bool) {
   689  	res, ok := fpvs.subPathValue.(condition.ConditionBinding_FieldPathValue)
   690  	return res, ok
   691  }
   692  func (fpvs *Role_FieldSubPathValue) AsIncludedConditionBindingsPathValue() (condition.ConditionBinding_FieldPathValue, bool) {
   693  	res, ok := fpvs.subPathValue.(condition.ConditionBinding_FieldPathValue)
   694  	return res, ok
   695  }
   696  func (fpvs *Role_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) {
   697  	res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue)
   698  	return res, ok
   699  }
   700  
   701  func (fpvs *Role_FieldSubPathValue) SetTo(target **Role) {
   702  	if *target == nil {
   703  		*target = new(Role)
   704  	}
   705  	switch fpvs.Selector() {
   706  	case Role_FieldPathSelectorDefaultConditionBinding:
   707  		fpvs.subPathValue.(condition.ConditionBinding_FieldPathValue).SetTo(&(*target).DefaultConditionBinding)
   708  	case Role_FieldPathSelectorIncludedConditionBindings:
   709  		panic("FieldPath setter is unsupported for array subpaths")
   710  	case Role_FieldPathSelectorMetadata:
   711  		fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata)
   712  	default:
   713  		panic(fmt.Sprintf("Invalid selector for Role: %d", fpvs.Selector()))
   714  	}
   715  }
   716  
   717  func (fpvs *Role_FieldSubPathValue) SetToRaw(target proto.Message) {
   718  	typedObject := target.(*Role)
   719  	fpvs.SetTo(&typedObject)
   720  }
   721  
   722  func (fpvs *Role_FieldSubPathValue) GetRawValue() interface{} {
   723  	return fpvs.subPathValue.GetRawValue()
   724  }
   725  
   726  func (fpvs *Role_FieldSubPathValue) CompareWith(source *Role) (int, bool) {
   727  	switch fpvs.Selector() {
   728  	case Role_FieldPathSelectorDefaultConditionBinding:
   729  		return fpvs.subPathValue.(condition.ConditionBinding_FieldPathValue).CompareWith(source.GetDefaultConditionBinding())
   730  	case Role_FieldPathSelectorIncludedConditionBindings:
   731  		return 0, false // repeated field
   732  	case Role_FieldPathSelectorMetadata:
   733  		return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata())
   734  	default:
   735  		panic(fmt.Sprintf("Invalid selector for Role: %d", fpvs.Selector()))
   736  	}
   737  }
   738  
   739  func (fpvs *Role_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) {
   740  	return fpvs.CompareWith(source.(*Role))
   741  }
   742  
   743  // Role_FieldPathArrayItemValue allows storing single item in Path-specific values for Role according to their type
   744  // Present only for array (repeated) types.
   745  type Role_FieldPathArrayItemValue interface {
   746  	gotenobject.FieldPathArrayItemValue
   747  	Role_FieldPath
   748  	ContainsValue(*Role) bool
   749  }
   750  
   751  // ParseRole_FieldPathArrayItemValue parses string and JSON-encoded value to its Value
   752  func ParseRole_FieldPathArrayItemValue(pathStr, valueStr string) (Role_FieldPathArrayItemValue, error) {
   753  	fp, err := ParseRole_FieldPath(pathStr)
   754  	if err != nil {
   755  		return nil, err
   756  	}
   757  	fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr)
   758  	if err != nil {
   759  		return nil, status.Errorf(codes.InvalidArgument, "error parsing Role field path array item value from %s: %v", valueStr, err)
   760  	}
   761  	return fpaiv.(Role_FieldPathArrayItemValue), nil
   762  }
   763  
   764  func MustParseRole_FieldPathArrayItemValue(pathStr, valueStr string) Role_FieldPathArrayItemValue {
   765  	fpaiv, err := ParseRole_FieldPathArrayItemValue(pathStr, valueStr)
   766  	if err != nil {
   767  		panic(err)
   768  	}
   769  	return fpaiv
   770  }
   771  
   772  type Role_FieldTerminalPathArrayItemValue struct {
   773  	Role_FieldTerminalPath
   774  	value interface{}
   775  }
   776  
   777  var _ Role_FieldPathArrayItemValue = (*Role_FieldTerminalPathArrayItemValue)(nil)
   778  
   779  // GetRawValue returns stored element value for array in object Role as interface{}
   780  func (fpaiv *Role_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} {
   781  	return fpaiv.value
   782  }
   783  func (fpaiv *Role_FieldTerminalPathArrayItemValue) AsIncludedPermissionsItemValue() (*permission.Reference, bool) {
   784  	res, ok := fpaiv.value.(*permission.Reference)
   785  	return res, ok
   786  }
   787  func (fpaiv *Role_FieldTerminalPathArrayItemValue) AsIncludedConditionBindingsItemValue() (*condition.ConditionBinding, bool) {
   788  	res, ok := fpaiv.value.(*condition.ConditionBinding)
   789  	return res, ok
   790  }
   791  func (fpaiv *Role_FieldTerminalPathArrayItemValue) AsRequiredConditionsItemValue() (*condition.Reference, bool) {
   792  	res, ok := fpaiv.value.(*condition.Reference)
   793  	return res, ok
   794  }
   795  
   796  func (fpaiv *Role_FieldTerminalPathArrayItemValue) GetSingle(source *Role) (interface{}, bool) {
   797  	return nil, false
   798  }
   799  
   800  func (fpaiv *Role_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) {
   801  	return fpaiv.GetSingle(source.(*Role))
   802  }
   803  
   804  // Contains returns a boolean indicating if value that is being held is present in given 'Role'
   805  func (fpaiv *Role_FieldTerminalPathArrayItemValue) ContainsValue(source *Role) bool {
   806  	slice := fpaiv.Role_FieldTerminalPath.Get(source)
   807  	for _, v := range slice {
   808  		if asProtoMsg, ok := fpaiv.value.(proto.Message); ok {
   809  			if proto.Equal(asProtoMsg, v.(proto.Message)) {
   810  				return true
   811  			}
   812  		} else if reflect.DeepEqual(v, fpaiv.value) {
   813  			return true
   814  		}
   815  	}
   816  	return false
   817  }
   818  
   819  type Role_FieldSubPathArrayItemValue struct {
   820  	Role_FieldPath
   821  	subPathItemValue gotenobject.FieldPathArrayItemValue
   822  }
   823  
   824  // GetRawValue returns stored array item value
   825  func (fpaivs *Role_FieldSubPathArrayItemValue) GetRawItemValue() interface{} {
   826  	return fpaivs.subPathItemValue.GetRawItemValue()
   827  }
   828  func (fpaivs *Role_FieldSubPathArrayItemValue) AsDefaultConditionBindingPathItemValue() (condition.ConditionBinding_FieldPathArrayItemValue, bool) {
   829  	res, ok := fpaivs.subPathItemValue.(condition.ConditionBinding_FieldPathArrayItemValue)
   830  	return res, ok
   831  }
   832  func (fpaivs *Role_FieldSubPathArrayItemValue) AsIncludedConditionBindingsPathItemValue() (condition.ConditionBinding_FieldPathArrayItemValue, bool) {
   833  	res, ok := fpaivs.subPathItemValue.(condition.ConditionBinding_FieldPathArrayItemValue)
   834  	return res, ok
   835  }
   836  func (fpaivs *Role_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) {
   837  	res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue)
   838  	return res, ok
   839  }
   840  
   841  // Contains returns a boolean indicating if value that is being held is present in given 'Role'
   842  func (fpaivs *Role_FieldSubPathArrayItemValue) ContainsValue(source *Role) bool {
   843  	switch fpaivs.Selector() {
   844  	case Role_FieldPathSelectorDefaultConditionBinding:
   845  		return fpaivs.subPathItemValue.(condition.ConditionBinding_FieldPathArrayItemValue).ContainsValue(source.GetDefaultConditionBinding())
   846  	case Role_FieldPathSelectorIncludedConditionBindings:
   847  		return false // repeated/map field
   848  	case Role_FieldPathSelectorMetadata:
   849  		return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata())
   850  	default:
   851  		panic(fmt.Sprintf("Invalid selector for Role: %d", fpaivs.Selector()))
   852  	}
   853  }
   854  
   855  // Role_FieldPathArrayOfValues allows storing slice of values for Role fields according to their type
   856  type Role_FieldPathArrayOfValues interface {
   857  	gotenobject.FieldPathArrayOfValues
   858  	Role_FieldPath
   859  }
   860  
   861  func ParseRole_FieldPathArrayOfValues(pathStr, valuesStr string) (Role_FieldPathArrayOfValues, error) {
   862  	fp, err := ParseRole_FieldPath(pathStr)
   863  	if err != nil {
   864  		return nil, err
   865  	}
   866  	fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr)
   867  	if err != nil {
   868  		return nil, status.Errorf(codes.InvalidArgument, "error parsing Role field path array of values from %s: %v", valuesStr, err)
   869  	}
   870  	return fpaov.(Role_FieldPathArrayOfValues), nil
   871  }
   872  
   873  func MustParseRole_FieldPathArrayOfValues(pathStr, valuesStr string) Role_FieldPathArrayOfValues {
   874  	fpaov, err := ParseRole_FieldPathArrayOfValues(pathStr, valuesStr)
   875  	if err != nil {
   876  		panic(err)
   877  	}
   878  	return fpaov
   879  }
   880  
   881  type Role_FieldTerminalPathArrayOfValues struct {
   882  	Role_FieldTerminalPath
   883  	values interface{}
   884  }
   885  
   886  var _ Role_FieldPathArrayOfValues = (*Role_FieldTerminalPathArrayOfValues)(nil)
   887  
   888  func (fpaov *Role_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) {
   889  	switch fpaov.selector {
   890  	case Role_FieldPathSelectorName:
   891  		for _, v := range fpaov.values.([]*Name) {
   892  			values = append(values, v)
   893  		}
   894  	case Role_FieldPathSelectorDisplayName:
   895  		for _, v := range fpaov.values.([]string) {
   896  			values = append(values, v)
   897  		}
   898  	case Role_FieldPathSelectorIncludedPermissions:
   899  		for _, v := range fpaov.values.([][]*permission.Reference) {
   900  			values = append(values, v)
   901  		}
   902  	case Role_FieldPathSelectorDefaultConditionBinding:
   903  		for _, v := range fpaov.values.([]*condition.ConditionBinding) {
   904  			values = append(values, v)
   905  		}
   906  	case Role_FieldPathSelectorIncludedConditionBindings:
   907  		for _, v := range fpaov.values.([][]*condition.ConditionBinding) {
   908  			values = append(values, v)
   909  		}
   910  	case Role_FieldPathSelectorRequiredConditions:
   911  		for _, v := range fpaov.values.([][]*condition.Reference) {
   912  			values = append(values, v)
   913  		}
   914  	case Role_FieldPathSelectorMetadata:
   915  		for _, v := range fpaov.values.([]*meta.Meta) {
   916  			values = append(values, v)
   917  		}
   918  	}
   919  	return
   920  }
   921  func (fpaov *Role_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) {
   922  	res, ok := fpaov.values.([]*Name)
   923  	return res, ok
   924  }
   925  func (fpaov *Role_FieldTerminalPathArrayOfValues) AsDisplayNameArrayOfValues() ([]string, bool) {
   926  	res, ok := fpaov.values.([]string)
   927  	return res, ok
   928  }
   929  func (fpaov *Role_FieldTerminalPathArrayOfValues) AsIncludedPermissionsArrayOfValues() ([][]*permission.Reference, bool) {
   930  	res, ok := fpaov.values.([][]*permission.Reference)
   931  	return res, ok
   932  }
   933  func (fpaov *Role_FieldTerminalPathArrayOfValues) AsDefaultConditionBindingArrayOfValues() ([]*condition.ConditionBinding, bool) {
   934  	res, ok := fpaov.values.([]*condition.ConditionBinding)
   935  	return res, ok
   936  }
   937  func (fpaov *Role_FieldTerminalPathArrayOfValues) AsIncludedConditionBindingsArrayOfValues() ([][]*condition.ConditionBinding, bool) {
   938  	res, ok := fpaov.values.([][]*condition.ConditionBinding)
   939  	return res, ok
   940  }
   941  func (fpaov *Role_FieldTerminalPathArrayOfValues) AsRequiredConditionsArrayOfValues() ([][]*condition.Reference, bool) {
   942  	res, ok := fpaov.values.([][]*condition.Reference)
   943  	return res, ok
   944  }
   945  func (fpaov *Role_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) {
   946  	res, ok := fpaov.values.([]*meta.Meta)
   947  	return res, ok
   948  }
   949  
   950  type Role_FieldSubPathArrayOfValues struct {
   951  	Role_FieldPath
   952  	subPathArrayOfValues gotenobject.FieldPathArrayOfValues
   953  }
   954  
   955  var _ Role_FieldPathArrayOfValues = (*Role_FieldSubPathArrayOfValues)(nil)
   956  
   957  func (fpsaov *Role_FieldSubPathArrayOfValues) GetRawValues() []interface{} {
   958  	return fpsaov.subPathArrayOfValues.GetRawValues()
   959  }
   960  func (fpsaov *Role_FieldSubPathArrayOfValues) AsDefaultConditionBindingPathArrayOfValues() (condition.ConditionBinding_FieldPathArrayOfValues, bool) {
   961  	res, ok := fpsaov.subPathArrayOfValues.(condition.ConditionBinding_FieldPathArrayOfValues)
   962  	return res, ok
   963  }
   964  func (fpsaov *Role_FieldSubPathArrayOfValues) AsIncludedConditionBindingsPathArrayOfValues() (condition.ConditionBinding_FieldPathArrayOfValues, bool) {
   965  	res, ok := fpsaov.subPathArrayOfValues.(condition.ConditionBinding_FieldPathArrayOfValues)
   966  	return res, ok
   967  }
   968  func (fpsaov *Role_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) {
   969  	res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues)
   970  	return res, ok
   971  }